MapperFnEvolutionSynthesis¶
- class MapperFnEvolutionSynthesis(mapper_fn, product_formula=None)¶
Bases:
objectA
F2QSynthesisPluginfor transpilingEvolutionunder a custom mapping.This plugin maps the fermionic Hamiltonian \(H\) of the incoming
Evolutiongate to a qubit operator usingmapper_fnand emits aPauliEvolutionGate. It thereby preserves the \(e^{-i t H}\) convention of theEvolutiongate, with the same evolution time \(t\).How that
PauliEvolutionGateis subsequently decomposed into basis gates is governed by the product formula passed asproduct_formula. Leaving it at its default (None) defers to thePauliEvolutionGate’s own default synthesis (a first-orderLieTrotterdecomposition with a single repetition). Supplying an explicitEvolutionSynthesis(for example a higher-orderSuzukiTrotteror one with several repetitions) selects a different Trotter-Suzuki product formula, trading circuit depth for a smaller Trotter error.Note
The operator returned by
mapper_fnis passed on as-is, in particular without being simplified. A product formula synthesizes the Pauli terms in the order it receives them, so the term order thatmapper_fnproduces is part of its output and is preserved here. Amapper_fnthat maps an operator group by group, for instance, emits the terms of each group together, which lets the terms of one group be scheduled in parallel where their supports are disjoint. Seegroup_wise(), which wraps any mapper to do exactly that.Caution
A consequence of preserving that order is that the synthesized circuit is only as reproducible as
mapper_fnis. The operators of the Rust core do not preserve the order in which their terms were added, so a mapper that walks an operator’s terms can emit them in a different order from one run to the next. The circuits that result are all equally valid (they approximate the same evolution of the same operator) but they need not be identical, and metrics such as depth or gate count can vary between them.Wrap the mapper in
simplify()to pin a canonical order where that matters:MapperFnEvolutionSynthesis(simplify(jordan_wigner))
Initializing this transpiler pass plugin can be done with the arguments listed below.
- Parameters:
mapper_fn (MapperFunction) – the fermion-to-qubit operator mapping function.
product_formula (EvolutionSynthesis | None) – the product formula with which to synthesize the emitted
PauliEvolutionGate. IfNone(the default), the gate’s own default synthesis is used (a first-orderLieTrotterdecomposition with a single repetition).
Attributes
- mapper_fn: MapperFunction¶
The fermion-to-qubit operator mapping function.
The two input arguments should be the following:
the operator to be mapped.
the number of qubits that the resulting operator should be defined on.
Note
It is the user’s responsibility to ensure that this function is in-sync with the global transpilation
F2QLayoutsetting.
- product_formula: EvolutionSynthesis | None¶
The product formula used to synthesize the emitted
PauliEvolutionGate, orNoneto defer to that gate’s own default synthesis.
Methods
- run(in_node, out_dag, *, f2q_layout)¶
Runs this transpilation plugin.
The fermionic Hamiltonian of the incoming
Evolutiongate is mapped to a qubit operator viamapper_fnand appended toout_dagas aPauliEvolutionGateimplementing \(e^{-i t H}\) with the original evolution time \(t\) and theproduct_formulasynthesis.- Parameters:
in_node (DAGOpNode) – the input fermion-based circuit instruction. When this plugin gets called, the
in_node.opattribute must be of typeEvolution.out_dag (DAGCircuit) – the output qubit-based circuit.
f2q_layout (dict[QuantumRegister, QuantumRegister]) – the global transpilation
F2QLayoutsetting.
- Return type:
None
See also
The documentation of
F2QSynthesisPluginfor more detailed explanations of the arguments.- Raises:
NotImplementedError – when
in_nodeacts on fermionic modes that are spread across multipleFermionicRegisterinstances.- Parameters:
in_node (DAGOpNode)
out_dag (DAGCircuit)
f2q_layout (dict[QuantumRegister, QuantumRegister])
- Return type:
None