Ejemplo n.º 1
0
def test_generate_training_circuits():
    circuit = random_x_z_cnot_circuit(cirq.LineQubit.range(3),
                                      n_moments=5,
                                      random_state=1)
    assert not is_clifford(circuit)

    (clifford_circuit, ) = generate_training_circuits(
        circuit, num_training_circuits=1, fraction_non_clifford=0.0)
    assert is_clifford(clifford_circuit)
Ejemplo n.º 2
0
def test_generate_training_circuits_any_qprogram(circuit_type):
    circuit = random_x_z_cnot_circuit(cirq.LineQubit.range(3),
                                      n_moments=5,
                                      random_state=1)
    circuit = convert_from_mitiq(circuit, circuit_type)

    (clifford_circuit, ) = generate_training_circuits(
        circuit, num_training_circuits=1, fraction_non_clifford=0.0)
    assert is_clifford(clifford_circuit)
Ejemplo n.º 3
0
def test_is_clifford_with_nonclifford(circuit_type):
    circuit = convert_from_mitiq(cirq.Circuit(cirq.T.on(cirq.LineQubit(0))),
                                 circuit_type)
    assert not is_clifford(circuit)