示例#1
0
 def test_unitary_gate(self):
     """Test simulation with unitary gate circuit instructions."""
     circuits = ref_unitary_gate.unitary_gate_circuits_deterministic(final_measure=False)
     targets = ref_unitary_gate.unitary_gate_statevector_deterministic()
     job = execute(circuits, StatevectorSimulator(), shots=1)
     result = job.result()
     self.assertTrue(getattr(result, 'success', False))
     self.compare_statevector(result, circuits, targets)
 def test_unitary_gate(self):
     """Test simulation with unitary gate circuit instructions."""
     circuits = ref_unitary_gate.unitary_gate_circuits_deterministic(final_measure=False)
     targets = ref_unitary_gate.unitary_gate_unitary_deterministic()
     job = execute(circuits, UnitarySimulator(), shots=1)
     result = job.result()
     self.is_completed(result)
     self.compare_unitary(result, circuits, targets)
示例#3
0
 def test_unitary_gate(self):
     """Test simulation with unitary gate circuit instructions."""
     circuits = ref_unitary_gate.unitary_gate_circuits_deterministic(
         final_measure=False)
     targets = ref_unitary_gate.unitary_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)
 def test_unitary_gate(self):
     """Test simulation with unitary gate circuit instructions."""
     shots = 100
     circuits = ref_unitary_gate.unitary_gate_circuits_deterministic(
         final_measure=True)
     targets = ref_unitary_gate.unitary_gate_counts_deterministic(shots)
     result = execute(circuits, self.SIMULATOR, shots=shots).result()
     self.assertTrue(getattr(result, 'success', False))
     self.compare_counts(result, circuits, targets, delta=0)
 def test_unitary_gate_circuit_run(self, device):
     """Test simulation with unitary gate circuit instructions."""
     backend = self.backend(device=device)
     circuits = ref_unitary_gate.unitary_gate_circuits_deterministic(
         final_measure=False)
     circuits = transpile(circuits, backend, optimization_level=1)
     result = backend.run(circuits, shots=1).result()
     targets = ref_unitary_gate.unitary_gate_statevector_deterministic()
     self.assertSuccess(result)
     self.compare_statevector(result, circuits, targets)
示例#6
0
 def test_unitary_gate_circuit_run(self):
     """Test simulation with unitary gate circuit instructions."""
     circuits = ref_unitary_gate.unitary_gate_circuits_deterministic(
         final_measure=False)
     targets = ref_unitary_gate.unitary_gate_statevector_deterministic()
     t_circs = transpile(circuits, self.SIMULATOR)
     job = self.SIMULATOR.run(t_circs, shots=1, **self.BACKEND_OPTS)
     result = job.result()
     self.assertSuccess(result)
     self.compare_statevector(result, circuits, targets)
 def test_unitary_gate(self):
     """Test simulation with unitary gate circuit instructions."""
     shots = 100
     circuits = ref_unitary_gate.unitary_gate_circuits_deterministic(
         final_measure=True)
     targets = ref_unitary_gate.unitary_gate_counts_deterministic(
         shots)
     result = execute(circuits, self.SIMULATOR, shots=shots,
                      backend_options=self.BACKEND_OPTS).result()
     self.assertSuccess(result)
     self.compare_counts(result, circuits, targets, delta=0)
 def test_unitary_gate(self, method, device):
     """Test simulation with unitary gate circuit instructions."""
     backend = self.backend(method=method, device=device)
     shots = 100
     circuits = ref_unitary_gate.unitary_gate_circuits_deterministic(
         final_measure=True)
     targets = ref_unitary_gate.unitary_gate_counts_deterministic(shots)
     circuits = transpile(circuits, backend)
     result = backend.run(circuits, shots=shots).result()
     self.assertSuccess(result)
     self.compare_counts(result, circuits, targets, delta=0)