Efficient Vectorization of For Loop
Show older comments
Hi,
I have three matrices
and C and am trying to compute a fourth matrix Min the following way:
for p = 1:N
for q = 1:N
M(p,q) = 2 * sum(A(:,q) .* conj(B(:,p)) .* C(:,q));
end
end
All matrices are
. I am trying to compute this for N = 750 or so and the computation is extremely slow. I cannot find any obvious way to vectorize the code. Any help would be very much appreciated.
Thanks.
Accepted Answer
More Answers (0)
Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!