Skip to content

Commit

Permalink
Add classical action test for ModAdd (#1427)
Browse files Browse the repository at this point in the history
  • Loading branch information
NoureldinYosri authored Sep 30, 2024
1 parent b14f1b4 commit f95c868
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions qualtran/bloqs/mod_arithmetic/mod_addition_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from qualtran.resource_counting import GateCounts, get_cost_value, QECGatesCost
from qualtran.resource_counting.generalizers import ignore_alloc_free, ignore_split_join
from qualtran.testing import (
assert_consistent_classical_action,
assert_equivalent_bloq_counts,
assert_valid_bloq_decomposition,
execute_notebook,
Expand Down Expand Up @@ -172,3 +173,9 @@ def test_cmod_add_complexity_vs_ref():
# Figure/Table 8. Lists n-qubit controlled modular addition as 5n toffoli.
# Note: We have an extra toffoli due to how our OutOfPlaceAdder works.
assert counts['n_ccz'] == 5 * n + 1


@pytest.mark.parametrize(['prime', 'bitsize'], [(p, bitsize) for p in [5, 7] for bitsize in (5, 6)])
def test_mod_add_classical_action(bitsize, prime):
b = ModAdd(bitsize, prime)
assert_consistent_classical_action(b, x=range(prime), y=range(prime))

0 comments on commit f95c868

Please sign in to comment.