opensrdk_linear_algebra/macros/
mod.rs1pub mod stack;
2pub mod sub_matrix;
3pub mod zeros;
4
5#[macro_export]
15macro_rules! mat {
16 () => {
17 {
18 Matrix::new(0, 0)
19 }
20 };
21 ($($e: expr),+) => {
22 {
23 use $crate::stack;
24 stack!($($e),+).matrix()
25 }
26 };
27 ($($($e: expr),+);+) => {
28 {
29 use $crate::stack;
30 stack!($($($e),+);+).matrix()
31 }
32 };
33}
34
35#[cfg(test)]
36mod tests {
37 #[test]
38 fn it_works() {
39 let a = mat!(
40 1.0, 0.0, 1.0;
41 0.0, 1.0, 0.0
42 );
43
44 assert_eq!(a[(0, 0)], 1.0);
45 assert_eq!(a[(0, 1)], 0.0);
46 assert_eq!(a[(1, 0)], 0.0);
47 assert_eq!(a[(1, 2)], 0.0);
48 }
49}