macro_rules! mat {
($([ $($x:expr),+ $(,)? ]),+ $(,)?) => { ... };
($cols:expr $(,)?) => { ... };
}Expand description
Ergonomic constructor for a Matrix from f64 column data.
Both forms build through Matrix::try_from_cols and unwrap the
result, so a length mismatch panics with the same error shape as the
underlying call.
§Forms
- Literal columns:
mat![[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]]produces a 3-row, 2-column matrix. - Slice-of-slices expression:
mat!(&[&[1.0, 2.0, 3.0][..], &[4.0, 5.0, 6.0][..]])produces the equivalent matrix from an existing&[&[f64]]value.
§Example
use minarrow::mat;
let m = mat![[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]];
assert_eq!((m.n_rows, m.n_cols), (3, 2));