sparse cell array?
10 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
i have a cell array where the cells contain matrices. i need to preallocate it for efficiency.
it has to be a cell array because i need to assign matrices in blocks.
but the cell array is huge... upwards of 30,000x30,000 with 10x10 matrices in diagonal and off diagonal cells (and at the corners).
once the matrices are assigned, i use a simple indexing routine to assign to assign all the elements to a sparse matrix of complex numbers.
while the final matrix is < 1 gb, the problem is that it requires ~10 gb of memory to assign the cell array in the first place...
is there a way to preallocate a sparse cell array?
thanks guys :D
0 commentaires
Réponses (1)
James Tursa
le 9 Juil 2018
If you mean can the cell array itself be sparse, the answer is no to that as MATLAB only supports sparse double and logical. What you could do is maintain the cell array as a simple linear array, and then keep track of the indexing yourself off to the side. E.g., with row & column number indexing arrays, or perhaps employing a sparse logical matrix to implicitly keep the indexing.
0 commentaires
Voir également
Catégories
En savoir plus sur Creating and Concatenating Matrices dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!