Skip to content

Commit

Permalink
SWAP gate for (non-) reversed circuit (#177)
Browse files Browse the repository at this point in the history
SWAP needs to be treated differently for circuits with reversed and non-reversed states order.
  • Loading branch information
BoxiLi authored Nov 9, 2022
1 parent 99b0505 commit 17d37af
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/qutip_qip/circuit/circuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -967,7 +967,9 @@ def latex_code(self):
distance = abs(
gate.targets[1] - gate.targets[0]
)
col.append(r" \qswap \qwx[-%d] \qw" % distance)
if self.reverse_states:
distance = -distance
col.append(r" \qswap \qwx[%d] \qw" % distance)
_swap_processing = True

elif (
Expand Down

0 comments on commit 17d37af

Please sign in to comment.