Is there a command to compress a matrix in memory in MATLAB?

3 ビュー (過去 30 日間)
MathWorks Support Team
MathWorks Support Team 2010 年 4 月 15 日
コメント済み: Steven Lord 2018 年 8 月 4 日
I would like to be able to compress a matrix in memory, so that I can do calculations on larger matrices.

採用された回答

MathWorks Support Team
MathWorks Support Team 2010 年 4 月 15 日
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 件のコメント
dpb
dpb 2018 年 8 月 4 日
It would still take having the original data to compress, wouldn't it?
Steven Lord
Steven Lord 2018 年 8 月 4 日
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.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

タグ

製品


リリース

R2006a

Community Treasure Hunt

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

Start Hunting!

Translated by