finish the sparsematrix