Skip to content

Commit c84bca1

Browse files
cost
1 parent cd00a9a commit c84bca1

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

qualtran/bloqs/factoring/ecc/ec_add_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ def test_ec_add_symbolic_cost():
418418
# toffoli cost for Kaliski Mod Inverse, n extra toffolis in ModNeg, 2n extra toffolis to do n
419419
# 3-controlled toffolis in step 2. The expression is written with rationals because sympy
420420
# comparison fails with floats.
421-
assert total_toff == sympy.Rational(253, 2) * n**2 + sympy.Rational(391, 2) * n - 31
421+
assert total_toff == sympy.Rational(253, 2) * n**2 + sympy.Rational(407, 2) * n - 31
422422

423423

424424
def test_ec_add(bloq_autotester):

qualtran/bloqs/mod_arithmetic/mod_division_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,11 @@ def test_kaliski_symbolic_cost():
8686
# construction this is just $n-1$ (BitwiseNot -> Add(p+1)).
8787
# - The cost of an iteration in Litinski $13n$ since they ignore constants.
8888
# Our construction is exactly the same but we also count the constants
89-
# which amout to $3$. for a total cost of $13n + 3$.
89+
# which amout to $3$. for a total cost of $13n + 4$.
9090
# For example the cost of ModDbl is 2n+1. In their figure 8, they report
9191
# it as just $2n$. ModDbl gets executed within the 2n loop so its contribution
9292
# to the overal cost should be 4n^2 + 2n instead of just 4n^2.
93-
assert total_toff == 26 * n**2 + 7 * n - 1
93+
assert total_toff == 26 * n**2 + 9 * n - 1
9494

9595

9696
def test_kaliskimodinverse_example(bloq_autotester):

0 commit comments

Comments
 (0)