FermionicTrotterization¶
- class FermionicTrotterization(synthesis, *, apply=True, filter=None)¶
Bases:
GenericPass[DAGCircuit,DAGCircuit]A transpilation pass Trotterizing
Evolutiongates in fermionic space.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))] )
Each selected gate is replaced by the factors its method emits, so the pass both chooses the formula and carries it out. Nodes that are not
Evolutiongates are left untouched, as are those rejected by an optionalfilter.Note
Running the pass again is harmless: the factors a synthesis method emits are
Evolution.atomic, and an atomic gate is a terminal factor which this pass leaves in place rather than splitting further. The same exemption makes the pass a fixed point over the output ofQDriftTrotterization, whose sampled gates are atomic because the random draw is the Trotterization it performs.Note
Set
applytoFalseto only select the method and leave the expansion to something else, such as Qiskit’sDecomposeor adecompose()call. Be aware that a gate which is never expanded reaches the fermion-to-qubit stage whole, where it is mapped withoutEvolution.synthesisever being read – and every synthesis method then produces identical output.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.Expanding an operator that carries no
groupssplits it term by term, and a lone \(a^\dagger_i a_j\) is not Hermitian, so its exponential is not unitary. Nothing complains until the mapped operator reachesPauliEvolutionGate, which raisesValueError: Operator contains complex coefficients, which are not supported. Assigning conjugate-paired groups is what makes each factor Hermitian.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.apply (bool) – whether to expand each selected gate into the factors
synthesisproduces. WhenFalse, the gate is only tagged withsynthesisand something else has to expand it later. Seeapply.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.
- apply¶
Whether to expand each selected gate into the factors
synthesisproduces.When this is
False, the pass only selects the method: it tags each selected gate withsynthesisand leaves the expansion to whatever builds the gate’s definition later, such as Qiskit’sDecomposeor adecompose()call. Note that a gate which is never expanded reaches the fermion-to-qubit stage whole, where it is mapped withoutEvolution.synthesisever being read, and every synthesis method then produces identical output.
Methods
- run(dag)¶
Runs this transpilation pass.
Every
Evolutionnode accepted byfilteris replaced by the factors thatsynthesisproduces, or (whenapplyisFalse) by an equivalent gate merely 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: