From c45d02d0f090f849b23303f5098fe49a6ffb42d7 Mon Sep 17 00:00:00 2001 From: Erick Winston Date: Thu, 18 Jul 2024 08:14:56 -0400 Subject: [PATCH] bind RZZ to pi/2 if Rzz(theta) in basis --- qiskit/transpiler/passes/synthesis/unitary_synthesis.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/qiskit/transpiler/passes/synthesis/unitary_synthesis.py b/qiskit/transpiler/passes/synthesis/unitary_synthesis.py index de7a845193e3..19356adf69c9 100644 --- a/qiskit/transpiler/passes/synthesis/unitary_synthesis.py +++ b/qiskit/transpiler/passes/synthesis/unitary_synthesis.py @@ -49,6 +49,7 @@ CZGate, RXXGate, RZXGate, + RZZGate, ECRGate, RXGate, SXGate, @@ -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: @@ -817,7 +820,7 @@ 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) @@ -825,7 +828,7 @@ def is_supercontrolled(gate): 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)