matlab out of memory error when multiplying 2 matrix
이전 댓글 표시
I have a X = 3*120744 double matrix and I am trying to calculate X'X but getting out of memory error. I have a system with 16G ram. So not sure what's going on. Any idea?
채택된 답변
추가 답변 (1개)
Steven Lord
2019년 3월 5일
With the specified dimensions, the result of X'*X will be size [120744 120744]. Assuming X is a real, full, double matrix that will require a contiguous block of memory of this size:
>> resultsize = [120744 120744];
>> numberOfElements = prod(resultsize);
>> bytes = 8*numberOfElements; % a real double requires 8 bytes
>> gb = bytes/(1024^3)
gb =
108.622860431671
You likely don't have a contiguous block of memory that large.
If you tell us more about the properties of X and why you're trying to compute X'*X (what your ultimate goal is) we may be able to suggest an alternative. If X is sparsely populated, for example, storing it as a sparse matrix may help.
카테고리
도움말 센터 및 File Exchange에서 Matrix Indexing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!