Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions src/openfermion/circuits/gates/four_qubit_gates.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,17 @@ def _circuit_diagram_info_(self, args: cirq.CircuitDiagramInfoArgs) -> cirq.Circ
# Split up this string to avoid SyntaxError in Python 3.12.
down_up = r'\/ /' + '\\'
wire_symbols = (up_down, up_down, down_up, down_up)
return cirq.CircuitDiagramInfo(
wire_symbols=wire_symbols, exponent=self._diagram_exponent(args)
)

exponent = self._diagram_exponent(args)
if isinstance(exponent, (int, float)):
# Canonicalize rounded exponent into (-1, 1] range (DoubleExcitation has period 2)
h = 1.0
if not (-h < exponent <= h):
exponent = h - exponent
exponent %= 2.0
exponent = h - exponent
Comment thread
mhucka marked this conversation as resolved.
Outdated

return cirq.CircuitDiagramInfo(wire_symbols=wire_symbols, exponent=exponent)

def __repr__(self):
if self.exponent == 1:
Expand Down
Loading