This function returns a matrix with the diagonal elements initialized to 1 and zero elsewhere.
numpy.matlib.eye(n, m, k, dtype)
It accepts the following parameters.
A matrix with uninitialized entries is returned.
import numpy as np import numpy.matlib print(numpy.matlib.eye(n=3,m=3,k=0,dtype=int))
Output:
import numpy as np import numpy.matlib print(numpy.matlib.eye(n=3,m=3,k=0,dtype=float))
Output: