Exporting structured data
Again, we work with the CHSH relaxation.
scala> import net.alasc.symdpoly._
import net.alasc.symdpoly._
scala> import net.alasc.symdpoly.examples.quantum.CHSH
import net.alasc.symdpoly.examples.quantum.CHSH
scala> import CHSH._
import CHSH._
scala> val L = Quantum.eigenvalueEvaluator(real = true)
L: net.alasc.symdpoly.evaluation.Evaluator.Aux[net.alasc.symdpoly.quotient.MonoDef.<refinement>.type] = ScratchEigenvalueEvaluator(true,Grp())
scala> val generatingSet = Quantum.quotient(GSet.onePlus(Free.A, Free.B))
generatingSet: net.alasc.symdpoly.GSet[net.alasc.symdpoly.quotient.MonoDef.<refinement>.type] = Quotient([1,A,B])
scala> val relaxation = L(Quantum.quotient(CHSH.chsh)).maximize.relaxation(generatingSet)
relaxation: net.alasc.symdpoly.Relaxation[net.alasc.symdpoly.evaluation.Evaluator.<refinement>.type,L.Mono] = Moment relaxation with 10 monomials, a moment matrix of size 5 x 5, and 0 localizing matrix/ces
Exploring the monomial matrix structure
To explore the moment matrix, inspect:
scala> relaxation.momentMatrix.mat
res0: scalin.immutable.Mat[L.SingleMomentType] =
L([1]) L([A(0)]) L([A(1)]) L([B(0)]) L([B(1)])
L([A(0)]) L([1]) L([A(0) A(1)]) L([A(0) B(0)]) L([A(0) B(1)])
L([A(1)]) L([A(0) A(1)]) L([1]) L([A(1) B(0)]) L([A(1) B(1)])
L([B(0)]) L([A(0) B(0)]) L([A(1) B(0)]) L([1]) L([B(0) B(1)])
L([B(1)]) L([A(0) B(1)]) L([A(1) B(1)]) L([B(0) B(1)]) L([1])
Note that the monomials are included into brackets, as they represent equivalence classes of monomials in the quotient algebra.
This description works only for smaller moment matrices.
The method allMoments
returns a list of the monomials present.
scala> relaxation.allMoments
res1: net.alasc.symdpoly.util.OrderedSet[L.SingleMomentType] = OrderedSet(L([1]), L([A(0)]), L([A(1)]), L([B(0)]), L([B(1)]), L([A(0) A(1)]), L([A(0) B(0)]), L([A(0) B(1)]), L([A(1) B(0)]), L([A(1) B(1)]), L([B(0) B(1)]))