1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/// Create new 2d array with ones on the diagonal and zeros elsewhere
///
/// # Examples
///
/// ```
/// use arr_rs::prelude::*;
///
/// let arr = array_identity!(i32, 2);
/// assert_eq!(vec![2, 2], arr.get_shape().unwrap());
/// let arr = array_identity!(i32, 4);
/// assert_eq!(vec![4, 4], arr.get_shape().unwrap());
/// ```
#[macro_export]
macro_rules! array_identity {
    ($tt:ty, $n:expr) => {
        Array::<$tt>::identity($n)
    };
}