(matadd)
Merge explicit MatrixBase arguments

    >>> from sympy import MatrixSymbol, eye, Matrix, MatAdd, pprint
    >>> from sympy.matrices.expressions.matadd import merge_explicit
    >>> A = MatrixSymbol('A', 2, 2)
    >>> B = eye(2)
    >>> C = Matrix([[1, 2], [3, 4]])
    >>> X = MatAdd(A, B, C)
    >>> pprint(X)
    A + [1  0] + [1  2]
        [    ]   [    ]
        [0  1]   [3  4]
    >>> pprint(merge_explicit(X))
    A + [2  2]
        [    ]
        [3  5]
Merge explicit MatrixBase arguments
Merge explicit MatrixBase arguments
def merge_explicit(matadd):
    """ Merge explicit MatrixBase arguments

    >>> from sympy import MatrixSymbol, eye, Matrix, MatAdd, pprint
    >>> from sympy.matrices.expressions.matadd import merge_explicit
    >>> A = MatrixSymbol('A', 2, 2)
    >>> B = eye(2)
    >>> C = Matrix([[1, 2], [3, 4]])
    >>> X = MatAdd(A, B, C)
    >>> pprint(X)
    A + [1  0] + [1  2]
        [    ]   [    ]
        [0  1]   [3  4]
    >>> pprint(merge_explicit(X))
    A + [2  2]
        [    ]
        [3  5]
    """
    groups = sift(matadd.args, lambda arg: isinstance(arg, MatrixBase))
    if len(groups[True]) > 1:
        return MatAdd(*(groups[False] + [reduce(add, groups[True])]))
    else:
        return matadd
def merge_explicit ( matadd ) : groups = sift ( matadd . args , lambda arg : isinstance ( arg , MatrixBase ) ) if len ( groups [ True ] ) > 1 : return MatAdd ( * ( groups [ False ] + [ reduce ( add , groups [ True ] ) ] ) ) else : return matadd