Hello,
there are answers for implementing a double sum. But what about a 3-fold sum of the type \sum (x_i*y_j*z_k)*M_{i,j,k} for some given vectors x,y,z and Tensor M.
A naiv implementation would be
SUM=0;for i=1:length(x) for j=1:length(y) for k=1:length(z) SUM = SUM + x(i)*y(j)*z(k)*M(i,j,k); end endend
How to implement this more efficiently in a more compact form?
Thanks for any help!
Best Answer