bundles / numpy latest / numpy / matlib / identity
function
numpy.matlib:identity
source: build-install/usr/lib/python3.14/site-packages/numpy/matlib.py :155
Signature
def identity ( n , dtype = None ) Summary
Returns the square identity matrix of given size.
Parameters
n: intSize of the returned identity matrix.
dtype: data-type, optionalData-type of the output. Defaults to
float.
Returns
out: matrixnxnmatrix with its main diagonal set to one, and all other elements zero.
Examples
import numpy.matlib np.matlib.identity(3, dtype=int)✓
See also
- matlib.eye
More general matrix identity function.
- numpy.identity
Equivalent array function.
Aliases
-
numpy.matlib.identity