Returns the square identity matrix of given size.
Size of the returned identity matrix.
Data-type of the output. Defaults to float.
n x n matrix with its main diagonal set to one, and all other elements zero.
See also
numpy.identityEquivalent array function.
matlib.eyeMore general matrix identity function.
>>> import numpy.matlib
>>> np.matlib.identity(3, dtype=int)
matrix([[1, 0, 0],
[0, 1, 0],
[0, 0, 1]])
© 2005–2024 NumPy Developers
Licensed under the 3-clause BSD License.
https://numpy.org/doc/2.4/reference/generated/numpy.matlib.identity.html