gulps.transpiler.GulpsDecompositionPass

class gulps.transpiler.GulpsDecompositionPass(decomposer, *, cost='duration', local_layer_cost=0.0, max_depth=64)[source]

Bases: TransformationPass

Replace each two-qubit block of a DAG with a GULPS circuit.

The pass emits the single-qubit matrices required by each decomposition, leaving merging across blocks and translation to the single-qubit basis to Qiskit’s passes. The translation plugin includes that cleanup in its pipeline.

A Target must register each native instruction under its own gate.name; aliases raise NotImplementedError. Since a Target has one entry per name, it cannot register several fixed angles of the same standard gate under that name. For such instruction sets, pass a GulpsDecomposer directly, with all native gates and their costs.

Parameters:
  • decomposer (GulpsDecomposer | qiskit.transpiler.Target) – A fixed decomposer for every pair, or a Target from which to build one decomposer per distinct instruction set and cost model.

  • cost (str) – The Target property to minimize: "duration" or "error".

  • local_layer_cost (float) – Cost of each layer of single-qubit gates before, between, and after the two-qubit gates, in the units of cost. A Target does not determine it: a general single-qubit gate costs one u or two sx, for example, depending on the basis that later passes use.

  • max_depth (int) – Maximum number of two-qubit gates in a sequence.

The Target options are ignored for a GulpsDecomposer.

run(dag)

Compile every two-qubit unitary in place.

Two-qubit gates without a matrix, such as gates with unbound parameters, are left unchanged.

Raises:
  • TranspilerError – If a block is invalid for the configured gates or cannot be compiled. Its __cause__ is the original error.

  • NotImplementedError – If the DAG has control flow.

Parameters:

dag (DAGCircuit)

Return type:

DAGCircuit