コード例 #1
0
 def test_no_trivial_commute_triple_anti_intersect(self):
     self.assertFalse(
         trivially_commutes(QubitOperator('X0 Z2 Z4 Z9 Y17'),
                            QubitOperator('Y0 X2 Y4 Z9 Z16')))
コード例 #2
0
 def test_no_trivial_commute_mostly_commuting(self):
     self.assertFalse(
         trivially_commutes(QubitOperator('X0 Y1 Z2 X4 Y5 Y6'),
                            QubitOperator('X0 Y1 Z2 X4 Z5 Y6')))
コード例 #3
0
 def test_trivially_commutes_even_anti(self):
     self.assertTrue(
         trivially_commutes(QubitOperator('X1 Z2 Z3 X10'),
                            QubitOperator('Y1 X2 Z3 Y9')))
コード例 #4
0
 def test_no_trivial_commute_odd_anti(self):
     self.assertFalse(
         trivially_commutes(QubitOperator('X1'), QubitOperator('Y1')))
コード例 #5
0
 def test_trivially_commutes_allsame_oddintersect(self):
     self.assertTrue(
         trivially_commutes(QubitOperator('X1 X3 X4 Z6 X8'),
                            QubitOperator('X1 X3 X4 Z7 Y9')))
コード例 #6
0
 def test_trivially_commutes_no_intersect(self):
     self.assertTrue(
         trivially_commutes(QubitOperator('X1 Y3 Z6'),
                            QubitOperator('Z0 Z2 X4 Y5')))
コード例 #7
0
 def test_trivially_commutes_nonid_with_id(self):
     self.assertTrue(
         trivially_commutes(QubitOperator('X1 Z5 Y9 Z11'), QubitOperator(
             ())))
コード例 #8
0
 def test_trivially_commutes_id_xx(self):
     self.assertTrue(
         trivially_commutes(QubitOperator(()), QubitOperator('X1 X3')))
コード例 #9
0
 def test_trivially_commutes_id_id(self):
     self.assertTrue(
         trivially_commutes(QubitOperator(()), 3 * QubitOperator(())))