sparsify function

Create sparse matrix