diag

Macro diag 

Source
macro_rules! diag {
    ($d:expr) => { ... };
    ($d:expr, $ndim:literal) => { ... };
}
Expand description

Create a new n-dimensional diagonal array from a list of diagonal entries.

Call with diag!(d) where d is a one-dimensional array to obtain a two-dimensional array with d on the diagonal. For n-dimensional diagonal arrays, call with diag!(d, NDIM) where NDIM is the number of dimensions and d is a list of diagonal entries.