Working with Matlab for a 15! x 30 matrix
2 次查看(过去 30 天)
显示 更早的评论
Is there any way to have matlab run a matrix that is 15! x 15, a matrix comprised of all permutations of the integers 1:15.
I get an error saying that
"Requested 479001600x12 (42.8GB) array exceeds maximum array size preference. Creation of arrays greater than this limit may take a long time and
cause MATLAB to become unresponsive. See array size limit or preference panel for more information."
which makes sense but I am curious if this is a possible task and how I would go about running computations with this much information. I tried taking of the limit to the maximum array size, but as you might imagine my computer still could not process command.
Thank you for any tips or advice you might have.
2 个评论
Image Analyst
2020-5-28
Why do you need the whole 1,307,674,368,000-by-15 matrix in memory at the same time? Can't you process just chunks of it? Anyway, how many minutes, hours, or days do you think this 20 trillion element matrix will take to process?
回答(2 个)
Cris LaPierre
2020-5-28
That many rows qualifies this as a Tall Array. Perhaps consider looking into how to analyze Big Data in MATLAB.
0 个评论
Steven Lord
2020-5-28
To speak to some of the questions Image Analyst asked, how large a contiguous block of memory would storing this matrix require?
>> numRows = factorial(15);
>> numCols = 15;
>> numElements = numRows*numCols;
>> bytes = 8*numElements;
>> terabytes = bytes/(1024^4)
terabytes =
142.718749120831
Let's say for sake of argument you were able to store this. How long would it take to operate on these combinations, assuming you could process 1000 combinations per second?
>> processingTime = years(seconds(numRows)/1000)
processingTime =
41.4385510996119
So to be finished now, you would have to have started in the 1970s.
>> datetime('today')-years(processingTime)
ans =
datetime
19-Dec-1978 21:07:12
If you started now:
>> datetime('today')+years(processingTime)
ans =
datetime
04-Nov-2061 02:52:48
Let's hope you weren't running these calculations for something related to Halley's Comet -- it reached perihelion in July.
2 个评论
Steven Lord
2020-5-29
If you describe how you were hoping to use this very large array we might be able to suggest some alternate approaches.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!