quil-lang / quilc

The optimizing Quil compiler.
Apache License 2.0
460 stars 72 forks source link

Bugfix: use layout when placing tikz operations for nq gates #754

Closed braised-babbage closed 3 years ago

braised-babbage commented 3 years ago

This fixes an issue with placing of non-controlled nq (n > 1) gates in the circuit rendering algorithm. The basic problem was that something like "FOO p q r" would have the Tikz operator \gate[wires=3]{FOO} placed on the qubit line for p, even if that line happened to be below the lines for either q or r in the diagram. This is not valid as far as quantikz is concerned. Now we should have the operator placed on whatever qubit line happens to be first, with respect to our layout. Note that this happened to sneak under the radar because the only n > 1 qubit gates I had tested with happened to have special handling (e.g. CNOT).