matrix::matrix! [] [src]

macro_rules! matrix {
    ($([$tail:expr,];)* -> [$($head:expr,)*]) => { ... };
    ($([$middle:expr, $($tail:expr,)*];)* -> [$($head:expr,)*]) => { ... };
    ($($($item:expr),*;)*) => { ... };
    ($($($item:expr,)*;)*) => { ... };
}

A macro for composing matrices in the natural order.

The data of a generic matrix is conventionally stored in the column-major order; see format::conventional. Consequently, the vector

vec![
    1.0, 2.0, 3.0, 4.0,
    5.0, 6.0, 7.0, 8.0,
]

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

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

The macro allows one to write such a matrix in the natural order:

matrix![
    1.0, 5.0;
    2.0, 6.0;
    3.0, 7.0;
    4.0, 8.0;
]