(self, other)
return rv
Fast multiplication exploiting the sparsity of the matrix.

        Examples
        ========

        >>> from sympy.matrices import SparseMatrix, ones
        >>> A, B = SparseMatrix(ones(4, 3)), SparseMatrix(ones(3, 4))
        >>> A.multiply(B) == 3*ones(4)
        True

        See Also
        ========

        add
Fast multiplication exploiting the sparsity of the matrix.
Fast multiplication exploiting the sparsity of the matrix .
def multiply(self, other):
        """Fast multiplication exploiting the sparsity of the matrix.

        Examples
        ========

        >>> from sympy.matrices import SparseMatrix, ones
        >>> A, B = SparseMatrix(ones(4, 3)), SparseMatrix(ones(3, 4))
        >>> A.multiply(B) == 3*ones(4)
        True

        See Also
        ========

        add
        """
        A = self
        B = other
        # sort B's row_list into list of rows
        Blist = [[] for i in range(B.rows)]
        for i, j, v in B.row_list():
            Blist[i].append((j, v))
        Cdict = defaultdict(int)
        for k, j, Akj in A.row_list():
            for n, Bjn in Blist[j]:
                temp = Akj*Bjn
                Cdict[k, n] += temp
        rv = self.zeros(A.rows, B.cols)
        rv._smat = dict([(k, v) for k, v in Cdict.items() if v])
        return rv
def multiply ( self , other ) : A = self B = other # sort B's row_list into list of rows Blist = [ [ ] for i in range ( B . rows ) ] for i , j , v in B . row_list ( ) : Blist [ i ] . append ( ( j , v ) ) Cdict = defaultdict ( int ) for k , j , Akj in A . row_list ( ) : for n , Bjn in Blist [ j ] : temp = Akj * Bjn Cdict [ k , n ] += temp rv = self . zeros ( A . rows , B . cols ) rv . _smat = dict ( [ ( k , v ) for k , v in Cdict . items ( ) if v ] ) return rv