예제 #1
0
 def test_identity(self):
     identity = cirq.I
     c1u1 = Controlled1BitMatrixGate(sub_gate=identity)
     test_gate_decomposition(c1u1,
                             self,
                             expected_unitary=np.array([[1.0]]),
                             print_circuit=False)
예제 #2
0
 def test_random_matrix_gate(self):
     sub_gate = RandomMatrixGate(num_qubits=1)
     c1u1 = Controlled1BitMatrixGate(sub_gate=sub_gate)
     test_gate_decomposition(c1u1, self, print_circuit=False)
예제 #3
0
 def test_pauli_z(self):
     pauli_z = cirq.Z
     c1u1 = Controlled1BitMatrixGate(sub_gate=pauli_z)
     test_gate_decomposition(c1u1, self, print_circuit=False)
예제 #4
0
 def test_c_rz(self):
     for i in range(self.NUM_TESTS):
         rads = np.random.rand() * 2 * np.pi  # [0, 2π)
         c_rz = CRz(rads)
         test_gate_decomposition(c_rz, self, print_circuit=False)