Skip to content

Commit ca24ab6

Browse files
committed
Set up attempt to prove noiseless-EJM is postquantum. Running out of memory on my laptop.
1 parent 34d0fcf commit ca24ab6

File tree

3 files changed

+60
-76
lines changed

3 files changed

+60
-76
lines changed

EJM_distribution.py

Lines changed: 0 additions & 34 deletions
This file was deleted.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import numpy as np
2+
P_I=np.ones((4,4,4,1,1,1), dtype=float)/64
3+
P_NS=np.zeros((4,4,4,1,1,1))
4+
5+
6+
for a in range(4):
7+
P_NS[a, a, a] = 1 / 8
8+
for b in range(4):
9+
for c in range(4):
10+
if a!=b and b!=c and c!=a:
11+
P_NS[a,b,c]=1/48
12+
# v=1
13+
# p_v = np.zeros((4, 4, 4, 1, 1, 1))
14+
# p_v=v*P_NS+(1-v)*P_I
15+
16+
print("P_NS(A=i,B=i)=",P_NS[0, 0, :].sum())
17+
print("P_NS(A=i,B=j)=",P_NS[0, 1, :].sum())
18+
# for i in range(3):
19+
# print('P_NS(a='+str(i)+')=', sum([P_NS[i,b,c] for b in range(4)for c in range(4)]))
20+
# print('P_NS(b='+str(i)+')=', sum([P_NS[a,i,c] for a in range(4)for c in range(4)]))
21+
# print('P_NS(c='+str(i)+')=', sum([P_NS[a,b,i] for a in range(4)for b in range(4)]))
22+
#
23+
# print('P_I(a='+str(i)+')=', sum([P_I[i,b,c] for b in range(4)for c in range(4)]))
24+
#
25+
# for i in range(3):
26+
# for j in range(3):
27+
# print('P_NS(a='+str(i)+',b='+str(j)+')=', sum([P_NS[i,j,c] for c in range(4)]))
28+
# print('P_NS(b='+str(i)+',c='+str(j)+')=', sum([P_NS[a,i,j] for a in range(4)]))
29+
# print('P_NS(a='+str(i)+',c='+str(j)+')=', sum([P_NS[i,b,j] for b in range(4)]))
30+
#
31+
#
32+
# print('P_I(a='+str(i)+',b='+str(j)+')=', sum([P_I[i,j,c] for c in range(4)]))
33+
# for i in range(3):
34+
# for j in range(3):
35+
# for k in range(3):
36+
# print('P_NS(a='+str(i)+',b='+str(j)+',c='+str(k)+')=',P_NS[i,j,k] )
37+
print("P_NS(A=i,B=j)=", (1-4*P_NS[0, 0, :].sum())/12)

inflation/applications/pedro_manual_ring.py

Lines changed: 23 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -29,76 +29,57 @@ def ring_problem(n: int) -> InflationProblem:
2929
inf_prob = InflationProblem(
3030
dag={"i1": ["A"],
3131
"i2": ["A"], },
32-
outcomes_per_party=(2,),
32+
outcomes_per_party=(4,),
3333
settings_per_party=(1,),
3434
classical_sources=None,
3535
inflation_level_per_source=(n,n),
3636
order=["A"])
3737

3838
to_stabilize = np.flatnonzero(inf_prob._lexorder[:, 1] == inf_prob._lexorder[:, 2])
3939

40-
#Artificially kill all self-loops
41-
# inf_prob._default_notcomm[:, to_stabilize] = True
42-
# inf_prob._default_notcomm[to_stabilize] = True
43-
# inf_prob._default_notcomm[np.ix_(to_stabilize, to_stabilize)] = False
4440

4541
#Fix factorization
4642
inf_prob._inflation_indices_overlap = overlap_matrix(inf_prob._all_unique_inflation_indices)
4743

