numeric::tensor!
[−]
[src]
macro_rules! tensor { (@count) => { ... }; (@count $head:tt $($tail:tt)*) => { ... }; ($elem:expr; $n:expr) => { ... }; ($($x:expr),*) => { ... }; ($($x:expr,)*) => { ... }; ($($($x:expr),*;)*) => { ... }; ($($($x:expr),*);*) => { ... }; }
Macro for creating vectors and matrices.
To use this macro, import Numeric as follows:
#[macro_use(tensor)]
extern crate numeric;
Examples
1D tensor (vector):
let x = tensor![1.0, 2.0, 3.0];
2D tensor (matrix):
let x = tensor![1, 0; 3, 2; 5, 4];
1D tensor filled with a single value:
let x = tensor![2.0; 5];