Exemplo n.º 1
0
 def test_binary(self):
     poly = BinaryPolynomial({'abc': 1, 'bc': 1, 'ab': -1}, 'BINARY')
     h, J, off = poly.to_hising()
     new = BinaryPolynomial.from_hising(h, J, off)
     self.assertEqual(poly, new.to_binary())
Exemplo n.º 2
0
 def test_spin(self):
     poly = BinaryPolynomial({'abc': 1, 'bc': 1, 'ab': -1}, 'SPIN')
     h, J, off = poly.to_hising()
     new = BinaryPolynomial.from_hising(h, J, off)
     self.assertEqual(poly, new)
Exemplo n.º 3
0
 def test_degree0(self):
     poly = BinaryPolynomial.from_hising({}, {}, 0)
     self.assertEqual(poly.degree, 0)