コード例 #1
0
 def testAliceConstantlyZeroAndBobConstantlyOneIsVertexOfCHSH(self):
     chshPoly = BellPolytope(BellScenario([2, 2], [2, 2]))
     verticesAsLists = [
         behaviour.getProbabilityList()
         for behaviour in chshPoly.getListOfVertices()
     ]
     self.assertIn([0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0],
                   verticesAsLists)
コード例 #2
0
 def testNumberOfLocalVerticesOfChshIs16(self):
     chshPoly = BellPolytope(BellScenario([2, 2], [2, 2]))
     self.assertEquals(len(chshPoly.getListOfVertices()), 16)
コード例 #3
0
                                               prob.matsolY(b + N * y))))
    return np.dot(np.array(functional), products)


if __name__ == '__main__':
    parties = 2
    N = 3
    K = 4
    outputsAlice = [4, 4, 4]
    outputsBob = [4, 4, 4]
    dim = 2
    BellViolations = []
    #Creo que así los vértices están bien
    scenario = BellScenario(outputsAlice, outputsBob)
    poly = BellPolytope(scenario)
    vertices = poly.getListOfVertices()
    distributions = np.matrix(vertices)
    NumberOfCoefficients = (N * K)**2
    '''with open('results.txt','w') as f:
        f.write('Random functionals \n')'''

    rho = np.matrix([[0, 0, 0, 0], [0, 1 / 2, -1 / 2, 0],
                     [0, -1 / 2, 1 / 2, 0], [0, 0, 0, 0]])
    #Ineqs = np.loadtxt( 'Ineqs.txt')
    '''for i in range (0,2): 
        functional=np.random.uniform(-N**2*(N**2-2),1,size=NumberOfCoefficients)
        values=np.dot(distributions,np.transpose(functional))
        c=np.amax(values)
        if c==0:
            functional=np.random.uniform(-N**2*(N**2-2),1,size=NumberOfCoefficients)
            values=np.dot(distributions,np.transpose(functional))