A
is a 3D N*N*L matrix, x
is a N*1 vector, on which I need to do the following operation:
for i=1:L
res(i)=x'*squeeze(A(:,:,i))*x
end
I hope to use most efficient vectorized method instead of a for
loop. Please anyone give me some suggestions?