What can I do to large scale array?

1 visualizzazione (ultimi 30 giorni)
C Zeng
C Zeng il 17 Ott 2012
Hi, I met a problem dealing with very large scale data.
My server's limit is:
>> [str,maxsize]=computer
str =
GLNXA64
maxsize =
2.8147e+14
And I define an array like ones(3^N, 3^N, N+1, 1000,'uint16') where N=13.
The error shows :
Error using ones Maximum variable size allowed by the program is exceeded.
My question is, can I use another data type to avoid this problem? I realize it is a very large scale to Matlab.
Thanks.
  2 Commenti
Honglei Chen
Honglei Chen il 17 Ott 2012
What do you intended to do with such a large matrix? It's one thing to be able to create a matrix, but I assume you also want to do some operation on it? Do you have to create all elements at once?
C Zeng
C Zeng il 18 Ott 2012
Honglei, yes, I created such a large array to compute values, and yes I have to keep such a large table, because I use dynamic programming. I may use 'uint8' because it is only 0 1 or 2 in my array.

Accedi per commentare.

Risposta accettata

José-Luis
José-Luis il 17 Ott 2012
Modificato: José-Luis il 17 Ott 2012
There are two limiters: data type and addressable memory. The data type will affect how much memory is needed. It can be solved by getting more RAM (although for the sizes you are talking about, I doubt that's a realistic solution).
The addressable memory, for all practical purposes, can't be solved. That is unless you had a 128 bits or more computer. Even then you would need to ask the Mathworks to modify Matlab to be able to use it. I don't know exactly how Matlab handles memory, but even though your matrix has less elements that the theoretical maximum in a 64 bit system (2^64-1), it still has more than what a Matlab matrix can handle (see previous link).
Both are limiters in your case, you can't create an array that large because you have more values than addressable memory (in Matlab), and even if that wasn't a problem, you would need too much memory.
What do you want to do with so large an array? A sparse array would help you reduce the size. To be of more help, more details are needed.
  5 Commenti
Walter Roberson
Walter Roberson il 2 Nov 2012
The limit for addressable memory on Intel's x64 current chips is 40 bits; that array would require 55 bits worth of data. Sparse arrays might help but more likely is that you will need to redesign the algorithm.
C Zeng
C Zeng il 7 Nov 2012
Thanks, Walter!

Accedi per commentare.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by