Macro numb_rs::mat [−][src]
macro_rules! mat {
() => { ... };
($($($item : expr), +) ; +) => { ... };
($val : expr => $m : expr, $n : expr) => { ... };
}
Expand description
With a focus on being concise: This macro will create a matrix using syntax similar to matlab A semicolon ‘;’ represends a new matrix row
example 1:
let a = mat![
0, 1, 2;
3, 4, 5
];
will provide a 3x2 matrix as specified
example 2:
It’s also possible to initialise a matrix with a given value This uses a different syntax to standard rust code due to a semicolon being used to denote a row change. for instance:
let x = [0.;5];
is translated to:
let x = mat![0. => 5, 1];
where 5, 1 represent m and n, i.e. the row and column lengths respectively