Beispiel #1
0
 def test_cswap_gate_nondeterministic_default_basis_gates(self):
     """Test cswap-gate circuits compiling to backend default basis_gates."""
     circuits = ref_non_clifford.cswap_gate_circuits_nondeterministic(final_measure=False)
     targets = ref_non_clifford.cswap_gate_statevector_nondeterministic()
     job = execute(circuits, StatevectorSimulator(), shots=1)
     result = job.result()
     self.assertTrue(getattr(result, 'success', False))
     self.compare_statevector(result, circuits, targets)
Beispiel #2
0
 def test_cswap_gate_nondeterministic_waltz_basis_gates(self):
     """Test cswap-gate gate circuits compiling to u1,u2,u3,cx"""
     circuits = ref_non_clifford.cswap_gate_circuits_nondeterministic(final_measure=False)
     targets = ref_non_clifford.cswap_gate_statevector_nondeterministic()
     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)
 def test_cswap_gate_nondeterministic_default_basis_gates(self):
     shots = 2000
     circuits = ref_non_clifford.cswap_gate_circuits_nondeterministic(
         final_measure=True)
     targets = ref_non_clifford.cswap_gate_counts_nondeterministic(shots)
     job = execute(circuits, self.SIMULATOR, shots=shots)
     result = job.result()
     self.is_completed(result)
     self.compare_counts(result, circuits, targets, delta=0.05 * shots)
Beispiel #4
0
 def test_cswap_gate_nondeterministic_default_basis_gates(self):
     """Test cswap-gate circuits compiling to backend default basis_gates."""
     circuits = ref_non_clifford.cswap_gate_circuits_nondeterministic(
         final_measure=False)
     targets = ref_non_clifford.cswap_gate_unitary_nondeterministic()
     job = execute(circuits, UnitarySimulator(), shots=1)
     result = job.result()
     self.is_completed(result)
     self.compare_unitary(result, circuits, targets)
Beispiel #5
0
 def test_cswap_gate_nondeterministic_default_basis_gates(self):
     shots = 4000
     circuits = ref_non_clifford.cswap_gate_circuits_nondeterministic(
         final_measure=True)
     targets = ref_non_clifford.cswap_gate_counts_nondeterministic(shots)
     job = execute(circuits, self.SIMULATOR, shots=shots)
     result = job.result()
     self.assertTrue(getattr(result, 'success', False))
     self.compare_counts(result, circuits, targets, delta=0.05 * shots)
Beispiel #6
0
 def test_cswap_gate_nondeterministic_default_basis_gates(self):
     """Test cswap-gate circuits compiling to backend default basis_gates."""
     circuits = ref_non_clifford.cswap_gate_circuits_nondeterministic(
         final_measure=False)
     targets = ref_non_clifford.cswap_gate_unitary_nondeterministic()
     job = execute(circuits, self.SIMULATOR, shots=1, **self.BACKEND_OPTS)
     result = job.result()
     self.assertSuccess(result)
     self.compare_unitary(result, circuits, targets)
Beispiel #7
0
 def test_cswap_gate_nondeterministic_waltz_basis_gates(self):
     """Test cswap-gate gate circuits compiling to u1,u2,u3,cx"""
     circuits = ref_non_clifford.cswap_gate_circuits_nondeterministic(
         final_measure=False)
     targets = ref_non_clifford.cswap_gate_unitary_nondeterministic()
     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)
Beispiel #8
0
 def test_cswap_gate_nondeterministic_minimal_basis_gates(self):
     """Test cswap-gate gate circuits compiling to u3,cx"""
     circuits = ref_non_clifford.cswap_gate_circuits_nondeterministic(
         final_measure=False)
     targets = ref_non_clifford.cswap_gate_statevector_nondeterministic()
     job = execute(circuits,
                   StatevectorSimulator(),
                   shots=1,
                   basis_gates=['u3', 'cx'])
     result = job.result()
     self.is_completed(result)
     self.compare_statevector(result, circuits, targets)
 def test_cswap_gate_nondeterministic_default_basis_gates(self):
     shots = 4000
     circuits = ref_non_clifford.cswap_gate_circuits_nondeterministic(
         final_measure=True)
     targets = ref_non_clifford.cswap_gate_counts_nondeterministic(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.05 * shots)
 def test_cswap_gate_nondeterministic_minimal_basis_gates(self):
     """Test cswap-gate gate circuits compiling to u3,cx"""
     shots = 2000
     circuits = ref_non_clifford.cswap_gate_circuits_nondeterministic(
         final_measure=True)
     targets = ref_non_clifford.cswap_gate_counts_nondeterministic(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.1 * shots)
Beispiel #11
0
 def test_cswap_gate_nondeterministic_waltz_basis_gates(self):
     """Test cswap-gate gate circuits compiling to u1,u2,u3,cx"""
     shots = 4000
     circuits = ref_non_clifford.cswap_gate_circuits_nondeterministic(
         final_measure=True)
     targets = ref_non_clifford.cswap_gate_counts_nondeterministic(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.05 * shots)
Beispiel #12
0
 def test_cswap_gate_nondeterministic_waltz_basis_gates(self):
     """Test cswap-gate gate circuits compiling to u1,u2,u3,cx"""
     circuits = ref_non_clifford.cswap_gate_circuits_nondeterministic(
         final_measure=False)
     targets = ref_non_clifford.cswap_gate_unitary_nondeterministic()
     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)
 def test_cswap_gate_nondeterministic_minimal_basis_gates(self):
     """Test cswap-gate gate circuits compiling to u3,cx"""
     shots = 4000
     circuits = ref_non_clifford.cswap_gate_circuits_nondeterministic(
         final_measure=True)
     targets = ref_non_clifford.cswap_gate_counts_nondeterministic(shots)
     job = execute(circuits,
                   self.SIMULATOR,
                   shots=shots,
                   basis_gates=['u3', 'cx'],
                   backend_options=self.BACKEND_OPTS)
     result = job.result()
     self.assertSuccess(result)
     self.compare_counts(result, circuits, targets, delta=0.1 * shots)