-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Labels
area/circuitsarea/visualizationkind/bug-reportSomething doesn't seem to work.Something doesn't seem to work.triage/acceptedA consensus emerged that this bug report, feature request, or other action should be worked onA consensus emerged that this bug report, feature request, or other action should be worked on
Description
Description of the issue
When using line qubits and crossing gates in a single moment; the output on printing the moment is confusing and does not show the overlap correctly, unlike the output obtained on printing the whole circuit.
How to reproduce the issue
a, b, c, d = cirq.LineQubit.range(4)
c1 = cirq.Circuit([cirq.CNOT(a, d), cirq.CNOT(b, c)])
c2 = cirq.Circuit([cirq.CNOT(a, c), cirq.CNOT(b, d)])
In [22]: print(c1, '\n', c2)
┌──┐
0: ────@─────
│
1: ────┼@────
││
2: ────┼X────
│
3: ────X─────
└──┘
┌──┐
0: ────@─────
│
1: ────┼@────
││
2: ────X┼────
│
3: ─────X────
└──┘
In [23]: print(c1[0], '\n', c2[0]) # <-- Confusing: The output should be different similar to circuit diagram above.
╷ 0 1 2 3
╶─┼─────────
0 │ @─@─X─X
│
╷ 0 1 2 3
╶─┼─────────
0 │ @─@─X─X
│
Another Example:
In [18]: print(cirq.Circuit(cirq.ControlledGate(cirq.X, num_controls = 3).on(a, b, c, d))[0])
...: print(cirq.Circuit([cirq.CNOT(a, d), cirq.CZ(b, c)])[0])
╷ 0 1 2 3
╶─┼─────────
0 │ @─@─@─X
│
╷ 0 1 2 3
╶─┼─────────
0 │ @─@─@─X
│
Cirq version
0.11.0.dev
Metadata
Metadata
Assignees
Labels
area/circuitsarea/visualizationkind/bug-reportSomething doesn't seem to work.Something doesn't seem to work.triage/acceptedA consensus emerged that this bug report, feature request, or other action should be worked onA consensus emerged that this bug report, feature request, or other action should be worked on