-
Notifications
You must be signed in to change notification settings - Fork 44
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
Replace ModInv shim with KaliskiModInverse in ECAdd bloq #1485
Conversation
#1443 - this issue is fixed now because we use KaliskiModInverse for classical simulation instead of my hacky temp solution. |
# toffoli cost for Kaliski Mod Inverse, n extra toffolis in ModNeg, 2n extra toffolis to do n | ||
# 3-controlled toffolis in step 2. The expression is written with rationals because sympy | ||
# comparison fails with floats. | ||
assert total_toff == sympy.Rational(253, 2) * n**2 + sympy.Rational(391, 2) * n - 31 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
something that might help here or in the future: when comparing sympy expressions, the equality operator tests for the same literal expression. If you want to test for mathematical equality x = y
you can test simplify(x-y)==0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sweeeeeeeet
Removes ModInv shim as it is no longer used
Replaces it with KaliskiModInverse bloq in ECAdd
Improves the gate count test to match toffoli count expected with bloq swap