コード例 #1
0
 def test_initialize_sampling_opt(self, method, device):
     """Test sampling optimization"""
     backend = self.backend(method=method, device=device)
     shots = 1000
     circuits = ref_initialize.initialize_sampling_optimization()
     targets = ref_initialize.initialize_counts_sampling_optimization(shots)
     result = backend.run(circuits, shots=shots).result()
     self.assertSuccess(result)
     self.compare_counts(result, circuits, targets, delta=0.05 * shots)
コード例 #2
0
 def test_initialize_sampling_opt(self):
     """Test sampling optimization"""
     shots = 1000
     circuits = ref_initialize.initialize_sampling_optimization()
     targets = ref_initialize.initialize_counts_sampling_optimization(shots)
     qobj = assemble(circuits, self.SIMULATOR, shots=shots)
     opts = self.BACKEND_OPTS.copy()
     result = self.SIMULATOR.run(qobj, **opts).result()
     self.assertSuccess(result)
     self.compare_counts(result, circuits, targets, delta=0.05 * shots)
コード例 #3
0
 def test_initialize_sampling_opt(self):
     """Test sampling optimization"""
     shots = 4000
     circuits = ref_initialize.initialize_sampling_optimization()
     targets = ref_initialize.initialize_counts_sampling_optimization(shots)
     qobj = assemble(circuits, self.SIMULATOR, shots=shots)
     result = self.SIMULATOR.run(
         qobj, backend_options=self.BACKEND_OPTS).result()
     self.assertTrue(getattr(result, 'success', False))
     self.compare_counts(result, circuits, targets, delta=0.05 * shots)
コード例 #4
0
 def test_initialize_sampling_opt(self):
     """Test sampling optimization"""
     shots = 2000
     circuits = ref_initialize.initialize_sampling_optimization()
     targets = ref_initialize.initialize_counts_sampling_optimization(shots)
     qobj = assemble(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.05 * shots)