sparse cell array?
9 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (1)
James Tursa
am 9 Jul. 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 Kommentare
Siehe auch
Kategorien
Mehr zu Creating and Concatenating Matrices finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!