(self, other)
Add other to self, efficiently if possible.

        When adding a non-sparse matrix, the result is no longer
        sparse.

        Examples
        ========

        >>> from sympy.matrices import SparseMatrix, eye
        >>> A = SparseMatrix(eye(3)) + SparseMatrix(eye(3))
        >>> B = SparseMatrix(eye(3)) + eye(3)
        >>> A
        Matrix([
        [2, 0, 0],
        [0, 2, 0],
        [0, 0, 2]])
        >>> A == B
        True
        >>> isinstance(A, SparseMatrix) and isinstance(B, SparseMatrix)
        False
Add other to self, efficiently if possible.
Add other to self efficiently if possible .
def __add__(self, other):
        """Add other to self, efficiently if possible.

        When adding a non-sparse matrix, the result is no longer
        sparse.

        Examples
        ========

        >>> from sympy.matrices import SparseMatrix, eye
        >>> A = SparseMatrix(eye(3)) + SparseMatrix(eye(3))
        >>> B = SparseMatrix(eye(3)) + eye(3)
        >>> A
        Matrix([
        [2, 0, 0],
        [0, 2, 0],
        [0, 0, 2]])
        >>> A == B
        True
        >>> isinstance(A, SparseMatrix) and isinstance(B, SparseMatrix)
        False

        """
        if isinstance(other, SparseMatrix):
            return self.add(other)
        elif isinstance(other, MatrixBase):
            return other._new(other + self)
        else:
            raise NotImplementedError(
                "Cannot add %s to %s" %
                tuple([c.__class__.__name__ for c in (other, self)]))
def __add__ ( self , other ) : if isinstance ( other , SparseMatrix ) : return self . add ( other ) elif isinstance ( other , MatrixBase ) : return other . _new ( other + self ) else : raise NotImplementedError ( "Cannot add %s to %s" % tuple ( [ c . __class__ . __name__ for c in ( other , self ) ] ) )