ones

Macro ones 

Source
macro_rules! ones {
    ($ty:ty, $dim:expr) => { ... };
    ($ty:ty, $dim1:expr, $dim2:expr) => { ... };
    ($ty:ty, $dim1:expr, $dim2:expr, $dim3:expr) => { ... };
    ($ty:ty, $($dim:expr),+) => { ... };
}
Expand description

The ones! macro creates a multi-dimensional array filled with ones of the specified data type, supporting 1D, 2D, and 3D arrays. It generates a flattened vector of zeros and tracks the shape (dimensions) of the array, which includes the number of rows, columns, and further dimensions as needed.