Memory efficient options for storing multiple square matrices of unequal size
5 views (last 30 days)
Show older comments
Hello MATLAB community,
this is my first time asking a question on these forums.
My problem is that in my codebase I require storage of many oddly shaped arrays that describe a block tridiagonal matrix. Ideally if the arrays were all the same dimension I'd use a sparse 3d array. Instead, I often find I have wildly different block sizes and sometimes these matrices are very sparse or in fact empty. In python (gasp) you can make a list that contains oddly sized matrices very easily but it does not seem so easy in MATLAB. The best solution I have arrived at is to use cells. Unfortunately the overhead for each cell is very large, especially when I have many sparse matrices, or many blocks of low dimension.
I'd love to hear any practicable ideas that the community has.
Cheers, Jesse
3 Comments
Walter Roberson
on 11 Oct 2019
The overhead per cell entry is about 100 - 112 bytes (depending on obscure factors)
MATLAB does not support 3D sparse arrays. You can simulate them using sub2ind and linear or 2D indexing
Answers (0)
See Also
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!