Skip to content

Commit

Permalink
Make PassManager calls compatible with qiskit 1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
itoko committed Jan 22, 2024
1 parent 0ee4889 commit ec3294f
Showing 1 changed file with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@
Optimize1qGatesDecomposition,
)
from qiskit.transpiler.passes.synthesis.plugin import HighLevelSynthesisPlugin
try:
# for qiskit>=1.0
from qiskit.passmanager.flow_controllers import ConditionalController
except ImportError:
pass


class RBDefaultCliffordSynthesis(HighLevelSynthesisPlugin):
Expand Down Expand Up @@ -96,6 +101,12 @@ def _direction_condition(property_set):
CheckGateDirection(coupling_map),
]
)
pm.append([GateDirection(coupling_map)], condition=_direction_condition)
pm.append([Optimize1qGatesDecomposition(basis=basis_gates)])
try:
# for qiskit>=1.0
pm.append(ConditionalController(GateDirection(coupling_map), condition=_direction_condition))
pm.append(Optimize1qGatesDecomposition(basis=basis_gates))
except TypeError:
# for qiskit<1.0
pm.append([GateDirection(coupling_map)], condition=_direction_condition)
pm.append([Optimize1qGatesDecomposition(basis=basis_gates)])
return pm.run(circ)

0 comments on commit ec3294f

Please sign in to comment.