Skip to content

Commit

Permalink
Merge branch 'main' into ecwindowaddr
Browse files Browse the repository at this point in the history
  • Loading branch information
mpharrigan authored Nov 4, 2024
2 parents e93edd5 + baad879 commit c1bfdc0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion qualtran/bloqs/mod_arithmetic/mod_division.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

import numpy as np
import sympy
from attrs import frozen
from attrs import evolve, frozen

from qualtran import (
Bloq,
Expand Down Expand Up @@ -632,6 +632,9 @@ def build_composite_bloq(
bb.free(f)
return {'x': x, 'm': m}

def adjoint(self) -> 'KaliskiModInverse':
return evolve(self, uncompute=not self.uncompute)

def build_call_graph(self, ssa: 'SympySymbolAllocator') -> 'BloqCountDictT':
return _KaliskiModInverseImpl(self.bitsize, self.mod).build_call_graph(ssa)

Expand Down
1 change: 1 addition & 0 deletions qualtran/bloqs/mod_arithmetic/mod_division_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def test_kaliski_mod_inverse_classical_action(bitsize, mod):
assert len(res) == 2
assert res[0] == dtype.montgomery_inverse(x_montgomery, mod)
assert dtype.montgomery_product(int(res[0]), x_montgomery, mod) == R
assert blq.adjoint().call_classically(x=res[0], m=res[1]) == (x_montgomery,)


@pytest.mark.parametrize('bitsize', [5, 6])
Expand Down

0 comments on commit c1bfdc0

Please sign in to comment.