I have a bit of trouble with the space used by sparse matrices.
I use two ways of creating the same matrix, say P:
(1) allocating some space and filling the matrix like P(4,2) = 89; the space allocated at the beginning is exactly the space used.
(2) or creating 3 arrays of rows and columns indices and matrix values, and making P in just one command line.
What I observed: - when I create twice the same matrix with both methods, the space used in bigger for the first one (until half much more space).
- the second method was faster when I created one big matrix. but the first is faster when I create a relatively large cell array filled with many smaller sparse matrices. Actually, when using the first method, I receive this matlab warning (that advises me to use the second method) when I want to create the big sparse matrix but not when I create the cell arrays of matrices.
- with the second method, I obtain 3 arrays of 8MB but my matrix is 500MB!
I can't explain all these things. Could you?
No products are associated with this question.