Suppose I use numpy arrays (e.g. numpy.ndarray
) to store large, sparse matrices (i.e., most of the entries are 0): Do the zero entries actually occupy memory? Does numpy support sparse arrays, and if yes, which storage format is used?
I think that what you are really looking for is the scipy sparse module, which supports multiple formats.
SCIPY SPARSE DOCUMENTATION http://docs.scipy.org/doc/scipy/reference/sparse.html
The stackoverflow link below gives a great example of using scipy sparse matrices as well. Scipy sparse... arrays?