def save_matrix(f, m): np.savez_compressed(f, data=m.data, indices=m.indices, indptr=m.indptr, shape=m.shape)