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.assertTrue(getattr(result, 'success', False)) self.compare_unitary(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, self.SIMULATOR, shots=1, **self.BACKEND_OPTS) result = job.result() self.assertSuccess(result) self.compare_unitary(result, circuits, targets)
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_unitary_deterministic() self.assertSuccess(result) self.compare_unitary(result, circuits, targets)