Output sparse matrix to csv

See solution in this post.