Adding plugins to your computation stack¶
A plugin is a tool which can be link to a QPU to make the computation stack more powerful. A plugin is used to pre-process batches sended to a QPU and/or post-process results of a QPU. When a Plugin is linked to a QPU, a new QPU is created. For instance, the following code defines a new QPU where each batch sended to this object is pre-processed and each result is post-processed by the plugin "Plugin()":
my_qpu = Plugin() | QPU()
The QLM provides classes to define your own plugin, an example of custom plugin is presented in this tutorial. A more advanced example can be found here.
Moreover, some plugins are already implemented in the QLM:
- Quameleon plugin: this plugin is used to simulate hardware specs for any QPU
- Variational plugins: these plugins are used to optimize angles of variational circuits. Please refer to the section variational algorithm to get more information on the variational plugins
- Optimization plugins: extra plugins are also implemented. Please refer to the section circuit optimization to get more information on the optimization plugins
Some other quality of life plugins:
- the observable splitter plugin can be used to tranform observable sampling into computational basis sampling
- the circuit inliner can be used to inline the content of a circuit in its main (in case some other Plugin needs to access the inlined circuit)
- the zero-noise extrapolation plugin can be used to mitigate the effect of two-qubit gates errors on the measured value of an obervable
- the multiple launches analyzer plugin can be used to launch several VQE runs as it duplicates the jobs in the batch and keep the result associated with the lowest value
Finally, this notebook shows how to write your own QLM compatible plugin.