[][src]Macro aljabar::matrix

macro_rules! matrix {
    ( $item:expr ) => { ... };
    ( $($rows:expr),* $(,)? ) => { ... };
}

Construct a Matrix of any size. The matrix is specified in row-major order, but this function converts it to aljabar's native column-major order.

This example is not tested
// `matrix` allows you to create a matrix using natural writing order (row-major).
let m1: Matrix<u32, 4, 3> = matrix![
    [0, 1, 2],
    [3, 4, 5],
    [6, 7, 8],
    [9, 0, 1],
];

// The equivalent code using the From implementation is below. Note the From
// usage requires you to specify the entries in column-major order, and create
// the sub-Vectors explicitly.
let m2: Matrix<u32, 4, 3> = Matrix::<u32, 4, 3>::from([
    Vector::<u32, 4>::from([0, 3, 6, 9]),
    Vector::<u32, 4>::from([1, 4, 7, 0]),
    Vector::<u32, 4>::from([2, 5, 8, 1]),
]);

assert_eq!(m1, m2);