예제 #1
0
 def test_cswap_gate_deterministic_default_basis_gates(self):
     """Test cswap-gate circuits compiling to backend default basis_gates."""
     circuits = ref_non_clifford.cswap_gate_circuits_deterministic(final_measure=False)
     targets = ref_non_clifford.cswap_gate_statevector_deterministic()
     job = execute(circuits, StatevectorSimulator(), shots=1)
     result = job.result()
     self.assertTrue(getattr(result, 'success', False))
     self.compare_statevector(result, circuits, targets)
예제 #2
0
 def test_cswap_gate_deterministic_waltz_basis_gates(self):
     """Test cswap-gate gate circuits compiling to u1,u2,u3,cx"""
     circuits = ref_non_clifford.cswap_gate_circuits_deterministic(final_measure=False)
     targets = ref_non_clifford.cswap_gate_statevector_deterministic()
     job = execute(circuits, StatevectorSimulator(), shots=1,
                   basis_gates=['u1', 'u2', 'u3', 'cx'])
     result = job.result()
     self.assertTrue(getattr(result, 'success', False))
     self.compare_statevector(result, circuits, targets)
예제 #3
0
 def test_cswap_gate_deterministic_default_basis_gates(self):
     shots = 100
     circuits = ref_non_clifford.cswap_gate_circuits_deterministic(
         final_measure=True)
     targets = ref_non_clifford.cswap_gate_counts_deterministic(shots)
     job = execute(circuits, self.SIMULATOR, shots=shots)
     result = job.result()
     self.is_completed(result)
     self.compare_counts(result, circuits, targets, delta=0)
예제 #4
0
 def test_cswap_gate_deterministic_default_basis_gates(self):
     """Test cswap-gate circuits compiling to backend default basis_gates."""
     circuits = ref_non_clifford.cswap_gate_circuits_deterministic(
         final_measure=False)
     targets = ref_non_clifford.cswap_gate_unitary_deterministic()
     job = execute(circuits, UnitarySimulator(), shots=1)
     result = job.result()
     self.is_completed(result)
     self.compare_unitary(result, circuits, targets)
예제 #5
0
 def test_cswap_gate_deterministic_default_basis_gates(self):
     """Test cswap-gate circuits compiling to backend default basis_gates."""
     circuits = ref_non_clifford.cswap_gate_circuits_deterministic(
         final_measure=False)
     targets = ref_non_clifford.cswap_gate_unitary_deterministic()
     job = execute(circuits, self.SIMULATOR, shots=1, **self.BACKEND_OPTS)
     result = job.result()
     self.assertSuccess(result)
     self.compare_unitary(
         result, circuits, targets
     )  # ---------------------------------------------------------------------
예제 #6
0
 def test_cswap_gate_deterministic_waltz_basis_gates(self):
     """Test cswap-gate gate circuits compiling to u1,u2,u3,cx"""
     circuits = ref_non_clifford.cswap_gate_circuits_deterministic(
         final_measure=False)
     targets = ref_non_clifford.cswap_gate_unitary_deterministic()
     job = execute(circuits,
                   UnitarySimulator(),
                   shots=1,
                   basis_gates=['u1', 'u2', 'u3', 'cx'])
     result = job.result()
     self.is_completed(result)
     self.compare_unitary(result, circuits, targets)
예제 #7
0
 def test_cswap_gate_deterministic_minimal_basis_gates(self):
     """Test cswap-gate gate circuits compiling to u3,cx"""
     circuits = ref_non_clifford.cswap_gate_circuits_deterministic(
         final_measure=True)
     targets = ref_non_clifford.cswap_gate_statevector_deterministic()
     job = execute(circuits,
                   StatevectorSimulator(),
                   shots=1,
                   basis_gates=['u3', 'cx'])
     result = job.result()
     self.is_completed(result)
     self.compare_statevector(result, circuits, targets)
예제 #8
0
 def test_cswap_gate_deterministic_default_basis_gates(self):
     shots = 100
     circuits = ref_non_clifford.cswap_gate_circuits_deterministic(
         final_measure=True)
     targets = ref_non_clifford.cswap_gate_counts_deterministic(shots)
     job = execute(circuits,
                   self.SIMULATOR,
                   shots=shots,
                   backend_options=self.BACKEND_OPTS)
     result = job.result()
     self.assertSuccess(result)
     self.compare_counts(result, circuits, targets, delta=0)
예제 #9
0
 def test_cswap_gate_deterministic_minimal_basis_gates(self):
     """Test cswap-gate gate circuits compiling to u3,cx"""
     shots = 100
     circuits = ref_non_clifford.cswap_gate_circuits_deterministic(
         final_measure=True)
     targets = ref_non_clifford.cswap_gate_counts_deterministic(shots)
     job = execute(circuits,
                   self.SIMULATOR,
                   shots=shots,
                   basis_gates=['u3', 'cx'])
     result = job.result()
     self.is_completed(result)
     self.compare_counts(result, circuits, targets, delta=0)
예제 #10
0
 def test_cswap_gate_deterministic_waltz_basis_gates(self):
     """Test cswap-gate gate circuits compiling to u1,u2,u3,cx"""
     shots = 100
     circuits = ref_non_clifford.cswap_gate_circuits_deterministic(
         final_measure=True)
     targets = ref_non_clifford.cswap_gate_counts_deterministic(shots)
     job = execute(circuits,
                   self.SIMULATOR,
                   shots=shots,
                   basis_gates=['u1', 'u2', 'u3', 'cx'])
     result = job.result()
     self.assertTrue(getattr(result, 'success', False))
     self.compare_counts(result, circuits, targets, delta=0)
예제 #11
0
 def test_cswap_gate_deterministic_waltz_basis_gates(self):
     """Test cswap-gate gate circuits compiling to u1,u2,u3,cx"""
     circuits = ref_non_clifford.cswap_gate_circuits_deterministic(
         final_measure=False)
     targets = ref_non_clifford.cswap_gate_unitary_deterministic()
     job = execute(circuits,
                   self.SIMULATOR,
                   shots=1,
                   basis_gates=['u1', 'u2', 'u3', 'cx'],
                   **self.BACKEND_OPTS)
     result = job.result()
     self.assertSuccess(result)
     self.compare_unitary(result, circuits, targets)