def test_conditional_unitary_132bit(self, device):
     """Test conditional unitary on 132-bit conditional register."""
     backend = self.backend(device=device)
     cases = ref_conditionals.conditional_cases_132bit()
     circuits = ref_conditionals.conditional_circuits_nbit(
         132, cases, final_measure=False, conditional_type='unitary')
     circuits = transpile(circuits, backend, optimization_level=1)
     result = backend.run(circuits, shots=1).result()
     targets = ref_conditionals.conditional_statevector_nbit(cases)
     self.assertSuccess(result)
     self.compare_statevector(result, circuits, targets)
    def test_conditional_unitary_132bit(self):
        """Test conditional unitary on 132-bit conditional register."""
        cases = ref_conditionals.conditional_cases_132bit()
        circuits = ref_conditionals.conditional_circuits_nbit(
            132, cases, final_measure=False, conditional_type='unitary')
        targets = ref_conditionals.conditional_statevector_nbit(cases)
        job = execute(circuits, self.SIMULATOR, shots=1, **self.BACKEND_OPTS)
        result = job.result()
        self.assertSuccess(result)

        self.compare_statevector(result, circuits, targets)
예제 #3
0
 def test_conditional_gates_132bit(self, method, device):
     """Test conditional gate operations on 132-bit conditional register."""
     shots = 100
     cases = ref_conditionals.conditional_cases_132bit()
     backend = self.backend(method=method, device=device)
     circuits = ref_conditionals.conditional_circuits_nbit(
         132, cases, final_measure=True, conditional_type='gate')
     targets = ref_conditionals.condtional_counts_nbit(132,
                                                       cases,
                                                       shots,
                                                       hex_counts=False)
     result = backend.run(circuits, shots=shots).result()
     self.assertSuccess(result)
     self.compare_counts(result,
                         circuits,
                         targets,
                         hex_counts=False,
                         delta=0)
예제 #4
0
 def test_conditional_gates_132bit(self):
     """Test conditional gate operations on 132-bit conditional register."""
     shots = 100
     cases = ref_conditionals.conditional_cases_132bit()
     circuits = ref_conditionals.conditional_circuits_nbit(
         132, cases, final_measure=True, conditional_type='gate')
     targets = ref_conditionals.condtional_counts_nbit(132,
                                                       cases,
                                                       shots,
                                                       hex_counts=False)
     qobj = assemble(circuits, self.SIMULATOR, shots=shots)
     result = self.SIMULATOR.run(qobj, **self.BACKEND_OPTS).result()
     self.assertSuccess(result)
     self.compare_counts(result,
                         circuits,
                         targets,
                         hex_counts=False,
                         delta=0)