diff --git a/qualtran/bloqs/factoring/ecc/ec_add_test.py b/qualtran/bloqs/factoring/ecc/ec_add_test.py index 37c397707..7f7439d2d 100644 --- a/qualtran/bloqs/factoring/ecc/ec_add_test.py +++ b/qualtran/bloqs/factoring/ecc/ec_add_test.py @@ -418,7 +418,7 @@ def test_ec_add_symbolic_cost(): # 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 + assert total_toff == sympy.Rational(253, 2) * n**2 + sympy.Rational(407, 2) * n - 31 def test_ec_add(bloq_autotester): diff --git a/qualtran/bloqs/mod_arithmetic/mod_division_test.py b/qualtran/bloqs/mod_arithmetic/mod_division_test.py index 4d304f127..934a26967 100644 --- a/qualtran/bloqs/mod_arithmetic/mod_division_test.py +++ b/qualtran/bloqs/mod_arithmetic/mod_division_test.py @@ -86,11 +86,11 @@ def test_kaliski_symbolic_cost(): # construction this is just $n-1$ (BitwiseNot -> Add(p+1)). # - The cost of an iteration in Litinski $13n$ since they ignore constants. # Our construction is exactly the same but we also count the constants - # which amout to $3$. for a total cost of $13n + 3$. + # which amout to $3$. for a total cost of $13n + 4$. # For example the cost of ModDbl is 2n+1. In their figure 8, they report # it as just $2n$. ModDbl gets executed within the 2n loop so its contribution # to the overal cost should be 4n^2 + 2n instead of just 4n^2. - assert total_toff == 26 * n**2 + 7 * n - 1 + assert total_toff == 26 * n**2 + 9 * n - 1 def test_kaliskimodinverse_example(bloq_autotester):