Example #1
0
def test_quil_two_qubit_gate_output():
    (
        q0,
        q1,
    ) = _make_qubits(2)
    gate = QuilTwoQubitGate(np.array([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]))
    output = cirq.QuilOutput(
        (gate.on(q0, q1),),
        (
            q0,
            q1,
        ),
    )
    assert (
        str(output)
        == """# Created using Cirq.

DEFGATE USERGATE1:
    1.0+0.0i, 0.0+0.0i, 0.0+0.0i, 0.0+0.0i
    0.0+0.0i, 1.0+0.0i, 0.0+0.0i, 0.0+0.0i
    0.0+0.0i, 0.0+0.0i, 1.0+0.0i, 0.0+0.0i
    0.0+0.0i, 0.0+0.0i, 0.0+0.0i, 1.0+0.0i
USERGATE1 0 1
"""
    )
Example #2
0
def test_quil_two_qubit_gate_output():
    q0, q1, = _make_qubits(2)
    gate = QuilTwoQubitGate(
        np.array([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]))
    output = cirq.QuilOutput((gate.on(q0, q1),), (
        q0,
        q1,
    ))
    assert str(output) == """# Created using Cirq.
def test_quil_two_qubit_gate_output():
    (q0, q1) = _make_qubits(2)
    with cirq.testing.assert_deprecated(deadline='v1.0', count=7):
        gate = QuilTwoQubitGate(
            np.array([[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]))
        output = cirq.QuilOutput((gate.on(q0, q1), ), (q0, q1))
        assert (str(output) == """# Created using Cirq.

DEFGATE USERGATE1:
    1.0+0.0i, 0.0+0.0i, 0.0+0.0i, 0.0+0.0i
    0.0+0.0i, 1.0+0.0i, 0.0+0.0i, 0.0+0.0i
    0.0+0.0i, 0.0+0.0i, 1.0+0.0i, 0.0+0.0i
    0.0+0.0i, 0.0+0.0i, 0.0+0.0i, 1.0+0.0i
USERGATE1 0 1
""")