예제 #1
0
 def test_s17_frame(self):
     frame = s17_heisenberg_frame()
     self.assertFalse(frame.paulis)
     self.assertEqual(len(frame.frames[0].paulis), 3)
     self.assertEqual(len(frame.frames[1].paulis), 3)
     self.assertEqual(len(frame.cliffords), 6)
     self.assertFalse(frame.parities)
예제 #2
0
 def test_s17_frame_parities_linked(self):
     frame = s17_heisenberg_frame()
     frame.reset(active_frame=0, parities={'Z': 0})
     self.assertEqual(frame.parities['Z'], 0)
     self.assertEqual(frame.frames[0].parities['Z'], 0)
     self.assertEqual(frame.frames[1].parities['Z'], 0)
     frame.parities['Z'] = 1
     self.assertEqual(frame.frames[0].parities['Z'], 1)
     self.assertEqual(frame.frames[1].parities['Z'], 1)
예제 #3
0
 def test_s17_moreops(self):
     frame = s17_heisenberg_frame()
     frame.reset(active_frame=0, parities={'Z': 0})
     frame.apply_clifford('H')
     print(frame.parities)
     print(frame.active_frame)
     print(frame.frames[1].parities)
     frame.update(['X1', 'B'])
     print(frame.frames[1].parities)
     frame.apply_clifford('H')
     self.assertEqual(frame.parities['Z'], 1)
예제 #4
0
 def test_s17_labelled(self):
     frame = s17_heisenberg_frame()
     frame.reset(active_frame=0, parities={'Z': 0})
     frame.update_from_index(1, -1)
     frame.apply_clifford('H')
     print(frame.parities)
     print(frame.active_frame)
     print(frame.frames[1].parities)
     frame.update_from_index(1, -1)
     print(frame.frames[1].parities)
     frame.apply_clifford('H')
     self.assertEqual(frame.parities['Z'], 0)
예제 #5
0
 def test_s17_frame_simple_parities(self):
     frame = s17_heisenberg_frame()
     frame.reset(active_frame=0, parities={'Z': 0})
     frame.apply_clifford('Sx')
     for key, val in frame.frames[0].paulis['Y'].precompiled_parities.items(
     ):
         print(key, val)
     print('active frame is:', frame.active_frame)
     print(frame.parities)
     frame.update(['Z0', 'B'])
     self.assertEqual(len(frame.parities), 1)
     self.assertEqual(frame.parities['Y'], 1)
     frame.apply_clifford('X')
     self.assertEqual(len(frame.parities), 1)
     self.assertEqual(frame.parities['Y'], 0)
     frame.update(['Z0', 'Z1'])
     self.assertEqual(len(frame.parities), 1)
     self.assertEqual(frame.parities['Y'], 0)
예제 #6
0
 def test_s17_superframe(self):
     frame = s17_heisenberg_frame()
     frame.reset(active_frame=0, parities={'Z': 0})
     frame.apply_clifford('H')
     self.assertEqual(frame.active_frame, 1)
     self.assertEqual(frame.parities['X'], 0)