macro_rules! matrix { ( $start:expr;$end:expr;$step:expr, $row:expr, $col:expr, $shape:expr ) => { ... }; ( $value:expr, $row:expr, $col:expr, $shape:expr ) => { ... }; }
Expand description
More R like Matrix constructor (Macro)
§Examples
#[macro_use]
extern crate peroxide;
use peroxide::fuga::*;
fn main() {
let a = matrix!(1;4;1, 2, 2, Row); // start;end;step
let b = matrix(c!(1,2,3,4), 2, 2, Row);
let c = matrix(vec![1,2,3,4], 2, 2, Row); // Normal function
assert!(a == b && b == c);
let m = matrix!(0, 2, 2, Row);
assert_eq!(m, zeros!(2, 2));
}