-
-
Notifications
You must be signed in to change notification settings - Fork 62
Home
sarah edited this page Nov 21, 2022
·
1 revision
using faer_core::mat;
let a = mat![
[1.0, 2.0, 3.0],
[4.0, 5.0, 6.0],
];
assert_eq!(a.nrows(), 2);
assert_eq!(a.ncols(), 3);
assert_eq!(a[(1, 2)], 6.0);
using faer_core::mat;
let a = mat![
[1.0, 2.0, 3.0],
[4.0, 5.0, 6.0],
];
let b = mat![
[7.0, 8.0, 9.0],
[10.0, 11.0, 12.0],
];
let mut sum = mat![
[0.0, 0.0, 0.0],
[0.0, 0.0, 0.0],
];
sum
.as_mut()
.cwise()
.zip(a.as_ref())
.zip(b.as_ref())
.for_each(|sum, a, b| *sum = a + b);
using faer_core::{mat, mul::matmul, Conj, Parallelism};
let a = mat![
[1.0, 2.0, 3.0],
[4.0, 5.0, 6.0],
];
let b = mat![
[7.0, 8.0],
[9.0, 10.0],
[11.0, 12.0],
];
let mut mul = mat![
[0.0, 0.0],
[0.0, 0.0],
];
matmul(
mul.as_mut(),
Conj::No,
a.as_ref(),
Conj::No,
b.as_ref(),
Conj::No,
None,
1.0,
Parallelism::None
);