ComputeUncompute¶
- class ComputeUncompute(sampler, options=None, local=False)[소스]¶
기반 클래스:
BaseStateFidelity
This class leverages the sampler primitive to calculate the state fidelity of two quantum circuits following the compute-uncompute method (see [1] 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
circuit_1
andcircuit_2
, respectively.Reference: [1] 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
run
method > fidelity’s default options > primitive’s default setting. Higher priority setting overrides lower priority setting.local (bool) –
If set to
True
, the fidelity is averaged over single-qubit projectors\[\hat{O} = \frac{1}{N}\sum_{i=1}^N|0_i\rangle\langle 0_i|,\]instead of the global projector \(|0\rangle\langle 0|^{\otimes n}\). This coincides with the standard (global) fidelity in the limit of the fidelity approaching 1. Might be used to increase the variance to improve trainability in algorithms such as
PVQD
.
- 예외 발생
ValueError – If the sampler is not an instance of
BaseSampler
.
Methods
Combines
circuit_1
andcircuit_2
to 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.
Attributes
- options¶
Return the union of estimator options setting and fidelity default options, where, if the same field is set in both, the fidelity’s default options override the primitive’s default setting.
- 반환
The fidelity default + estimator options.