Fast multiplication of rows of one matrix and columns of the second matrix
이전 댓글 표시
I would like to compute v(k) = A(k, :)* B(:, k) as fast as possible (no-loops). Currently, I am doing diag(A * B) but it has unnecessary overhead of computation, and storage.
댓글 수: 2
Daniel Shub
2011년 10월 5일
Do you want to do it as fast as possible or without loops? The JIT accelerator means that those two things are not necessarily the same.
Daniel Shub
2011년 10월 5일
How big is A? Is it sparse or distributed or anything funky like that?
채택된 답변
추가 답변 (1개)
Daniel Shub
2011년 10월 5일
0 개 추천
Yair's blog has a nice post on memory issues and array operations:
It is not always obvious what is the best solution.
If your matrices are really big you might be better off distributing them to a graphic card. If your machine has a lot of cores, the for loop could be replaced by a parfor loop, or even distributed to a cluster. It is silly to worry about slight inefficiencies if you can access 1000+ cores.
카테고리
도움말 센터 및 File Exchange에서 Operating on Diagonal Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!