Did I find the right examples for you? yes no

# numpy.matlib.eye

All Samples(48)  |  Call(42)  |  Derive(0)  |  Import(6)
```Return a matrix with ones on the diagonal and zeros elsewhere.

Parameters
----------
n : int
Number of rows in the output.
M : int, optional
Number of columns in the output, defaults to `n`.
k : int, optional
Index of the diagonal: 0 refers to the main diagonal,(more...)
```

```        def eye(n,M=None, k=0, dtype=float):
"""
Return a matrix with ones on the diagonal and zeros elsewhere.

Parameters
----------
n : int
Number of rows in the output.
M : int, optional
Number of columns in the output, defaults to `n`.
k : int, optional
Index of the diagonal: 0 refers to the main diagonal,
a positive value refers to an upper diagonal,
and a negative value to a lower diagonal.
dtype : dtype, optional
Data-type of the returned matrix.

Returns
-------
I : matrix
A `n` x `M` matrix where all elements are equal to zero,
except for the `k`-th diagonal, whose values are equal to one.

--------
numpy.eye : Equivalent array function.
identity : Square identity matrix.

Examples
--------
>>> import numpy.matlib
>>> np.matlib.eye(3, k=1, dtype=float)
matrix([[ 0.,  1.,  0.],
[ 0.,  0.,  1.],
[ 0.,  0.,  0.]])

"""
return asmatrix(np.eye(n, M, k, dtype))
```

```            Theta_mat = -HH
Xi_mat = \
np.concatenate((Gamma_mat,Theta_mat,MAT.eye(m_states),\
MAT.zeros((m_states,m_states))),1)
Delta_mat = \
np.concatenate((Psi_mat,MAT.zeros((m_states,m_states)),\
MAT.zeros((m_states,m_states)),\
MAT.zeros((m_states,m_states)),MAT.eye(m_states),1))
```
```            Theta_mat = -HH
Xi_mat = \
np.concatenate((Gamma_mat,Theta_mat,MAT.eye(m_states),\
MAT.zeros((m_states,m_states))),1)
Delta_mat = \
np.concatenate((Psi_mat,MAT.zeros((m_states,m_states)),\
MAT.zeros((m_states,m_states)),\
MAT.zeros((m_states,m_states)),MAT.eye(m_states),1))
```
```                   np.concatenate((\
np.concatenate((Gamma_mat,Theta_mat),1),\
np.concatenate((MAT.eye(m_states),MAT.zeros((m_states,m_states))),1)\
))
Delta_mat = \
```

```from numpy import r_, c_, arange, diff, mean, sqrt, log, mat
from numpy import asarray, nan
from numpy.matlib import ones, zeros, rand, eye, empty
from numpy.linalg import eigh, cholesky, solve, lstsq
# (lstsq also as tool to determine rank)
```
```    return u[:, rk:]

from numpy.matlib import empty, zeros, eye, mat, asarray
from numpy.linalg import lstsq
def getOrthColumns(m):
```
```    if rk == p: result = zeros((p,0))   # note the shape! hopefully octave-like
# then the zero-matrix case (within machine precision):
elif rk == 0: result = eye(p)
# now the rank-deficient case:
elif rk < r:
```
```            # 2. if zero, then also put a zero row in c
# 3. if not, put the next unit vector in c-row
idr = eye(r)
idpr = eye(p-r)
c = empty([0,r])    # starting point
```

```from numpy import r_, c_, arange, diff, mean, sqrt, log, mat
from numpy import asarray, nan
from numpy.matlib import ones, zeros, rand, eye, empty
from numpy.linalg import eigh, cholesky, solve, lstsq
# (lstsq also as tool to determine rank)
```
```    return u[:, rk:]

from numpy.matlib import empty, zeros, eye, mat, asarray
from numpy.linalg import lstsq
def getOrthColumns(m):
```
```    if rk == p: result = zeros((p,0))   # note the shape! hopefully octave-like
# then the zero-matrix case (within machine precision):
elif rk == 0: result = eye(p)
# now the rank-deficient case:
elif rk < r:
```
```            # 2. if zero, then also put a zero row in c
# 3. if not, put the next unit vector in c-row
idr = eye(r)
idpr = eye(p-r)
c = empty([0,r])    # starting point
```

```def test_eye():
x = np.matlib.eye(3, k=1, dtype=int)
assert_array_equal(x, np.matrix([[ 0,  1,  0],
[ 0,  0,  1],
[ 0,  0,  0]]))
```

```def test_eye():
x = np.matlib.eye(3, k=1, dtype=int)
assert_array_equal(x, np.matrix([[ 0,  1,  0],
[ 0,  0,  1],
[ 0,  0,  0]]))
```

```def test_eye():
x = np.matlib.eye(3, k=1, dtype=int)
assert_array_equal(x, np.matrix([[ 0,  1,  0],
[ 0,  0,  1],
[ 0,  0,  0]]))
```

```		for t in range(T-2,1,-1):