Did I find the right examples for you? yes no

# numpy.matlib.identity

All Samples(16)  |  Call(16)  |  Derive(0)  |  Import(0)
```Returns the square identity matrix of given size.

Parameters
----------
n : int
Size of the returned identity matrix.
dtype : data-type, optional
Data-type of the output. Defaults to ``float``.

Returns(more...)
```

```        def identity(n,dtype=None):
"""
Returns the square identity matrix of given size.

Parameters
----------
n : int
Size of the returned identity matrix.
dtype : data-type, optional
Data-type of the output. Defaults to ``float``.

Returns
-------
out : matrix
`n` x `n` matrix with its main diagonal set to one,
and all other elements zero.

--------
numpy.identity : Equivalent array function.
matlib.eye : More general matrix identity function.

Examples
--------
>>> import numpy.matlib
>>> np.matlib.identity(3, dtype=int)
matrix([[1, 0, 0],
[0, 1, 0],
[0, 0, 1]])

"""
a = array([1]+n*[0], dtype=dtype)
b = empty((n, n), dtype=dtype)
b.flat = a
return b
```

```                   np.concatenate((\
np.concatenate((Gamma_mat,Theta_mat),1),\
np.concatenate((MAT.identity(m_states),MAT.zeros((m_states,m_states))),1)\
))
Psi_mat = Psi_mat.reshape(m_states,m_states)
Delta_mat = \
np.concatenate((\
np.concatenate((Psi_mat,MAT.zeros((m_states,m_states))),1),\
np.concatenate((MAT.zeros((m_states,m_states)),MAT.identity(m_states)),1)\
```
```        if l_equ == 0:
RR = MAT.zeros((0,m_states))
VV1 = MAT.kron(MAT.transpose(NN),FF)+MAT.kron(MAT.identity(k_exog),FF*PP+GG)
VV2 = MAT.kron(MAT.transpose(NN),JJ)+MAT.kron(MAT.identity(k_exog),KK)
VV = MAT.hstack((VV1,VV2))
else:
RR = -CC_plus*(AA*PP+BB)
VV1 = MAT.kron(MAT.identity(k_exog),AA)
```

```# TODO: Verify that correct dimension is used
dim = np.shape(G(1))[0]  # 1 (non-zero value) used to allow for ramps
I = np.matlib.identity(dim)
Z = np.matlib.zeros((dim, dim))

```

```def test_identity():
x = np.matlib.identity(2, dtype=np.int)
assert_array_equal(x, np.matrix([[1, 0], [0, 1]]))

def test_eye():
```

```def test_identity():
x = np.matlib.identity(2, dtype=np.int)
assert_array_equal(x, np.matrix([[1, 0], [0, 1]]))

def test_eye():
```

```def test_identity():