Creating Dynamic High Dimensional Block Diagonal Matrix
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Hello,
I can create a matrix for dimenson = 2. However for even d and d>2, It should be a lock diagonal matrix of the previous result. I cannot run my code. I tried too many combination but I dont know how I can solve my problem
Here is my code:
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
A(:,:,1,k)=repmat(projectors_of_sigma_x(:,k),1,d); % In this line I am giving the value (1/sqrt(2)*[1;1]) to A(:,:,1,1) and value 1/sqrt(2)*[1;-1] to A(:,:,1,2)
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
0 Commenti
Risposte (0)
Vedere anche
Categorie
Scopri di più su Operating on Diagonal Matrices in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!