QuantumLibraries icon indicating copy to clipboard operation
QuantumLibraries copied to clipboard

RobustPhaseEstimation vs QuantumPhaseEstimation

Open tcNickolas opened this issue 4 years ago • 3 comments

Is your feature request related to a problem? Please describe. RobustPhaseEstimation and QuantumPhaseEstimation return quite different values as "phases", which makes switching between the two non-trivial.

  • QPE returns (after measurement) an integer which, when divided by 2^(bits of precision), produces a floating-point number between 0 and 1, which needs to be multiplied by 2π to get a phase e^{iϕ}. The API documentation does not describe the return, and the only range in the docs is ϕ∈[0,2π) which seems to suggest that no multiplication by 2π is necessary.
  • Robust PE returns a floating point phase between -π and π which corresponds to e^{iϕ} directly.

Describe the solution you'd like It would be great to unify the outputs of these operations or at least to document them better, with specific output descriptions and examples.

tcNickolas avatar May 26 '20 05:05 tcNickolas

The different in implementation can be observed in this sample:

https://github.com/microsoft/Quantum/blob/783f4a7ba71e6f2f9d4db0861473ebfa2c3cf1f2/samples/algorithms/integer-factorization/Shor.qs#L243--275

msoeken avatar Nov 23 '20 18:11 msoeken

Ideally the documentation would be sufficient to use the library operation without looking at the samples repo and the source code of the operation... I just got burned by this again, since the docs for QuantumPhaseEstimation still hint that the result is ϕ∈[0,2π).

tcNickolas avatar Nov 25 '20 08:11 tcNickolas

@tcNickolas: I agree that this issue leads to problems and needs to be addressed. My comment about the sample was only meant as additional information to the problem itself.

msoeken avatar Nov 25 '20 09:11 msoeken