Skip to content

Fix grover_oracle() #3316

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

Merged
merged 1 commit into from
Jun 20, 2025
Merged

Fix grover_oracle() #3316

merged 1 commit into from
Jun 20, 2025

Conversation

iyanmv
Copy link
Contributor

@iyanmv iyanmv commented Jun 13, 2025

This PR is just a small change in one of the cells of the Grover's tutorial notebook to consider the edge case where one of the marked states is all 1s.

Before this PR, doing something like this would fail:

grover_oracle("111")

After this PR, it works as expected and the circuit contains no X gates in that edge case.

I have limited the change to that cell in the notebook, and I have not rerun the whole notebook to avoid modifying cells metadata and other irrelevant things.

Fixes: #3315

@qiskit-bot
Copy link
Contributor

Thanks for contributing to Qiskit documentation!

Before your PR can be merged, it will first need to pass continuous integration tests and be reviewed. Sometimes the review process can be slow, so please be patient. Thanks! 🙌

One or more of the following people are relevant to this code:

Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@abbycross abbycross added content 📄 tutorial 📒 needs triage 🤔 this issue needs to be prioritized by the docs team labels Jun 13, 2025
@abbycross abbycross requested a review from miamico June 13, 2025 12:01
Copy link

@henryzou50 henryzou50 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! I reviewed the changes and testing, and the edge case now works correctly. Thanks!

Copy link
Collaborator

@Eric-Arellano Eric-Arellano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for taking the time to fix this!

@Eric-Arellano Eric-Arellano added this pull request to the merge queue Jun 20, 2025
Merged via the queue into Qiskit:main with commit a228041 Jun 20, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
content 📄 needs triage 🤔 this issue needs to be prioritized by the docs team tutorial 📒
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Code for Grover's oracle fails when one of the marked states is all 1s
5 participants