FermionicTrotterization

class FermionicTrotterization(synthesis, *, filter=None)

Bases: GenericPass[DAGCircuit, DAGCircuit]

A transpilation pass selecting the fermion-to-fermion synthesis of Evolution gates.

An Evolution gate carries the synthesis method with which it gets decomposed in fermionic space (see Evolution.synthesis). Setting it per gate means threading the choice through everything that constructs one – including UCC and UCJ, which build their own internally. This pass applies one method to every Evolution in a circuit instead, so the choice can be made once for a whole transpilation pipeline:

pm.optimization = FermionicPassManager(
    [FermionicTrotterization(FermionicSuzukiTrotter(order=2, reps=4))]
)

Nodes that are not Evolution gates are left untouched, as are those rejected by an optional filter.

Note

The pass selects a synthesis method rather than expanding the evolution there and then. The expansion happens later, when the gate’s definition is built, which keeps each Evolution intact as a single node for the passes that follow – notably RelabelModes, which reads the operator of every Evolution to build its mode-relabeling model and would otherwise see a fragment per factor.

This is the opposite choice from QDriftTrotterization, which replaces each gate with its sampled factors immediately. That pass has no alternative: its sampling is random and one-shot, so deferring it would draw a different sample every time the definition were rebuilt. A deterministic product formula is a pure function of the gate and can safely be deferred.

Caution

Not every synthesis method suits every operator. An Evolution whose operator groups all mutually commute (the diagonal-Coulomb operators of a UCJ, for example) is synthesized exactly at any order, so a higher order only adds depth. Use filter to restrict the pass to the gates that benefit.

Initializing this transpiler pass can be done with the arguments listed below.

Parameters:
  • synthesis (FermionicEvolutionSynthesis) – the fermion-to-fermion synthesis method to apply to the Evolution gates of the circuit.

  • filter (Callable[[DAGOpNode], bool] | None) – an optional predicate deciding which Evolution nodes to apply synthesis to. It is called with the DAGOpNode and the node is left untouched unless it returns True. If None (the default), every Evolution node is selected.

Attributes

synthesis

The fermion-to-fermion synthesis method applied to the selected gates.

filter

The predicate selecting which Evolution nodes to apply synthesis to.

Methods

run(dag)

Runs this transpilation pass.

Every Evolution node accepted by filter is replaced by an equivalent gate carrying synthesis. All other nodes are left untouched. The input DAG is modified in place.

Parameters:

dag (DAGCircuit) – the input circuit with fermion-based instructions. Only DAGOpNode with FermionicGate instances as their op are supported.

Returns:

The output circuit which is still acting on a fermionic register.

Return type:

DAGCircuit

Inherited Methods

execute(passmanager_ir, state, callback=None)

Execute optimization task for input Qiskit IR.

Parameters:
  • passmanager_ir (IR) – Qiskit IR to optimize.

  • state (PassManagerState) – State associated with workflow execution by the pass manager itself.

  • callback (Callable[[Task, IR_OUT, PropertySet, float, int], None] | None) – A callback function which is called per execution of optimization task.

Returns:

Optimized Qiskit IR and state of the workflow.

Return type:

tuple[IR_OUT, PassManagerState]

name()

Name of the pass.

Return type:

str

update_status(state, run_state)

Update workflow status.

Parameters:
  • state (PassManagerState) – Pass manager state to update.

  • run_state (RunState) – Completion status of current task.

Returns:

Updated pass manager state.

Return type:

PassManagerState