Is there a command to compress a matrix in memory in MATLAB?
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
MathWorks Support Team
am 15 Apr. 2010
Kommentiert: Steven Lord
am 4 Aug. 2018
I would like to be able to compress a matrix in memory, so that I can do calculations on larger matrices.
Akzeptierte Antwort
MathWorks Support Team
am 15 Apr. 2010
The ability to compress a matrix that is stored in memory is not available in MATLAB. The numerical data that is usually stored in the matrices is already stored in an efficient format.
A compression algorithm thus would not achieve any meaningful compression rates unless a lot of the elements are the equal. Compression algorithms are very time consuming and would slow down calculations.
To work around this issue, if your matrix contains a large amount of elements that are equal to cero, use the function SPARSE to create a sparse matrix that will store the matrix in a more memory-efficient way. Furthermore, and depending on your application, using a data type will less precision will also reduce the memory requirements of a large matrix.
3 Kommentare
Steven Lord
am 4 Aug. 2018
Depending on the structure of your data and what you want to do with it, there may be other alternatives. Some functions, like gmres or eigs, allow you to specify a function handle that computes some function of your matrix rather than providing the matrix itself. If you can perform the operations required to evaluate that function without explicitly creating the matrix, that may help you operate on larger data than you would otherwise be able to use.
Another option is to use a datastore to create a tall array to operate on data that cannot fit in memory.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Logical 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!