@@ -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
8668print ("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