Ejemplo n.º 1
0
 def test_diagonal_gate(self):
     """Test simulation with diagonal gate circuit instructions."""
     circuits = ref_diagonal_gate.diagonal_gate_circuits_deterministic(
         final_measure=False)
     targets = ref_diagonal_gate.diagonal_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)
Ejemplo n.º 2
0
 def test_diagonal_gate(self):
     """Test simulation with unitary gate circuit instructions."""
     shots = 100
     circuits = ref_diagonal_gate.diagonal_gate_circuits_deterministic(
         final_measure=True)
     targets = ref_diagonal_gate.diagonal_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_diagonal_gate(self, device):
     """Test simulation with diagonal gate circuit instructions."""
     backend = self.backend(device=device)
     circuits = ref_diagonal_gate.diagonal_gate_circuits_deterministic(
         final_measure=False)
     circuits = transpile(circuits, backend, optimization_level=1)
     result = backend.run(circuits, shots=1).result()
     targets = ref_diagonal_gate.diagonal_gate_statevector_deterministic()
     self.assertSuccess(result)
     self.compare_statevector(result, circuits, targets)
Ejemplo n.º 4
0
 def test_diagonal_gate(self):
     """Test simulation with unitary gate circuit instructions."""
     shots = 100
     circuits = ref_diagonal_gate.diagonal_gate_circuits_deterministic(
         final_measure=True)
     targets = ref_diagonal_gate.diagonal_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_diagonal_gate(self, method, device):
     """Test simulation with unitary gate circuit instructions."""
     backend = self.backend(method=method, device=device)
     shots = 100
     circuits = ref_diagonal_gate.diagonal_gate_circuits_deterministic(
         final_measure=True)
     targets = ref_diagonal_gate.diagonal_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)