You are returning a SparseMatrix, however. Perhaps you intended to return
just Matrix?