Densify the sparse matrix

getData: add two new parameters
densify: a new function to densify the sparse matrix