Sparse matrix in c++