macro_rules! array_identity {
    ($tt:ty, $n:expr) => { ... };
}
Expand description

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());