Пример #1
0
 def test_csw(self):
     """test csw
     """
     qc_A = QCirc().csw(0, 1, 2)
     str_A = qc_A.to_qasm()
     qc_B = QCirc.from_qasm(str_A)
     str_B = qc_B.to_qasm()
     self.assertEqual(str_A, str_B)
Пример #2
0
 def test_many_unitary_gates(self):
     """test many unitary gates
     """
     qc_A = QCirc().h(0).cx(0, 1).crx(1, 0, phase=0.1).csw(0, 1, 2)
     str_A = qc_A.to_qasm()
     qc_B = QCirc.from_qasm(str_A)
     str_B = qc_B.to_qasm()
     self.assertEqual(str_A, str_B)
Пример #3
0
 def test_crz(self):
     """test crz
     """
     qc_A = QCirc().crz(0, 1, phase=0.1)
     str_A = qc_A.to_qasm()
     qc_B = QCirc.from_qasm(str_A)
     str_B = qc_B.to_qasm()
     self.assertEqual(str_A, str_B)
Пример #4
0
 def test_ct_dg(self):
     """test ct_dg
     """
     qc_A = QCirc().ct_dg(0, 1)
     str_A = qc_A.to_qasm()
     qc_B = QCirc.from_qasm(str_A)
     str_B = qc_B.to_qasm()
     self.assertEqual(str_A, str_B)
Пример #5
0
 def test_cxr_2(self):
     """test cxr (2)
     """
     qc_A = QCirc().h(0).cxr(0, 1)
     str_A = qc_A.to_qasm()
     qc_B = QCirc.from_qasm(str_A)
     str_B = qc_B.to_qasm()
     self.assertEqual(str_A, str_B)
Пример #6
0
 def test_ry(self):
     """test ry
     """
     qc_A = QCirc().ry(0, phase=0.1)
     str_A = qc_A.to_qasm()
     qc_B = QCirc.from_qasm(str_A)
     str_B = qc_B.to_qasm()
     self.assertEqual(str_A, str_B)
Пример #7
0
 def test_t(self):
     """test t
     """
     qc_A = QCirc().t(0)
     str_A = qc_A.to_qasm()
     qc_B = QCirc.from_qasm(str_A)
     str_B = qc_B.to_qasm()
     self.assertEqual(str_A, str_B)