Optimization of multiplying specific indices

1 view (last 30 days)
Da
Da on 6 May 2014
I would like to optimize this brute force code that simply multiples specific indices of one vector Psi with two matrices UL and UR.
NewPsi=zeros(2^(2*N),1);
for a=(1:2^(N-1))
for a_1=(1:2^(N-1))
for alpha=(1:2)
for beta=(1:2)
for gamma=(1:2)
for b=(1:2^(N-1))
for b_1=(1:2^(N-1))
NewPsi((a_1-1)*2^(N+1)+(alpha-1)*2^N+(beta-1)*2^(N-1)+b_1,1)= NewPsi((a_1-1)*2^(N+1)+(alpha-1)*2^N+(beta-1)*2^(N-1)+b_1,1)+UL((a_1-1)*2+alpha ,a)*Psi((a-1)*2^(N+1)+(beta-1)*2^N +(gamma-1)*2^(N-1)+b,1)*conj(UR((gamma-1)*2^(N-1)+b,b_1));
end;
end;
end;
end;
end;
end;
end;

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!