Skip to content

Commit 3c77100

Browse files
authored
Create EJM_dist_gen.py
EJM distribution generator
1 parent 9ae14af commit 3c77100

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import einops as ep
2+
import numpy as np
3+
4+
#Measurements
5+
e_1=1/np.sqrt(8)*np.array( [-1-1j,0,-2j,-1+1j] )
6+
e_2=1/np.sqrt(8)*np.array( [1-1j,2j,0,1+1j] )
7+
e_3=1/np.sqrt(8)*np.array( [-1+1j,2j,0,-1-1j] )
8+
e_4=1/np.sqrt(8)*np.array( [1+1j,0,-2j,1-1j] )
9+
10+
e_1=np.transpose(e_1).conj()
11+
e_2=np.transpose(e_2).conj()
12+
e_3=np.transpose(e_3).conj()
13+
e_4=np.transpose(e_4).conj()
14+
15+
16+
M_1=np.outer(e_1,np.transpose(e_1.conj()))
17+
M_2=np.outer(e_2,np.transpose(e_2.conj()))
18+
M_3=np.outer(e_3,np.transpose(e_3.conj()))
19+
M_4=np.outer(e_4,np.transpose(e_4.conj()))
20+
21+
M=[M_1,M_2,M_3,M_4]
22+
23+
24+
25+
#State
26+
psi=1/np.sqrt(2)*np.array( [0,1,-1,0] )
27+
rho=np.outer(psi,np.transpose(psi.conj()))
28+
print(rho)
29+
P0=0
30+
for i in range(4):
31+
for j in range(4):
32+
for k in range(4):
33+
for l in range(4):
34+
for m in range(4):
35+
for n in range(4):
36+
P0=rho[i][j]*rho[k][l]*rho[m][n]*M_1[i][n]*M_1[k][j]*M_1[m][l]+P0
37+
38+
print(P0)
39+
"""P=np.zeros((4,4,4))
40+
for a in range(4):
41+
for b in range(4):
42+
for c in range(4):
43+
P[a,b,c]=np.einsum("ij, kl, mn, in, jk , lm -> ", rho,rho, rho, M[a], M[b], M[c])
44+
print(P)"""

0 commit comments

Comments
 (0)