Return the identity array.
The identity array is a square array with ones on the main diagonal.
Parameters : | n : int
dtype : data-type, optional
|
---|---|
Returns : | out : ndarray
|
Examples
>>> np.identity(3)
array([[ 1., 0., 0.],
[ 0., 1., 0.],
[ 0., 0., 1.]])