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

3 visualizaciones (últimos 30 días)
I would like to be able to compress a matrix in memory, so that I can do calculations on larger matrices.

Respuesta aceptada

MathWorks Support Team
MathWorks Support Team el 15 de Abr. de 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 comentarios
dpb
dpb el 4 de Ag. de 2018
It would still take having the original data to compress, wouldn't it?
Steven Lord
Steven Lord el 4 de Ag. de 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.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Logical en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2006a

Community Treasure Hunt

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

Start Hunting!

Translated by