I have a large sparse matrix (~5 billion non-zero values) in Python, stored in the csc_matrix format. I need to open it as a sparse matrix in Matlab. savemat apparently cannot save data of this size (seems to be capped at ~5GB), so I am resorting to saving it as an hdf5 file, as detailed here. However, I am having trouble opening it in matlab.
Given these three vectors: data, indices, indptr
, whose meaning is explained:
standard CSC representation where the row indices for column i are stored in indices[indptr[i]:indptr[i+1]] and their corresponding values are stored in data[indptr[i]:indptr[i+1]].
How can I construct this matrix in Matlab? I can open these three vectors in Matlab using h5read
no problem, but I don't know how to use them to construct the sparse matrix. This is not the format of the sparse
command I usually use to construct a sparse matrix.