Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request for Durr Hoyer Library #1928

Open
mertall opened this issue Sep 24, 2024 · 12 comments
Open

Request for Durr Hoyer Library #1928

mertall opened this issue Sep 24, 2024 · 12 comments
Assignees
Labels
library related to Q# library code rather than the compiler implementation or language design

Comments

@mertall
Copy link

mertall commented Sep 24, 2024

Is your feature request related to a problem? Please describe.

I haven't seen an implementation of Durr Hoyer that is ready to use. I would like to contribute to a Q# Durr Hoyer library.
I started this project as a Junior in Undergrad, almost 4 years ago. Past 4 years have been working on my SWE skills and after continued thought and iteration I came up with a quick and dirty implementation of Durr Hoyer Algorithm to find Min and Max. At the very least I think the logic will be educational for many people, I understood MSB comparison and how it relates to quantum information which for me was really cool to see.

Describe the solution you'd like

Eventually I would like to take this algorithm and also implement finding range, and median of unsorted database. Also do some actual experiments on quantum computer. I already have an idea of the Oracle functions that we would use for range or median. Still need to implement, will work on that next in azure quantum workspace.

Describe alternatives you've considered

I am considering more optimized methods like QESA which increase accuracy to nearly 100%. I replicated the logic for QESA here, which was about 3 years ago. The quantum operations in this repo are correct but I did not understand the quantum information steps to transform lists of numbers to qubits-- as I have in my current implantation in the Jupyter notebook. Also in the QESA, you will notice I have little experience in building unit tests and was still learning about these concepts. I aim to fully flush out the current Jupyter notebook and recognize there are too many hard coded variables that will need to be set as configurable. Ideally I separate most of the quantum logic in Q#, bring up abstraction for steps like calculating Grovers steps and higher level logic in Python, accessing base operations stored in a namespace. For now, I was just trying to get something to go brrr.

Additional context
I have attached my current Jupyter notebook file, which was ran in Azure quantum Workspace
DurrHoyerImplementation.ipynb.zip

@mertall mertall added enhancement New feature or request needs triage labels Sep 24, 2024
@sezna
Copy link
Contributor

sezna commented Sep 24, 2024

We would love to see this! If you encapsulate the algorithmic logic in a Q# project, we can certainly put together a Q# library for it, and I would be happy to assist you in that!

@sezna sezna added library related to Q# library code rather than the compiler implementation or language design and removed enhancement New feature or request needs triage labels Sep 24, 2024
@billti
Copy link
Member

billti commented Sep 24, 2024

FYI if not familiar, here's the docs and creating projects that reference other projects <https://learn.microsoft.com/en-us/azure/quantum/how-to-work-with-qsharp-projects?tabs=tabid-qsharp%2Ctabid-qsharp-run#example-external-project>>

@mertall
Copy link
Author

mertall commented Sep 24, 2024

@zesna I will begin work to encapsulate this in a Q# project.
@billti that was my next question. Thank you!

Thank you so much for the opportunity!! This has been a long and rewarding journey. I'm excited to get this across for other users!

@mertall
Copy link
Author

mertall commented Sep 25, 2024

I created a Github repo with a Q# project. Please advise on next steps to integrate with Q#... should I be cloning Q# and finding a good place for this code? Thank you for your patience.

https://github.com/mertall/DurrHoyerLibrary/tree/main

EDIT: thinking out loud here. Clone Q#, find a good place (May be best if y'all tell me best place in your opinion), make sure unit tests run with code in Q# repo, and then create PR...

@Manvi-Agrawal
Copy link
Contributor

Manvi-Agrawal commented Sep 25, 2024

Nice Addition to Q# library. Please feel free to reach out in case of any further questions.

Please advise on next steps to integrate with Q#... should I be cloning Q# and finding a good place for this code? Thank you for your patience.

Finding a good place: As per my current understanding official Q# samples are supposed to be hosted here in this repo. Although, users are welcome to host Q# samples in their own repositories too. This is being tracked currently by #1934

  • library/std: might be a good location for this PR if we want to have this as a library as per @sezna's suggestion here .
  • samples/algorithm: In case we want to add this library sample code.

EDIT: thinking out loud here. Clone Q#, find a good place (May be best if y'all tell me best place in your opinion), make sure unit tests run with code in Q# repo, and then create PR...

Plan sounds good to me. I had a brief look at the tests in the github repo shared earlier. They are just printing evaluated values to the console. I think you might find the following folders helpful samples/testing, samples/python_interop.

@sezna, @billti Thoghts?

@mertall
Copy link
Author

mertall commented Sep 25, 2024

@Manvi-Agrawal I have created a branch and have a commit ready, but it is not allowing to me to push anything to my branch giving me access denied. How should I proceed?

Edit: is perferred pattern for committing me forking repo and then cloning?

@Manvi-Agrawal
Copy link
Contributor

Edit: is perferred pattern for committing me forking repo and then cloning?

Yes @mertall , You got this right. This might help: forking a repo and create PR from fork.

mertall added a commit to mertall/qsharp_fork that referenced this issue Sep 25, 2024
@mertall
Copy link
Author

mertall commented Sep 25, 2024

Doh! Thanks for reminding me about PRs with forks, totally forgot about that. PR is up for review! Thank you all! Looking forward to the review process :D

@mertall
Copy link
Author

mertall commented Sep 26, 2024

Any thoughts on adding this algorithm as a sample in Q#?

@sezna
Copy link
Contributor

sezna commented Sep 26, 2024

Pinging @swernli, @billti, and @cesarzc for their thoughts on sample-hood

@swernli
Copy link
Collaborator

swernli commented Sep 30, 2024

I think once we have #1932 merged, adding links there for both the library and the sample in your repo would be good. We could even provide the qsharp.json snippets for pulling in the library from a well-known commit that way folks have an easy way to copy-paste and build from your work. I think merging the usage samples into the samples folder under the qsharp repo might be better suited to part of the stabilization process if/when that takes places, so that the samples and code live together.

@mertall
Copy link
Author

mertall commented Oct 2, 2024

thank you for the feedback team!

curious, what does the process of stabilization entail? Are there tasks to be checked off? Or certain amount of time to pass?Thanks for your patience while I understand these dev standards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
library related to Q# library code rather than the compiler implementation or language design
Projects
None yet
Development

No branches or pull requests

5 participants