Exemplo n.º 1
0
 def test_init_from_pauli(self):
     """Test initialization from Pauli"""
     samples = 10
     rng = np.random.default_rng(999)
     for num_qubits in range(1, 5):
         for _ in range(samples):
             pauli = random.random_pauli(num_qubits, seed=rng)
             elem = CNOTDihedral(pauli)
             value = Operator(pauli)
             target = Operator(elem)
             self.assertTrue(value.equiv(target), "Error: Pauli operator is not the same.")
 def test_init_from_pauli(self):
     """Test initialization from Pauli"""
     samples = 10
     nseed = 999
     for qubit_num in range(1, 5):
         for i in range(samples):
             pauli = random.random_pauli(qubit_num, seed=nseed + i)
             elem = CNOTDihedral(pauli)
             value = Operator(pauli)
             target = Operator(elem)
             self.assertTrue(value.equiv(target),
                             'Error: Pauli operator is not the same.')