Aiming at optimizing following nested loop, the problem is how to deal with need for row-wise sum.
for i=1:N
for j=1:N
F(i,i)=(exp(-B(j,j))) * P(i,j)+ F(i,i);
end
end
Specifically, I want to eliminate loops and it looks achievable according to this solution but the problem is how to store changing value of F in each iteration.
I come up with this idea :
for j=1:N
F(:)=(exp(-B(j,j))) * P(:,j)+ F(:);
end
Using this solution, F will be overwritten in every iteration!! Any idea?