F2FSynthesisPlugin¶
- class F2FSynthesisPlugin(*args, **kwargs)¶
Bases:
ProtocolThe protocol for plugins to the
F2FSynthesistranspiler pass.A plugin rewrites a gate into a
FermionicCircuitof smallerFermionicGateinstances. Both sides of that rewrite live in fermionic space, so no encoding is involved: how the smaller gates are then mapped to qubits is left to the fermion-to-qubit stage (seeF2QSynthesis). It is the counterpart ofF2QSynthesisPluginone step earlier.The gates a plugin emits should be marked
atomic, and anEvolutionamong them should carry an operator with a single group, so that the fermion-to-qubit stage maps every one of them whole.Important
What the circuit has to be equivalent to is specified by the gate a plugin is registered for, not by this protocol, and it may differ between gates: a circuit that implements the same unitary is the common case, but a gate may settle for less (for example, the same state when prepared from the vacuum). Consult the documentation of the gate whose method you implement, and document any such caveat there.
Important
This fermion-to-fermion step is optional. A gate can be handed to the fermion-to-qubit stage whole, where a plugin of that stage registered for it can map it directly.
Methods
- synthesize(gate)¶
Synthesizes the provided gate.
- Parameters:
gate (FermionicGate) – the gate to synthesize, which is of the one type that this plugin is registered for (the first part of its entry-point name).
- Returns:
A
FermionicCircuitongate.num_modesmodes implementing the gate, in the sense that the documentation of the gate defines.- Return type: