A short tes:
x = rand(2240, 94340); % 1.6 GB RAM
tic
y1 = x * x';
toc
tic
xt = x';
y2 = x * xt;
toc
On my i5 mobile chip in R2018b: 15.1 sec versus 28.5 sec. This shows that James' argument of the explicitly transposed matrix has a remarkable effect.
With the original input data [94340 x 2240] the output would need 71.2 GB of RAM and this is more than my laptop has. This might exceed the memory of your computer also.
You did not answer the question, if the matrix is sparse, so if it just some elements differ from zero. If it is full, remember, that the output of X*X' is symmetric. Then half of the 71.2 GB is redundand. If you habe e.g. 64 GB of RAM than using this fact can allow you to run the code efficiently. Unfortunately there are no built-in methods to exploit the symmetry of matrices and you'd have to implement this by your own, at least the matrix multiplication for your code.
@all readers: Is there a standard library to handle full or sparse symmetric matrices efficiently?
댓글 수: 6
이 댓글에 대한 바로 가기 링크
https://kr.mathworks.com/matlabcentral/answers/699825-multiplication-of-large-matrices#comment_1221485
이 댓글에 대한 바로 가기 링크
https://kr.mathworks.com/matlabcentral/answers/699825-multiplication-of-large-matrices#comment_1221485
이 댓글에 대한 바로 가기 링크
https://kr.mathworks.com/matlabcentral/answers/699825-multiplication-of-large-matrices#comment_1221535
이 댓글에 대한 바로 가기 링크
https://kr.mathworks.com/matlabcentral/answers/699825-multiplication-of-large-matrices#comment_1221535
이 댓글에 대한 바로 가기 링크
https://kr.mathworks.com/matlabcentral/answers/699825-multiplication-of-large-matrices#comment_1221680
이 댓글에 대한 바로 가기 링크
https://kr.mathworks.com/matlabcentral/answers/699825-multiplication-of-large-matrices#comment_1221680
이 댓글에 대한 바로 가기 링크
https://kr.mathworks.com/matlabcentral/answers/699825-multiplication-of-large-matrices#comment_1221690
이 댓글에 대한 바로 가기 링크
https://kr.mathworks.com/matlabcentral/answers/699825-multiplication-of-large-matrices#comment_1221690
이 댓글에 대한 바로 가기 링크
https://kr.mathworks.com/matlabcentral/answers/699825-multiplication-of-large-matrices#comment_1221775
이 댓글에 대한 바로 가기 링크
https://kr.mathworks.com/matlabcentral/answers/699825-multiplication-of-large-matrices#comment_1221775
이 댓글에 대한 바로 가기 링크
https://kr.mathworks.com/matlabcentral/answers/699825-multiplication-of-large-matrices#comment_1221825
이 댓글에 대한 바로 가기 링크
https://kr.mathworks.com/matlabcentral/answers/699825-multiplication-of-large-matrices#comment_1221825
댓글을 달려면 로그인하십시오.