Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Currently the `cirq.contrib.circuit_to_latex_using_qcircuit` utility doesn't handle exponents for multiqubit gates properly. For example, converting `cirq.ISWAP(q0, q1) ** 0.5` outputs the qcircuit source ``` \Qcircuit @r=1em @C=0.75em { \\ &\lstick{\text{0}}& \qw&\multigate{1}{\text{ISWAP}^{0.5}}^0.5 \qw&\qw\\ &\lstick{\text{1}}& \qw&\ghost{\text{ISWAP}^{0.5}}^0.5 \qw&\qw\\ \\ } ``` which produces the diagram ![before](https://user-images.githubusercontent.com/14928221/138499001-8fe6c0d3-f20a-43e3-be87-88e7650d93b2.png) The `0.5` exponent is getting duplicated and put in the wrong place. This PR resolves this issue by bypassing any additional processing by `Circuit.to_text_diagram_drawer` by just hardcoding `exponent=1` into `CircuitDiagramInfo`. This results in the correct output, ``` \Qcircuit @r=1em @C=0.75em { \\ &\lstick{\text{0}}& \qw&\multigate{1}{\text{ISWAP}^{0.5}} \qw&\qw\\ &\lstick{\text{1}}& \qw&\ghost{\text{ISWAP}^{0.5}} \qw&\qw\\ \\ } ``` and the diagram ![after](https://user-images.githubusercontent.com/14928221/138499507-d86a781d-5013-4871-b9e5-46f364f032c0.png)
- Loading branch information