Strilanc / Quirk

A drag-and-drop quantum circuit simulator that runs in your browser. A toy for exploring and understanding small quantum circuits.
http://algassert.com/quirk
Apache License 2.0
933 stars 158 forks source link

Feature request: qubit labeling #494

Closed hschang689 closed 2 years ago

hschang689 commented 2 years ago

It would really be useful to have qubit labels (q0, q1, q2, etc.) at the start of the circuit. Alternatively, this could also be done in a subscript form: $|1\rangle{0}$ or $|+\rangle{1}$. This could really be useful for keeping track of the qubits when executing two qubit gates that physically "span" across the size of one's display. For example, my current display shows 8 qubit, it is thus hard to keep track of two qubit gates between q0 and q8, q9, or q10.

Strilanc commented 2 years ago

This isn't really documented anywhere, but you can create lables by making a custom matrix gate with the matrix "1". The name of the gate will then be shown on the line with no box around it, which looks like a label.

Example: https://algassert.com/quirk#circuit=%7B%22cols%22%3A%5B%5B%22~aith%22%5D%5D%2C%22gates%22%3A%5B%7B%22id%22%3A%22~aith%22%2C%22name%22%3A%22LABEL%22%2C%22matrix%22%3A%22%7B%7B1%2C0%7D%2C%7B0%2C1%7D%7D%22%7D%5D%7D