This function is used to return an identity matrix of the given size. An identity matrix is the one with diagonal elements initializes to 1 and all other elements to zero.
numpy.matlib.ones(size,dtype)
It accepts the following parameters.
It returns an identity matrix of the specified size and specified data type.
import numpy as np import numpy.matlib print(numpy.matlib.identity(4))
Output:
import numpy as np import numpy.matlib print(numpy.matlib.identity(4,int))
Output: