Working with a very large matrix
조회 수: 7 (최근 30일)
이전 댓글 표시
I would like to make a large matrix of size ~20000000 * 20000 and working with it. But it is not allowed because of memory shortage. as most of my elements at first, are zero, I could make the matrix with sparse function, but then my matrix will be filled with all elements of nonzero. the value of elements at first are 0-9 natural numbers and then real number (with 2 digit precision is fine).
Does anyone have any idea how to deal with such a large matrix? or any alternative way (data structure) to work with?
p.s: somebody suggested "parallel computing server", but I don't have it on my Matlab.
Thank you very much.
댓글 수: 0
답변 (1개)
John D'Errico
2016년 4월 4일
You cannot specify that a given number will only have 2 decimal places stored. If floating point, it must be either a single or a double.
Your array has 2e7*2e5=4e12 elements in it. Stored as single precision numbers, that is 4 bytes per element. So a total of roughly 1.6e13 bytes of RAM. Roughly 16 terabytes. Do you have that much memory?
If there are only a TINY percentage of non-zeros, then yes, you CAN use sparse storage, as long as you create the array using the sparse function, without creating a full array first.
If the array will undergo fill-in with further manipulations, then sparse storage is not acceptable.
댓글 수: 2
John D'Errico
2016년 4월 8일
Of course, IF you can create the matrix (in sparse form) and pass it along to use it in C/C++, then you can then do any processing on it that you wish, as long as you do not exceed your memory limits. Since I have no idea what processing you plan on doing, I cannot say that you can or cannot succeed. All of that depends on the degree of fill-in you have due to your processing.
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!