Did I find the right examples for you? yes no

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.

    See Also
    --------
    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
        


src/p/y/pymaclab-0.95.9/pymaclab/dsge/solvers/modsolvers.py   pymaclab(Download)
                   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)

src/s/k/Skogestad-Python-HEAD/P_N_M_matrices.py   Skogestad-Python(Download)
# 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))
 

src/n/u/nupic-linux64-HEAD/lib64/python2.6/site-packages/numpy/tests/test_matlib.py   nupic-linux64(Download)
def test_identity():
    x = np.matlib.identity(2, dtype=np.int)
    assert_array_equal(x, np.matrix([[1, 0], [0, 1]]))
 
def test_eye():

src/m/i/MissionPlanner-HEAD/Lib/site-packages/numpy/tests/test_matlib.py   MissionPlanner(Download)
def test_identity():
    x = np.matlib.identity(2, dtype=np.int)
    assert_array_equal(x, np.matrix([[1, 0], [0, 1]]))
 
def test_eye():

src/n/u/numpy-1.8.1/numpy/tests/test_matlib.py   numpy(Download)
def test_identity():
    x = np.matlib.identity(2, dtype=np.int)
    assert_array_equal(x, np.matrix([[1, 0], [0, 1]]))
 
def test_eye():