MATLAB: Is there an efficient way to create a 3 dimensional sparse matrix

ndsparserepmatvectorization

Hello, all ! I have some 2 dimensional large sparse matrix (may be more than 102,400,000 * 102,400,000) and want them to generate a 3 dimensional sparse matrix. I have tried the ndSparse function, but through profile report, it occupies lots of time. I am wandering if there are some other more efficient methods are slove this problem ! Thank you very much!

Best Answer

A solution depends on what you want to do with the data:
All sparse methods I know are optimized for 2D array manipulations. Therefore I assume, that the creation of the 3D-sparse array will not be the bottleneck for the complete program. If you do not need optimized 2D matrix manipulation methods, you can store the data in a cell array of 2d sparse matrices also, or in one 2D sparse array using a conversion of the indices.