4844
# Fix symmetries
49-
# print("Never use: ", to_stabilize)
5045
new_symmetries = np.array([
5146
perm for perm in inf_prob.symmetries
5247
if np.array_equal(np.sort(perm[to_stabilize]), to_stabilize)
5348
], dtype=int)
5449
inf_prob.symmetries = new_symmetries
5550

56-
57-
5851
#Hacks to prevent knowability assumptions
5952
# inf_prob.is_network = False
6053
# inf_prob._is_knowable_q_non_networks = (lambda x: False)
6154

6255
inf_prob._interpretation_to_name = name_interpret_always_copy_indices
6356

6457
return inf_prob
65-
# def ring_LP(n: int, **kwargs) -> InflationLP:
66-
# inf_lp = InflationLP(ring_problem(n), **kwargs)
67-
# inf_lp.all_commuting_q_1d = (lambda x: False)
68-
# inf_lp.all_commuting_q_2d = (lambda x: False)
69-
# inf_lp.all_operators_commute = False
70-
# return inf_lp
7158

72-
prob_4 = ring_problem(4)
73-
# print(prob_4._compatible_template_measurements.astype(int))
74-
# cliques = prob_4.all_and_maximal_compatible_templates()[-1]
75-
# for clique in cliques[:4]:
76-
# print(prob_4._compatible_template_measurements.astype(int)[np.ix_(clique,clique)])
77-
# print(prob_4._lexorder[prob_4._template_idxs[clique]])
7859

79-
ring_4_LP = InflationLP(prob_4, verbose=2)
80-
print("Nonfanout inflation atomic factors:")
81-
print(ring_4_LP.atomic_factors)
60+
prob = ring_problem(3)
61+
prob.add_symmetries(prob._setting_specific_outcome_relabelling_symmetries)
62+
ring_SDP = InflationSDP(prob, verbose=2, include_all_outcomes=False)
8263

83-
ring_4_SDP = InflationSDP(prob_4, verbose=2)
84-
ring_4_SDP.generate_relaxation("npa2")
64+
65+
ring_SDP.generate_relaxation("npa2")
66+
# ring_SDP.generate_relaxation("npa1")
8567

8668
print("Quantum inflation **nonfanout/commuting** factors:")
87-
print(ring_4_SDP.physical_atoms)
88-
print("Quantum inflation **noncommuting** factors:")
89-
print(sorted(set(ring_4_SDP.atomic_factors).difference(ring_4_SDP.physical_atoms)))
90-
# # print(ring_4_SDP.momentmatrix)
91-
# #
92-
# known_values = {}
93-
# E1 = 0
94-
# # E1 ≥0.1656
95-
# E2 = -1 / np.sqrt(2)
96-
# # Inputting values
97-
# known_values["P[A^{1,2}=0]"] = 1 / 2 * (1 + E1)
98-
#
99-
# known_values["P[A^{1,2}=0 A^{2,3}=0]"] = 1 / 4 * (1 + 2*E1 + E2)
100-
# print(known_values)
101-
#
102-
# ring_4_SDP.update_values(known_values)
103-
# ring_4_SDP.solve(solve_dual=False)
69+
print(ring_SDP.physical_atoms)
70+
# print("Quantum inflation **noncommuting** factors:")
71+
# print(sorted(set(ring_4_SDP.atomic_factors).difference(ring_4_SDP.physical_atoms)))
72+
# # # print(ring_4_SDP.momentmatrix)
73+
# # #
74+
75+
# Inputting values
76+
known_values = {}
77+
known_values["P[A^{1,2}=0]"] = 1 / 4
78+
known_values["P[A^{1,2}=0 A^{2,3}=0]"] = 1 / 8
79+
known_values["P[A^{1,2}=0 A^{2,3}=1]"] = 1 / 24
80+
print("Known Values:")
81+
print(known_values)
82+
83+
ring_SDP.update_values(known_values)
84+
ring_SDP.solve(solve_dual=False)
10485
#

0 commit comments

Comments
 (0)