Skip to content

Commit

Permalink
bind RZZ to pi/2 if Rzz(theta) in basis
Browse files Browse the repository at this point in the history
  • Loading branch information
ewinston committed Jul 18, 2024
1 parent d2eb307 commit c45d02d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions qiskit/transpiler/passes/synthesis/unitary_synthesis.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
CZGate,
RXXGate,
RZXGate,
RZZGate,
ECRGate,
RXGate,
SXGate,
Expand Down Expand Up @@ -779,6 +780,8 @@ def _replace_parameterized_gate(op):
op = RXXGate(pi / 2)
elif isinstance(op, RZXGate) and isinstance(op.params[0], Parameter):
op = RZXGate(pi / 4)
elif isinstance(op, RZZGate) and isinstance(op.params[0], Parameter):
op = RZZGate(pi / 2)
return op

try:
Expand Down Expand Up @@ -817,15 +820,15 @@ def _replace_parameterized_gate(op):
def is_supercontrolled(gate):
try:
operator = Operator(gate)
except (QiskitError, TypeError): # TypeError: parametrized gate
except QiskitError:
return False
kak = TwoQubitWeylDecomposition(operator.data)
return isclose(kak.a, pi / 4) and isclose(kak.c, 0.0)

def is_controlled(gate):
try:
operator = Operator(gate)
except (QiskitError, TypeError): # TypeError: parametrized gate
except QiskitError:
return False
kak = TwoQubitWeylDecomposition(operator.data)
return isclose(kak.b, 0.0) and isclose(kak.c, 0.0)
Expand Down

0 comments on commit c45d02d

Please sign in to comment.