Macro extendr_api::prelude::modules::core::mat

macro_rules! mat {
    () => { ... };
    ($([$($v:expr),* $(,)?] ),* $(,)?) => { ... };
}
Expand description

Creates a Mat containing the arguments.

use faer::mat;

let matrix = mat![
    [1.0, 5.0, 9.0],
    [2.0, 6.0, 10.0],
    [3.0, 7.0, 11.0],
    [4.0, 8.0, 12.0f64],
];

assert_eq!(matrix.read(0, 0), 1.0);
assert_eq!(matrix.read(1, 0), 2.0);
assert_eq!(matrix.read(2, 0), 3.0);
assert_eq!(matrix.read(3, 0), 4.0);

assert_eq!(matrix.read(0, 1), 5.0);
assert_eq!(matrix.read(1, 1), 6.0);
assert_eq!(matrix.read(2, 1), 7.0);
assert_eq!(matrix.read(3, 1), 8.0);

assert_eq!(matrix.read(0, 2), 9.0);
assert_eq!(matrix.read(1, 2), 10.0);
assert_eq!(matrix.read(2, 2), 11.0);
assert_eq!(matrix.read(3, 2), 12.0);