"Error using zeros" maximum variable size allowed by the program is exceeded

조회 수: 20 (최근 30일)
I was trying to generate a 2^57 x 57 zeros matrix and error occurred. I tried with sparse and the error still persist. Is there anywhere can I generate the matrix efficiently.
Please help. I am student, still exploring how to work with MATLAB. Thank you.

채택된 답변

Steven Lord
Steven Lord 2016년 6월 23일
If you wanted to create that matrix as a logical array, it would require:
numElements = (2^57)*57;
exabytes = numElements/(1000^6)
exabytes =
8.21456572032379
To put that into perspective, take a look at the Wikipedia page for exabyte. One comparison:
"Therefore, one exabyte could hold a hundred thousand times the printed material, or 500 to 3000 times all content of the Library of Congress."
To process all possible subsets of a set with 57 elements (which is what I assume you're trying to do, based on the dimensions of the matrix you're trying to create) would require quite a bit of time.
numCombinations = 2^57;
processingTime = years(seconds(numCombinations))
processingTime =
4.5668e+09
You probably want to rethink your approach, unless perhaps you have a VERY large cluster of machines available.
  댓글 수: 1
Cassandra Wong
Cassandra Wong 2016년 6월 24일
I guess I have to change my approach then. Anyway, thank you sir you the explanation.

댓글을 달려면 로그인하십시오.

추가 답변 (3개)

James Tursa
James Tursa 2016년 6월 23일
편집: James Tursa 2016년 6월 23일
A matrix of size 2^57 x 57 doubles would take about 6.57e19 bytes of memory ... way way more than your computer has available. So no, there is no way to generate this matrix on your computer. Even a sparse matrix of this size would take too much memory just to store the index data.

Walter Roberson
Walter Roberson 2016년 6월 23일
A full array for that would require a virtual memory space more than 3 1/2 times larger than can be addressed with 64 bit memory. I don't think you are going to be able to create something that big. You might not be able to create anything that requires more than 2^48 bytes as all current implementations of the x64 architecture only have at most 48 address pins.

Najme Behdad
Najme Behdad 2017년 1월 2일
편집: Najme Behdad 2017년 1월 2일
A question comes to me, Is there a way processing for binary large scale matrix in MATLAB 2 ^ 40. Was this possibility added in MATLAB 2016? please help me
  댓글 수: 10
Walter Roberson
Walter Roberson 2017년 1월 3일
Do you mean you have a vector of 40 values and you are trying to find a subset of the values that totals exactly 1.0 ? If so, then you have to be very careful about round-off in your calculations.
Finding a subset of values with a particular total is known as the Knapsack problem.

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

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

Start Hunting!

Translated by