def __init__(self, mat):
        assert isinstance(mat, (SparseMatrix, list))
        self.bc_mats = []
        if isinstance(mat, list):
            bc_mats = extract_bc_matrices([mat])
            mat = sum(mat[1:], mat[0])
            self.bc_mats = bc_mats
        self.mat = mat
        self._lu = None
        self._inner_arg = None # argument to inner_solve
        assert self.mat.shape[0] == self.mat.shape[1]