numpy.matlib.eye(n,M=None,k=0,dtype=<class 'float'>,order='C')[source]¶Return a matrix with ones on the diagonal and zeros elsewhere.
| Parameters: |
|
|---|---|
| Returns: |
|
Examples
>>>importnumpy.matlib>>>np.matlib.eye(3,k=1,dtype=float)matrix([[ 0., 1., 0.], [ 0., 0., 1.], [ 0., 0., 0.]])