refactor sparse_matrix
merge