Did I find the right examples for you? yes no

All Samples(52)  |  Call(42)  |  Derive(0)  |  Import(10)

src/s/y/sympy-0.7.5/sympy/matrices/tests/test_matrices.py   sympy(Download)
from sympy.matrices.matrices import (ShapeError, MatrixError,
    NonSquareMatrixError, DeferredVector)
from sympy.matrices import (
    GramSchmidt, ImmutableMatrix, ImmutableSparseMatrix, Matrix,
    SparseMatrix, casoratian, diag, eye, hessian,
def test_diag():
    a = Matrix([[1, 2], [2, 3]])
    b = Matrix([[3, x], [y, 3]])
    c = Matrix([[3, x, 3], [y, 3, z], [x, y, z]])
    assert diag(a, b, b) == Matrix([
        [0, 0, 0, 0, y, 3],
    ])
    assert diag(a, b, c) == Matrix([
        [1, 2, 0, 0, 0, 0, 0],
        [2, 3, 0, 0, 0, 0, 0],
        [0, 0, 0, 0, x, y, z],
    ])
    assert diag(a, c, b) == Matrix([
        [1, 2, 0, 0, 0, 0, 0],
        [2, 3, 0, 0, 0, 0, 0],
    b = Matrix([[1, 2], [3, 4]])
    c = Matrix([[5, 6]])
    assert diag(a, 7, b, c) == Matrix([
        [x, 0, 0, 0, 0, 0],
        [y, 0, 0, 0, 0, 0],

src/s/y/sympy-HEAD/sympy/matrices/tests/test_matrices.py   sympy(Download)
from sympy.matrices.matrices import (ShapeError, MatrixError,
    NonSquareMatrixError, DeferredVector)
from sympy.matrices import (
    GramSchmidt, ImmutableMatrix, ImmutableSparseMatrix, Matrix,
    SparseMatrix, casoratian, diag, eye, hessian,
def test_diag():
    a = Matrix([[1, 2], [2, 3]])
    b = Matrix([[3, x], [y, 3]])
    c = Matrix([[3, x, 3], [y, 3, z], [x, y, z]])
    assert diag(a, b, b) == Matrix([
        [0, 0, 0, 0, y, 3],
    ])
    assert diag(a, b, c) == Matrix([
        [1, 2, 0, 0, 0, 0, 0],
        [2, 3, 0, 0, 0, 0, 0],
        [0, 0, 0, 0, x, y, z],
    ])
    assert diag(a, c, b) == Matrix([
        [1, 2, 0, 0, 0, 0, 0],
        [2, 3, 0, 0, 0, 0, 0],
    b = Matrix([[1, 2], [3, 4]])
    c = Matrix([[5, 6]])
    assert diag(a, 7, b, c) == Matrix([
        [x, 0, 0, 0, 0, 0],
        [y, 0, 0, 0, 0, 0],

src/s/y/sympy-0.7.5/sympy/matrices/matrices.py   sympy(Download)
 
        blocks = list(map(_jblock_exponential, cells))
        from sympy.matrices import diag
        eJ = diag(* blocks)
        # n = self.rows
 
        """
        from sympy.matrices import diag
 
        if not self.is_square:
                        vec = vec / vec.norm()
                    P = P.col_insert(P.cols, vec)
            D = diag(*diagvals)
            self._diagonalize_clear_subproducts()
            return (P, D)
        """
        P, Jcells = self.jordan_cells()
        from sympy.matrices import diag
        J = diag(*Jcells)
        return P, type(self)(J)

src/s/y/sympy-HEAD/sympy/matrices/matrices.py   sympy(Download)
 
        blocks = list(map(_jblock_exponential, cells))
        from sympy.matrices import diag
        eJ = diag(* blocks)
        # n = self.rows
 
        """
        from sympy.matrices import diag
 
        if not self.is_square:
                        vec = vec / vec.norm()
                    P = P.col_insert(P.cols, vec)
            D = diag(*diagvals)
            self._diagonalize_clear_subproducts()
            return (P, D)
        """
        P, Jcells = self.jordan_cells()
        from sympy.matrices import diag
        J = diag(*Jcells)
        return P, type(self)(J)

src/s/y/sympy-0.7.5/sympy/matrices/dense.py   sympy(Download)
        inverse_ADJ
        """
        from sympy.matrices import diag
 
        method = kwargs.get('method', 'GE')
            for block in blocks:
                r.append(block.inv(method=method, iszerofunc=iszerofunc))
            return diag(*r)
 
        M = self.as_mutable()

src/s/y/sympy-HEAD/sympy/matrices/dense.py   sympy(Download)
        inverse_ADJ
        """
        from sympy.matrices import diag
 
        method = kwargs.get('method', 'GE')
            for block in blocks:
                r.append(block.inv(method=method, iszerofunc=iszerofunc))
            return diag(*r)
 
        M = self.as_mutable()