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

[Docs] Patch multiplicative group in Shor tutorial #3819

Merged
merged 2 commits into from
Mar 10, 2021

Conversation

rmlarose
Copy link
Contributor

Fixes #3814. Lower priority, but the multiplicative group function (which is only used pedagogically) contained 2 sometimes when it shouldn't.

Also clears outputs so this is tested.

@rmlarose rmlarose requested review from cduck, vtomole and a team as code owners February 17, 2021 16:23
@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@google-cla google-cla bot added the cla: yes Makes googlebot stop complaining. label Feb 17, 2021
Copy link
Collaborator

@95-martin-orion 95-martin-orion left a comment

Choose a reason for hiding this comment

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

Top-level comment: do not merge until after Cirq v0.10.0 release.

"name": "stdout",
"output_type": "stream",
"text": [
"Factoring n = pq = 184573\n",
Copy link
Collaborator

Choose a reason for hiding this comment

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

What is the runtime of this factorization? If it's more than ~10 seconds, we may want to keep the outputs here to prevent delays in CI tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's fast! (due to classical order finder)

CPU times: user 2 µs, sys: 1e+03 ns, total: 3 µs
Wall time: 5.72 µs
Factoring n = pq = 184573
p = 379
q = 487

@@ -171,9 +171,9 @@
" Args:\n",
" n: Modulus of the multiplicative group.\n",
" \"\"\"\n",
" assert n > 2\n",
" group = [1, 2]\n",
Copy link
Collaborator

Choose a reason for hiding this comment

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

[no change needed] I suspect this was built using the common assumption for Shor's algorithm that n is an odd number, but the new code is more generally correct. The alternative would be to add a comment explaining the Shor-based optimization being done here.

@95-martin-orion 95-martin-orion added the automerge Tells CirqBot to sync and merge this PR. (If it's running.) label Mar 10, 2021
@CirqBot CirqBot added the front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. label Mar 10, 2021
@CirqBot CirqBot merged commit 3f90c62 into quantumlib:master Mar 10, 2021
@CirqBot CirqBot removed automerge Tells CirqBot to sync and merge this PR. (If it's running.) front_of_queue_automerge CirqBot uses this label to indicate (and remember) what's being merged next. labels Mar 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Makes googlebot stop complaining.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error of multiplicative_group function in Shor.ipynb tutorial
3 participants