Skip to content

Commit

Permalink
Remove assertions in ModInverse for cases where we don't care
Browse files Browse the repository at this point in the history
  • Loading branch information
fpapa250 committed Nov 1, 2024
1 parent 98d185c commit 42cd677
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
1 change: 0 additions & 1 deletion qualtran/bloqs/mod_arithmetic/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from ._shims import ModInv
from .mod_addition import CModAdd, CModAddK, CtrlScaleModAdd, ModAdd, ModAddK
from .mod_division import KaliskiModInverse
from .mod_multiplication import CModMulK, DirtyOutOfPlaceMontgomeryModMul, ModDbl
Expand Down
8 changes: 4 additions & 4 deletions qualtran/bloqs/mod_arithmetic/mod_division.py
Original file line number Diff line number Diff line change
Expand Up @@ -644,10 +644,10 @@ def on_classical_vals(self, x: int, m: int = 0) -> Dict[str, 'ClassicalValT']:
for _ in range(2 * int(self.bitsize)):
u, v, r, s, m_i, f = iteration.call_classically(u=u, v=v, r=r, s=s, m=0, f=f)
m = (m << 1) | m_i
assert u == 1
assert s == self.mod
assert f == 0
assert v == 0
#assert u == 1
#assert s == self.mod
#assert f == 0
#assert v == 0
return {'x': self.mod - r, 'm': m}


Expand Down

0 comments on commit 42cd677

Please sign in to comment.