-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpartial_transpose.f90
27 lines (23 loc) · 1.51 KB
/
partial_transpose.f90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
!###################################################################################################################################
! PARTIAL TRANSPOSE
!###################################################################################################################################
subroutine partial_transpose_a(da, db, rho, rho_ta) ! Returns its partial transpose with relation to system A
implicit none
integer :: da, db ! Dimensions of the subsystems
complex(8) :: rho(1:da*db,1:da*db), rho_ta(1:da*db,1:da*db) ! Bipartite original and transposed states
integer :: ja, jb, ka, kb ! Auxiliary variable for counters
forall ( ja = 1:da, ka = 1:da, jb = 1:db, kb = 1:db )
rho_ta((ka-1)*db+jb,(ja-1)*db+kb) = rho((ja-1)*db+jb,(ka-1)*db+kb)
end forall
end
!------------------------------------------------------------------------------------------------------------------------------------
subroutine partial_transpose_b(da, db, rho, rho_tb) ! Returns the partial transpose with relation to system B
implicit none
integer :: da, db ! Dimensions of the subsystems
complex(8) :: rho(1:da*db,1:da*db), rho_tb(1:da*db,1:da*db) ! Bipartite original and transposed states
integer :: ja, jb, ka, kb ! Auxiliary variable for counters
forall ( ja = 1:da, ka = 1:da, jb = 1:db, kb = 1:db )
rho_tb((ja-1)*db+kb,(ka-1)*db+jb) = rho((ja-1)*db+jb,(ka-1)*db+kb)
end forall
end
!###################################################################################################################################