Return a matrix with ones on the diagonal and zeros elsewhere.
Parameters : | n : int
M : int, optional
k : int, optional
dtype : dtype, optional
|
---|---|
Returns : | I : matrix
|
Examples
>>> import numpy.matlib
>>> np.matlib.eye(3, k=1, dtype=float)
matrix([[ 0., 1., 0.],
[ 0., 0., 1.],
[ 0., 0., 0.]])