Hello,
I have this value for element of my list:
And I have this code:
function [A,B] = CHSHmeasurement(d)
A=zeros(d,d,2,d);
B=A;
projectors_of_sigma_x = [1/sqrt(2)*[1;1],1/sqrt(2)*[1;-1]];
for k = 1:d
for l =1:length(projectors_of_sigma_x)
%A(k,k,1,k)=projectors_of_sigma_x(l);
A(:,:,1,k)=projectors_of_sigma_x(l);
end
end
end
However I have the same element for A although I have the different elements in the projectors_of_sigma_x

댓글 수: 2

madhan ravi
madhan ravi 2020년 6월 25일
Please provide the full error message. And d?
Gözde Üstün
Gözde Üstün 2020년 6월 25일
편집: Gözde Üstün 2020년 6월 25일
There is no error message but as you can see I have different value for projectors_of_sigma_x = [1/sqrt(2)*[1;1],1/sqrt(2)*[1;-1]]; (v1 and v2 you can see from the images clearly) but for the A(:,:1,1) and A(:,:,1,2) I have the same matrix and d is = 2

댓글을 달려면 로그인하십시오.

 채택된 답변

madhan ravi
madhan ravi 2020년 6월 25일
편집: madhan ravi 2020년 6월 25일

1 개 추천

for k = 1:d
for l =1:d
A(:,:,1,k) = repmat(projectors_of_sigma_x(:,k), 1, d);
end
end
I suggest you to read https://www.mathworks.com/company/newsletters/articles/matrix-indexing-in-matlab.html , first deal with 2D matrices before dealing with higher dimension matrices.

댓글 수: 4

Gözde Üstün
Gözde Üstün 2020년 6월 26일
Ahh thank you very much I just saw your answer now !
Gözde Üstün
Gözde Üstün 2020년 6월 27일
편집: Gözde Üstün 2020년 6월 28일
Then we dont need to second for loop right?? or should I change k as l in this line repmat(projectors_of_sigma_x(:,k), 1, d); ?? @madhan ravi
I have a problem for d>2 (and d should be even) For d >2 the result should be block diagonal like that:
0.7071 0.7071 0 0
0.7071 0.7071 0 0
0 0 0.7071 0.7071
0 0 0.7071 0.7071
And I tried almost all combinations with blkdiag but I can't cope with it
for k = 1:d
for l =1:d
A(:,:,1,k) = repmat(projectors_of_sigma_x(:,k), 1, d);
if k > 2
A(:,:,1,k) = repmat({A(:,:,1,k)}, 1, d/2); %This line and the following line I am trying to create a matrix which is a blog diagonal of the previous result for even d and of course d>2
A(:,:,1,k) = blkdiag(A{:,:,1,k});
end
end
end
madhan ravi
madhan ravi 2020년 6월 28일
When do you need ? I don't have time to analyse that sorry :( . I see that you have asked the same question already!
Gözde Üstün
Gözde Üstün 2020년 6월 28일
Ahh no worries! I can wait (till the tuesday) Yeah I asked and each question includes different version of my combination because I have tried too many combiations

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Multidimensional Arrays에 대해 자세히 알아보기

제품

릴리스

R2020a

질문:

2020년 6월 25일

댓글:

2020년 6월 28일

Community Treasure Hunt

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

Start Hunting!

Translated by