numpy.matlib.eye(n, M=None, k=0, dtype=<class 'float'>, order='C') [source]
Return a matrix with ones on the diagonal and zeros elsewhere.
| Parameters: |
|
|---|---|
| Returns: |
|
>>> import numpy.matlib
>>> np.matlib.eye(3, k=1, dtype=float)
matrix([[0., 1., 0.],
[0., 0., 1.],
[0., 0., 0.]])
© 2005–2019 NumPy Developers
Licensed under the 3-clause BSD License.
https://docs.scipy.org/doc/numpy-1.17.0/reference/generated/numpy.matlib.eye.html