def sum(self, axis=None, target = None):
    """
    Sum the matrix along the given dimension, where 0 represents the leading
    dimension and 1 represents the non-leading dimension. If None, the sum
    of all elements is returned. If a target is not prvided, a new vector is
    created for storing the result.
    """
    if axis is None:
     return _eigenmat.sum_all(self.p_mat)
    else:
     return sum(self, axis, target)

    Sum the matrix along the given dimension, where 0 represents the leading
    dimension and 1 represents the non-leading dimension. If None, the sum
    of all elements is returned. If a target is not prvided, a new vector is
    created for storing the result.
    
eigenmat/eigenmat.py