Macro vectrix::matrix

source ·
macro_rules! matrix {
    ($($data:tt)*) => { ... };
}
Expand description

A macro for composing matrices.

This macro allows one to write such a matrix in the natural order. For example:

let m = matrix![
    1.0, 4.0;
    2.0, 5.0;
    3.0, 6.0;
];

corresponds to the following matrix with three rows and two columns:

┌          ┐
│ 1.0  4.0 │
│ 2.0  5.0 │
│ 3.0  6.0 │
└          ┘

Which is stored as an array of arrays in column-major order.

Matrix { data: [[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]] }