コード例 #1
0
ファイル: blockmatrix.py プロジェクト: FireJade/sympy
    def _blockmul(self, other):

        if  (other.is_Matrix and other.is_BlockMatrix and
                self.blockshape[1] == other.blockshape[0] and
                self.colblocksizes == other.rowblocksizes):
            return BlockMatrix(self.blocks*other.blocks)

        return MatrixExpr.__mul__(self, other)
コード例 #2
0
ファイル: blockmatrix.py プロジェクト: BDGLunde/sympy
    def _blockmul(self, other):

        if  (other.is_Matrix and other.is_BlockMatrix and
                self.blockshape[1] == other.blockshape[0] and
                self.colblocksizes == other.rowblocksizes):
            return BlockMatrix(self.mat*other.mat)

        return MatrixExpr.__mul__(self, other)
コード例 #3
0
ファイル: blockmatrix.py プロジェクト: BDGLunde/sympy
    def _blockadd(self, other):

        if  (other.is_Matrix and other.is_BlockMatrix and
                self.blockshape == other.blockshape and
                self.rowblocksizes == other.rowblocksizes and
                self.colblocksizes == other.colblocksizes):
            return BlockMatrix(self.mat + other.mat)

        return MatrixExpr.__add__(self, other)
コード例 #4
0
ファイル: matpow.py プロジェクト: ArchKaine/sympy
 def __new__(cls, b, e):
     e = _sympify(e)
     if e is S.One or b.is_ZeroMatrix:
         return b
     elif not b.is_square:
         raise ShapeError("Power of non-square matrix %s"%b)
     elif e is S.Zero:
         return Identity(b.n)
     else:
         return MatrixExpr.__new__(cls, b, e)
コード例 #5
0
ファイル: matpow.py プロジェクト: tuhina/sympy
 def __new__(cls, b, e):
     e = _sympify(e)
     if e is S.One or b.is_ZeroMatrix:
         return b
     elif not b.is_square:
         raise ShapeError("Power of non-square matrix %s"%b)
     elif e is S.Zero:
         return Identity(b.n)
     else:
         return MatrixExpr.__new__(cls, b, e)
コード例 #6
0
ファイル: blockmatrix.py プロジェクト: FireJade/sympy
    def _blockadd(self, other):
        if   (other.is_Matrix and other.is_BlockMatrix
                and self.structurally_equal(other)):
            return BlockMatrix(self.blocks + other.blocks)

        return MatrixExpr.__add__(self, other)
コード例 #7
0
    def _blockadd(self, other):
        if (other.is_Matrix and other.is_BlockMatrix
                and self.structurally_equal(other)):
            return BlockMatrix(self.blocks + other.blocks)

        return MatrixExpr.__add__(self, other)