diff --git a/pyzx/circuit/gates.py b/pyzx/circuit/gates.py index 0bada393..ed26f84d 100644 --- a/pyzx/circuit/gates.py +++ b/pyzx/circuit/gates.py @@ -725,24 +725,6 @@ def to_graph(self, g, q_mapper, c_mapper): for gate in self.to_basic_gates(): gate.to_graph(g, q_mapper, c_mapper) -class RZZ(Gate): - name = 'RZZ' - qasm_name = 'rzz' - print_phase = True - def __init__(self, control: int, target: int, phase: FractionLike) -> None: - self.target = target - self.control = control - self.phase = phase - - def to_basic_gates(self): - return [CNOT(control=self.control,target=self.target), - ZPhase(self.target,phase=self.phase), - CNOT(control=self.control,target=self.target)] - - def to_graph(self, g, q_mapper, c_mapper): - for gate in self.to_basic_gates(): - gate.to_graph(g, q_mapper, c_mapper) - class CPhase(CRZ): name = 'CPhase' qasm_name = 'cp' @@ -820,6 +802,16 @@ def tcount(self): return 1 if self.phase.denominator > 2 else 0 +class RZZ(ParityPhase): + name = 'RZZ' + qasm_name = 'rzz' + def __init__(self, control: int, target: int, phase: FractionLike) -> None: + self.control = control + self.target = target + self.targets = (control, target) + self.phase = phase + + class FSim(Gate): name = 'FSim' qsim_name = 'fs'