def print_gate(t): print('t =', t) matrix = U00(t) gates = qd.matrix_to_gates(matrix) circuit = qd.matrix_to_cirq_circuit(matrix) print(circuit) print()
def test_matrix_to_gates_SWAP(self): gates = qd.matrix_to_gates(SWAP) assert np.allclose(SWAP, gates_to_matrix(gates))
def test_matrix_to_gates_random_orthogonal(self): np.random.seed(100) for matrix_size in [2, 4, 8]: for _ in range(10): A = np.array(ortho_group.rvs(matrix_size)) check_decomp(A, qd.matrix_to_gates(A))
def test_matrix_to_gates_identity(self): A = np.eye(16) gates = qd.matrix_to_gates(A) assert len(gates) == 0
def test_matrix_to_gates_random_unitary(self): np.random.seed(100) for matrix_size in [2, 4, 8, 16]: for _ in range(10): A = np.array(unitary_group.rvs(matrix_size)) check_decomp(A, qd.matrix_to_gates(A))