I have these array:
When I have A_ax(2,2,2,2)the code is working and I am getting the correct result:
P = zeros(d,d,m,m);
P(a,b,x,y) = real( trace(kron(A_ax(:,:,x,a),B_by(:,:,y,b))*rho));
However when I have that A_ax(4,4,2,2) code is not working. This is because a is going untill 4 but I dont have 4. I know the error but I could not find a correction for that:
How can I solve the problem?