I need to get the storage size of sparse matrix in amount of double numbers. I need to get this information in runtime.
The nonzero elements are stored, alongside with their row indices, so
nnz(x);
is a good approximation, as it returns the number of nonzero elements.
If your sparse matrix is getting unexpectedly big, you can check nnz
to keep track of a bug which may result in overwriting a lot of zero elements.
So the effectiveness of using sparse matrices can be also measured with
s=size(m_sparse);
effectiveness = 1 - nnz(x)/(s(1)*s(2))