microsoft / qsharp

Azure Quantum Development Kit, including the Q# programming language, resource estimator, and Quantum Katas
https://microsoft.github.io/qsharp/
MIT License
407 stars 81 forks source link

Add quantum phase estimation to the libraries #1856

Open tcNickolas opened 3 weeks ago

tcNickolas commented 3 weeks ago

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.

ggridin commented 3 weeks ago

@tcNickolas Am I correct that the scope of this work includes:

  1. Copy the CDK Quantum.qs to QDK library folder. Refactor/adjust the code. Bring dependencies if needed.
  2. Re-implement CDK QuantumPhaseEstimationTests.qs in Rust and place tests into QDK library test folder. Add new tests if needed.
  3. Change qsharp.json and other build files to include the changes above.
  4. Optional follow-up work: a. Do the same for iterative and robust phase estimations b. Update existing katas to reflect library changes