B2BSynthesisPlugin¶
- class B2BSynthesisPlugin(*args, **kwargs)¶
Bases:
ProtocolThe protocol for plugins to the
B2BSynthesistranspiler pass.A plugin rewrites a gate into a
BosonicCircuitof smallerBosonicGateinstances. Both sides of that rewrite live in bosonic space, so neither an occupation cutoff nor an encoding is involved: how the smaller gates are then mapped to qubits is left to the boson-to-qubit stage (seeB2QSynthesis). It is the counterpart ofB2QSynthesisPluginone step earlier. Because the bosonic structure of the gate survives the rewrite, the later stage can still exploit it, in particular thegroupsof an evolved operator (see Group operator terms: use the operator structure).The gates a plugin emits should be marked
atomic, and anEvolutionamong them should carry an operator with a single group, so that the boson-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 (up to the error of the method for an
Evolution, and on the untruncated Fock space for aModeRotation), but a gate may settle for less. Consult the documentation of the gate whose method you implement, and document any such caveat there.Important
This boson-to-boson step is optional. A gate can be handed to the boson-to-qubit stage whole, where a plugin of that stage registered for it can map it directly. Where an approximation is involved at both levels, the accuracy of the result is governed by the weaker of the two.
Note
Qiskit’s
EvolutionSynthesisis the closest analogue, but it belongs to the qubit layer: it synthesizes aPauliEvolutionGateinto aQuantumCircuit, after the operator has already been mapped and the occupation truncation has been applied. A bosonic synthesis, by contrast, carries no cutoff.Methods
- synthesize(gate)¶
Synthesizes the provided gate.
- Parameters:
gate (BosonicGate) – 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
BosonicCircuitongate.num_modesmodes implementing the gate, in the sense that the documentation of the gate defines.- Return type: