sparse cell array?

10 ビュー (過去 30 日間)
Adam Craig
Adam Craig 2018 年 7 月 9 日
回答済み: James Tursa 2018 年 7 月 9 日
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

回答 (1 件)

James Tursa
James Tursa 2018 年 7 月 9 日
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.

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by