added reading and writing of sparse matrices