number of columns
optional number of rows, default n Results: Matrix which is 1 on the diagonal and 0 elsewhere
Real numbers
import mir.ndslice; import mir.math; assert(eye(1)== [ [1]]); assert(eye(2)== [ [1, 0], [0, 1]]); assert(eye(3)== [ [1, 0, 0], [0, 1, 0], [0, 0, 1]]); assert(eye(1,2) == [ [1,0]]); assert(eye(2,1) == [ [1], [0]]);
Identity matrix.