1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/*
   Appellation: concision-macros <library>
   Contrib: FL03 <jo3mccain@icloud.com>
*/
//! # Concision Macros

#[macro_export]
macro_rules! linspace {
    ( $x:expr ) => {
        {
            let dim = $x.into_dimension();
            let n = $dim.as_array_view().product();
            ndarray::Array::linspace(T::one(), T::from(n).unwrap(), n).into_shape(dim).unwrap()
        }
    };
    ( $( $x:expr ),* ) => {
        {
            let mut res = Vec::new();
            $(
                res.push(linarr!($x));
            )*
            res
        }
    };
}