sparse matrix construction