FermionicTrotterization¶
- class FermionicTrotterization(synthesis, *, filter=None)¶
Bases:
GenericPass[DAGCircuit,DAGCircuit]A transpilation pass selecting the fermion-to-fermion synthesis of
Evolutiongates.An
Evolutiongate carries the synthesis method with which it gets decomposed in fermionic space (seeEvolution.synthesis). Setting it per gate means threading the choice through everything that constructs one – includingUCCandUCJ, which build their own internally. This pass applies one method to everyEvolutionin 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
Evolutiongates are left untouched, as are those rejected by an optionalfilter.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
Evolutionintact as a single node for the passes that follow – notablyRelabelModes, which reads the operator of everyEvolutionto 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
Evolutionwhose operator groups all mutually commute (the diagonal-Coulomb operators of aUCJ, for example) is synthesized exactly at any order, so a higher order only adds depth. Usefilterto 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
Evolutiongates of the circuit.filter (Callable[[DAGOpNode], bool] | None) – an optional predicate deciding which
Evolutionnodes to applysynthesisto. It is called with theDAGOpNodeand the node is left untouched unless it returnsTrue. IfNone(the default), everyEvolutionnode is selected.
Attributes
- synthesis¶
The fermion-to-fermion synthesis method applied to the selected gates.
Methods
- run(dag)¶
Runs this transpilation pass.
Every
Evolutionnode accepted byfilteris replaced by an equivalent gate carryingsynthesis. All other nodes are left untouched. The input DAG is modified in place.- Parameters:
dag (DAGCircuit) – the input circuit with fermion-based instructions. Only
DAGOpNodewithFermionicGateinstances as theiropare supported.- Returns:
The output circuit which is still acting on a fermionic register.
- Return type:
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]
- 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: