You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We should make column widths vary with the gate label, so that the gates are displayed properly on the qubit wire.
See the below samples in Python.
importqsharpprint("gates that fit the column width")
print("circuit looks okay")
qsharp.eval("""use q0 = Qubit();use q1 = Qubit();H(q0);H(q1);X(q1); CNOT(q0, q1);M(q0)""")
print(qsharp.dump_circuit())
print("q_2 has gates that are too wide for the column width")
print("circuit wires disappear, and the vertical columns don't align anymore")
qsharp.eval("""use q2 = Qubit();Rx(1.0, q2);Rx(1.0, q2);""")
print(qsharp.dump_circuit())
print("q_3 has gates with both short and long gate labels")
print("here, the column widths should be variable so that the H doesn't take up too much width, but rx(1.000) still fits within a column")
qsharp.eval("""use q3 = Qubit();H(q3);Rx(1.0, q3);H(q3);Rx(1.0, q3);H(q3);Rx(1.0, q3);""")
print(qsharp.dump_circuit())
Output:
gates that fit the column width
circuit looks okay
q_0 ── H ─────────── ● ──── M ──
│ ╘═══
q_1 ── H ──── X ──── X ─────────
q_2 has gates that are too wide for the column width
circuit wires disappear, and the vertical columns don't align anymore
q_0 ── H ─────────── ● ──── M ──
│ ╘═══
q_1 ── H ──── X ──── X ─────────
q_2 rx(1.0000) rx(1.0000) ──────────────
q_3 has gates with both short and long gate labels
here, the column widths should be variable so that the H doesn't take up too much width, but rx(1.000) still fits within a column
q_0 ── H ─────────── ● ──── M ────────────────
│ ╘═════════════════
q_1 ── H ──── X ──── X ───────────────────────
q_2 rx(1.0000) rx(1.0000) ────────────────────────────
q_3 ── H ── rx(1.0000) ── H ── rx(1.0000) ── H ── rx(1.0000)
The text was updated successfully, but these errors were encountered:
@minestarks@tcNickolas , I would like to work on this issue. Can please tell me how critical is the issue of long gate names affecting the readability of ASCII art circuits in the Q# framework?
When rendering circuits (see https://github.com/microsoft/qsharp/blob/main/samples/notebooks/circuits.ipynb) , if the gate label is longer than our fixed column width (e.g.
rx(3.1416)
) then the resulting ASCII art circuit looks terrible.We should make column widths vary with the gate label, so that the gates are displayed properly on the qubit wire.
See the below samples in Python.
Output:
The text was updated successfully, but these errors were encountered: