Skip to content

Commit

Permalink
Merge pull request #170 from BoxiLi/plotting_swap
Browse files Browse the repository at this point in the history
- Add a minus sign for plotting the swap gate

- Add a border so that SWAP gates are not cropped.

- Remove the unnecessary redefinition of qswap
  • Loading branch information
BoxiLi committed Sep 16, 2022
2 parents 733b405 + 47fa957 commit bf3f7c1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
5 changes: 2 additions & 3 deletions src/qutip_qip/circuit/circuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -967,7 +967,7 @@ def latex_code(self):
distance = abs(
gate.targets[1] - gate.targets[0]
)
col.append(r" \qswap \qwx[%d] \qw" % distance)
col.append(r" \qswap \qwx[-%d] \qw" % distance)
_swap_processing = True

elif (
Expand Down Expand Up @@ -1171,9 +1171,8 @@ def _to_qasm(self, qasm_out):


_latex_template = r"""
\documentclass{standalone}
\documentclass[border=3pt]{standalone}
\usepackage[braket]{qcircuit}
\renewcommand{\qswap}{*=<0em>{\times}}
\begin{document}
\Qcircuit @C=1cm @R=1cm {
%s}
Expand Down
3 changes: 1 addition & 2 deletions tests/test_circuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -667,9 +667,8 @@ def test_wstate(self):
assert sum(result_cbits[i]) == 1

_latex_template = r"""
\documentclass{standalone}
\documentclass[border=3pt]{standalone}
\usepackage[braket]{qcircuit}
\renewcommand{\qswap}{*=<0em>{\times}}
\begin{document}
\Qcircuit @C=1cm @R=1cm {
%s}
Expand Down

0 comments on commit bf3f7c1

Please sign in to comment.