API reference
BellPolytopes.bell_frank_wolfe
— MethodCalls the lazy pairwise blended conditional gradient algorithm from Frank-Wolfe package.
Arguments:
p
: a correlation/probability tensor of orderN
.
Returns:
x
: a correlation/probability tensor of orderN
, the output of the Frank-Wolfe algorithm,ds
: a deterministic strategy, the atom returned by the last LMO,primal
:½|x-v₀*p|²
,dual_gap
:⟨x-v₀*p, x-ds⟩
,active_set
: all deterministic strategies used for the decomposition of the last iteratex
, contains fieldsweights
,atoms
, andx
,M
: a Bell inequality, meaningful only if the dual gap is small enough,β
: the local bound of the inequality parametrised byM
, reliable only if the last LMO is exact.
Optional arguments:
prob
: a boolean, indicates ifp
is a corelation or probability array,marg
: a boolean, indicates ifp
contains marginals,v0
: the visibility used to make a nonlocalp
closer to the local polytope,epsilon
: the tolerance, used as a stopping criterion (when the primal value or the dual gap go below its value), by default 1e-7,verbose
: an integer, indicates the level of verbosity from 0 to 3,shr2
: the potential underlying shrinking factor, used to display the lower bound in the callback,mode
: an integer, 0 is for the heuristic LMO, 1 for the enumeration LMO,nb
: an integer, number of random tries in the LMO, if heuristic, by default 10^2,TL
: type of the last call of the LMO,mode_last
: an integer, mode of the last call of the LMO, -1 for no last call,nb_last
: an integer, number of random tries in the last LMO, if heuristic, by default 10^5,sym
: a boolean, indicates if the symmetry of the input should be used, by default automatic choice,use_array
: a boolean, indicates to store the full deterministic strategies to trade memory for speed in multipartite scenarios,callback_interval
: an integer, print interval ifverbose
= 3,seed
: an integer, the initial random seed.
BellPolytopes.local_bound
— MethodCompute the local bound of a Bell inequality parametrised by M
. No symmetry detection is implemented yet, used mostly for pedagogy and tests.
BellPolytopes.nonlocality_threshold
— MethodCompute the nonlocality threshold of the qubit measurements encoded by the Bloch vectors vec
in a Bell scenario with N
parties.
Arguments:
vec
: anm × 3
matrix with Bloch vectors coordinates,N
: the number of parties.
Returns:
lower_bound_infinite
: a lower bound on the nonlocality threshold under all projective measurements (in the subspace spanned byvec
in the Bloch sphere),lower_bound
: a lower bound on the nonlocality threshold under the measurements provided in input,upper_bound
: a (heuristic) upper bound on the nonlocality threshold under the measurements provided in input, also valid for all projective measurements,local_model
: a decomposition of the correlation tensor obtained by applying the measurements encoded by the Bloch vectorsvec
on allN
subsystems of the shared staterho
with visibilitylower_bound
,bell_inequality
: a (heuristic) Bell inequality corresponding toupper_bound
.
Optional arguments:
rho
: the shared state, by default the singlet state in the bipartite case and the GHZ state otherwise,v0
: the initial visibility, which should be an upper bound on the nonlocality threshold, 1.0 by default,precision
: number of digits oflower_bound
, 4 by default,- for the other optional arguments, see
bell_frank_wolfe
.
BellPolytopes.pythagorean_approximation
— MethodCompute a rational approximation of a m × 3
Bloch matrix.
BellPolytopes.shrinking_squared
— MethodCompute the shrinking factor of a m × 3
Bloch matrix, symmetrising it to account for antipodal vectors.