- class ComputeUncompute(sampler, options=None)[source]¶
This class leverages the sampler primitive to calculate the state fidelity of two quantum circuits following the compute-uncompute method (see  for further reference). The fidelity can be defined as the state overlap.\[|\langle\psi(x)|\phi(y)\rangle|^2\]
where \(x\) and \(y\) are optional parametrizations of the states \(\psi\) and \(\phi\) prepared by the circuits
Reference:  Havlíček, V., Córcoles, A. D., Temme, K., Harrow, A. W., Kandala, A., Chow, J. M., & Gambetta, J. M. (2019). Supervised learning with quantum-enhanced feature spaces. Nature, 567(7747), 209-212. arXiv:1804.11326v2 [quant-ph]
sampler (BaseSampler) – Sampler primitive instance.
options (Options | None) – Primitive backend runtime options used for circuit execution. The order of priority is: options in
runmethod > fidelity’s default options > primitive’s default setting. Higher priority setting overrides lower priority setting.
ValueError – If the sampler is not an instance of
circuit_2to create the fidelity circuit following the compute-uncompute method.
Runs asynchronously the state overlap (fidelity) calculation between two (parametrized) circuits (first and second) for a specific set of parameter values (first and second).
Update the fidelity's default options setting.