qsharp
qsharp copied to clipboard
Add quantum phase estimation to the libraries
Is your feature request related to a problem? Please describe. Classic QDK used to have quantum phase estimation as a primitive, but now it looks like our libraries don't offer anything beyond QFT rotations. It is a well-established primitive, and I'd really like to be able to use it "out of the box" instead of reimplementing it every time.
Describe the solution you'd like Add quantum phase estimation to the library. The QFT-based algorithm is the best, since iterative/adaptive variants can have varying definitions and require mid-circuit measurements, but the QFT-based one is unambiguous.
Describe alternatives you've considered I can reimplement it by hand for every use, but it is error-prone: I've needed to implement it twice in the past month, and I had to work out what I need to do each time.
@tcNickolas Am I correct that the scope of this work includes:
- Copy the CDK Quantum.qs to QDK library folder. Refactor/adjust the code. Bring dependencies if needed.
- Re-implement CDK QuantumPhaseEstimationTests.qs in Rust and place tests into QDK library test folder. Add new tests if needed.
- Change qsharp.json and other build files to include the changes above.
- Optional follow-up work: a. Do the same for iterative and robust phase estimations b. Update existing katas to reflect library changes
@tcNickolas Would love to work on this one. Can you confirm if there is anything more than what is mentioned above, that needs to be done? Also, since this is long standing here, just wanted to check if it is still available for grab?
@ggridin @devikamehra Unfortunately, I do not work on Q# libraries at the moment, and this question is really best triaged by the libraries owner. I think @sezna is the right person to answer this.
QFT-based ApplyQPE was added to Canon namespace in the standard library. Note that the phase is returned as a fraction represented in a little-endian format. Other variants may be added later in a separate library.