def setUp(self): self.subsys = [2, 2, 2] self.gmn = gmn([2, 2, 2]) rho = numpy.zeros((8, 8), dtype=numpy.complex128) rho[0, 0] = rho[0, -1] = rho[-1, 0] = rho[-1, -1] = 0.5 self.ghz = rho psi = numpy.zeros((8,), dtype=numpy.complex128) psi[1] = psi[2] = psi[4] = 1.0 self.w = numpy.outer(psi, psi) / 3.0 self.pauli = pauli(3) measurements = [self.pauli.operator(i) for i in ["xxz", "xzx", "zxx", "zzz"]] self.measurements = [(o, numpy.trace(numpy.dot(self.w, o).real)) for o in measurements]
# that can be achieved using NMIN/NMIN_PPT measurements. # The difference between (NMIN, BOUND) and (NMIN, BOUNT_PPT) is that in the first # fully decomposable witnesses are constructed, wheras in the second one fully # PPT witnesses are used. import gmntools, numpy from gmntools import gmn, randomstates, randomlocalmeas # number of runs n = 100 subsystems = [2, 2] # initialize necesarry classes locmeas = randomlocalmeas(subsystems) rho = randomstates(subsystems) GMN = gmn(subsystems) dim = numpy.prod(numpy.array(subsystems)) for i in range(n): GMN.setdensitymatrix(rho.random()) genneg = rho.negativity([0]) if genneg > 0: meas = [] for j in range(dim ** 2): expvalue = numpy.trace(numpy.dot(rho.matrix, locmeas.random())).real meas += [(locmeas.matrix, expvalue)] xlow = 0 xhigh = dim ** 2 while True: x = (xhigh + xlow) / 2 y = GMN.gmn_partial_info(meas[:x])