def test_measure(self):
     """Test StatevectorSimulator measure with deterministic counts"""
     circuits = ref_measure.measure_circuits_deterministic(allow_sampling=True)
     targets = ref_measure.measure_statevector_deterministic()
     job = execute(circuits, StatevectorSimulator(), shots=1)
     result = job.result()
     self.is_completed(result)
     self.compare_statevector(result, circuits, targets)
Esempio n. 2
0
 def test_measure_deterministic_without_sampling(self):
     """Test QasmSimulator measure with deterministic counts without sampling"""
     shots = 100
     circuits = ref_measure.measure_circuits_deterministic(allow_sampling=False)
     targets = ref_measure.measure_counts_deterministic(shots)
     job = execute(circuits, QasmSimulator(), shots=shots)
     result = job.result()
     self.is_completed(result)
     self.compare_counts(result, circuits, targets, delta=0)
Esempio n. 3
0
 def test_measure_deterministic_without_sampling(self):
     """Test CHSimulator measure with deterministic counts without sampling"""
     shots = 100
     circuits = ref_measure.measure_circuits_deterministic(
         allow_sampling=False)
     qobj = qiskit_compile(circuits, QasmSimulator(), shots=shots)
     targets = ref_measure.measure_counts_deterministic(shots)
     job = QasmSimulator().run(qobj, backend_options={"method": "ch"})
     result = job.result()
     self.is_completed(result)
     self.compare_counts(result, circuits, targets, delta=0)
Esempio n. 4
0
 def test_measure_deterministic_without_sampling(self):
     """Test QasmSimulator measure with deterministic counts without sampling"""
     shots = 100
     circuits = ref_measure.measure_circuits_deterministic(
         allow_sampling=False)
     targets = ref_measure.measure_counts_deterministic(shots)
     qobj = compile(circuits, self.SIMULATOR, shots=shots)
     result = self.SIMULATOR.run(
         qobj, backend_options=self.BACKEND_OPTS).result()
     self.is_completed(result)
     self.compare_counts(result, circuits, targets, delta=0)
 def test_measure_deterministic_with_sampling(self):
     """Test ExtendedStabilizer measure with deterministic counts with sampling"""
     shots = 100
     circuits = ref_measure.measure_circuits_deterministic(
         allow_sampling=True)
     qobj = qiskit_compile(circuits, QasmSimulator(), shots=shots)
     targets = ref_measure.measure_counts_deterministic(shots)
     job = QasmSimulator().run(qobj,
                               backend_options={
                                   "method": "extended_stabilizer",
                                   "disable_measurement_opt": False
                               })
     result = job.result()
     self.is_completed(result)
     self.compare_counts(result, circuits, targets, delta=0)