qat.plugins.ZeroNoiseExtrapolator
- class qat.plugins.ZeroNoiseExtrapolator(n_ins: Optional[int] = 1, extrap_gates: Optional[List[Gate]] = None, extrap_method: Optional[str] = 'linear')
Perform Zero-Noise Extrapolation (linear - by default - or exponential) by inserting decompositions \(GG^{\dagger}\) of the identity after each occurrence of the gate \(G\) (default is CNOT) in the circuit.
More specifically, let
\[f(n_\mathrm{pairs}) = \mathrm{Tr} \left[\rho_{n_\mathrm{pairs}} \hat{O} \right]\]be the noisy expectation value of the observable of interest \(\hat{O}\) on the circuit in which each gate \(G\) was replaced by \(G(GG^{\dagger})^{n_{\mathrm{pairs}}}\). In other words, this value corresponds to a noise strength \(\mathcal{N} \propto 1 + 2 n_\mathrm{pairs}\).
Then the plugin will fit \(f\) from the \((n_{\mathrm{ins}}+1)\) points corresponding to \(n_{\mathrm{pairs}} =0...n_{\mathrm{ins}}\) with either a linear ansatz
\(f(n_\mathrm{pairs}) = an_\mathrm{pairs} + b\)
or an exponential one
\(f(n_\mathrm{pairs}) = \pm e^{an_\mathrm{pairs}+b} + C\)
and infer a noise-free value for \(\langle \hat{O}_{\mathrm{noise-free, inferred}} \rangle\) as \(f(-0.5)\).
In the latter case, \(C\) corresponds to the observable’s expectation value over the totally mixed state, which can be shown to be the observable’s constant coefficient and is the asymptotic value reached as the noise increases, whereas the sign is case-specific and is evaluated by the plugin by looking at the difference between the noisy value and the asymptot \(C\)).
Note
Be careful as the plugin will not work correctly if the batch sent to the stack mixes sampling and observable measurement jobs!
- Parameters
n_ins (Optional[int]) – Maximum number of identity insertions to go to. Defaults to 1.
extrap_gates (Optional[List[Gate]]) – Gates \(G\) to be followed by identity decompositions \(GG^{\dagger}\). Defaults to CNOT
extrap_method (Optional[str]) – Form of the ansatz fit, defaults to ‘linear’. Can be also ‘exponential’.