Skip to content

Commit edecf05

Browse files
committed
Release for 1.0.9
1 parent c77ec5c commit edecf05

5 files changed

Lines changed: 2168 additions & 5 deletions

File tree

docs/conf.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@
1818
# -- Project information -----------------------------------------------------
1919

2020
project = "toqito"
21-
copyright = "2020-2024, Toqito Contributors"
22-
author = "Contributors to Toqito"
21+
copyright = "2020-2024, toqito Contributors"
22+
author = "Contributors to toqito"
2323

2424
# The full version, including alpha/beta/rc tags
25-
release = "1.0.8"
25+
release = "1.0.9"
2626

2727

2828
# -- General configuration ---------------------------------------------------

main.py

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
import numpy as np
2+
3+
from toqito.matrices import standard_basis
4+
from toqito.nonlocal_games import ExtendedNonlocalGame
5+
from toqito.rand import random_povm
6+
from toqito.states import trine
7+
8+
import numpy as np
9+
from toqito.matrices import standard_basis
10+
from toqito.state_props import concurrence
11+
e_0, e_1 = standard_basis(2)
12+
e_00, e_11 = np.kron(e_0, e_0), np.kron(e_1, e_1)
13+
u_vec = 1 / np.sqrt(2) * (e_00 + e_11)
14+
rho = u_vec @ u_vec.conj().T
15+
print(np.around(concurrence(rho), decimals=2))
16+
17+
eps = 0.5
18+
print(np.around(1/3 * (2 + np.sqrt(1 - eps**2)), decimals=3))
19+
20+
21+
exit()
22+
23+
e_0, e_1 = standard_basis(2)
24+
ep = (e_0 + e_1) / np.sqrt(2)
25+
em = (e_0 - e_1) / np.sqrt(2)
26+
27+
dim = 2
28+
num_alice_out, num_bob_out = 2, 2
29+
num_alice_in, num_bob_in = 3, 3
30+
31+
povms = random_povm(dim=dim, num_inputs=num_alice_in, num_outputs=num_alice_out)
32+
33+
print(povms[:,:,0,0] + povms[:,:,0,1])
34+
print(ep @ ep.conj().T + em @ em.conj().T)
35+
exit()
36+
37+
pred_mat = np.zeros([dim, dim, num_alice_out, num_bob_out, num_alice_in, num_bob_in])
38+
pred_mat[:, :, 0, 0, 0, 0] = povms[:, :, 0, 0]
39+
pred_mat[:, :, 0, 0, 1, 1] = povms[:, :, 1, 0]
40+
pred_mat[:, :, 0, 0, 2, 2] = povms[:, :, 2, 0]
41+
42+
pred_mat[:, :, 1, 1, 0, 0] = povms[:, :, 0, 1]
43+
pred_mat[:, :, 1, 1, 1, 1] = povms[:, :, 1, 1]
44+
pred_mat[:, :, 1, 1, 2, 2] = povms[:, :, 2, 1]
45+
46+
prob_mat = 1 / 3 * np.identity(3)
47+
48+
game = ExtendedNonlocalGame(prob_mat, pred_mat, reps=1)
49+
unent = game.unentangled_value()
50+
print(f"{unent=}")
51+
lb = game.quantum_value_lower_bound()
52+
print(f"{lb=}")
53+
ns = game.nonsignaling_value()
54+
print(f"{ns=}")
55+
56+
exit()
57+
58+
e_0, e_1 = standard_basis(2)
59+
e_p = (e_0 + e_1) / np.sqrt(2)
60+
e_m = (e_0 - e_1) / np.sqrt(2)
61+
62+
dim = 2
63+
num_alice_out, num_bob_out = 2, 2
64+
num_alice_in, num_bob_in = 2, 2
65+
66+
pred_mat = np.zeros([dim, dim, num_alice_out, num_bob_out, num_alice_in, num_bob_in])
67+
68+
#pred_mat[:, :, 0, 1, 0, 0] = e_0 @ e_0.conj().T
69+
#pred_mat[:, :, 1, 0, 0, 0] = e_0 @ e_0.conj().T
70+
pred_mat[:, :, 1, 1, 0, 0] = e_0 @ e_0.conj().T
71+
72+
pred_mat[:, :, 0, 0, 0, 1] = e_1 @ e_1.conj().T
73+
#pred_mat[:, :, 1, 0, 0, 1] = e_1 @ e_1.conj().T
74+
pred_mat[:, :, 1, 1, 0, 1] = e_1 @ e_1.conj().T
75+
76+
pred_mat[:, :, 0, 0, 1, 0] = e_p @ e_p.conj().T
77+
#pred_mat[:, :, 0, 1, 1, 0] = e_p @ e_p.conj().T
78+
pred_mat[:, :, 1, 1, 1, 0] = e_p @ e_p.conj().T
79+
80+
pred_mat[:, :, 0, 0, 1, 1] = e_m @ e_m.conj().T
81+
#pred_mat[:, :, 0, 1, 1, 1] = e_m @ e_m.conj().T
82+
#pred_mat[:, :, 1, 0, 1, 1] = e_m @ e_m.conj().T
83+
84+
prob_mat = 1 / 2 * np.identity(2)
85+
#prob_mat = np.array([[1/4, 1/4], [1/4, 1/4]])
86+
87+
game = ExtendedNonlocalGame(prob_mat, pred_mat, reps=2)
88+
res = game.unentangled_value()
89+
#res = game.nonsignaling_value()
90+
#res = game.quantum_value_lower_bound()
91+
print(res)
92+
93+
#res = game.nonsignaling_value()
94+
#res = game.commuting_measurement_value_upper_bound()
95+
#res = game.quantum_value_lower_bound()
96+
97+
exit()
98+
dim = 2
99+
num_in = 3
100+
num_out = 2
101+
pred_mat = np.zeros([dim, dim, num_out, num_out, num_in, num_in], dtype=complex)
102+
103+
e0, e1 = standard_basis(2)
104+
105+
theta_1 = 1/4 * np.arccos((121 + 52 * np.sqrt(13))/(477))
106+
theta_2 = 1/4 * np.arccos((-431 + 4 * np.sqrt(13))/(477))
107+
alpha_0 = -theta_1
108+
alpha_1 = theta_2
109+
beta_0 = (np.pi/2) - theta_2
110+
beta_1 = theta_1
111+
def M(theta):
112+
return np.array([
113+
[np.cos(theta)**2, np.cos(theta) * np.sin(theta)],
114+
[np.sin(theta) * np.cos(theta), np.sin(theta)**2]
115+
])
116+
117+
# V(0,0|x,y):
118+
pred_mat[:, :, 0, 0, 1, 1] = M(alpha_0)
119+
pred_mat[:, :, 0, 0, 2, 2] = np.identity(dim) - M(alpha_0)
120+
121+
# V(0,1|x,y):
122+
pred_mat[:, :, 0, 1, 0, 0] = M(alpha_1)
123+
pred_mat[:, :, 0, 1, 1, 1] = np.identity(dim) - M(alpha_1)
124+
125+
# V(1,0|x,y):
126+
pred_mat[:, :, 1, 0, 0, 0] = M(beta_0)
127+
pred_mat[:, :, 1, 0, 1, 1] = np.identity(dim) - M(beta_0)
128+
129+
# V(1,1|x,y):
130+
pred_mat[:, :, 1, 1, 0, 0] = M(beta_1)
131+
pred_mat[:, :, 1, 1, 2, 2] = np.identity(dim) - M(beta_1)
132+
133+
prob_mat = 1 / 3 * np.identity(3)
134+
135+
game = ExtendedNonlocalGame(prob_mat, pred_mat)
136+
res = game.unentangled_value()
137+
#res = game.nonsignaling_value()
138+
#res = game.commuting_measurement_value_upper_bound()
139+
#res = game.quantum_value_lower_bound()
140+
print(res)

0 commit comments

Comments
 (0)