8000 Fix issue on matrix construction over integer mod ring for large coefficients by HugoPasse · Pull Request #39488 · sagemath/sage · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix issue on matrix construction over integer mod ring for large coefficients #39488

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 21, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/sage/matrix/matrix_modn_dense_template.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,9 @@ cdef class Matrix_modn_dense_template(Matrix_dense):
sage: Matrix(Integers(4618990), 2, 2, [-1, int(-2), GF(7)(-3), 1/7]) # needs sage.rings.finite_rings
[4618989 4618988]
[ 4 2639423]

sage: Matrix(IntegerModRing(200), [[int(2**128+1), int(2**256+1), int(2**1024+1)]]) # needs sage.rings.finite_rings
[ 57 137 17]
"""
ma = MatrixArgs_init(parent, entries)
cdef long i, j
Expand All @@ -525,10 +528,7 @@ cdef class Matrix_modn_dense_template(Matrix_dense):
se = <SparseEntry>t
x = se.entry
v = self._matrix[se.i]
if type(x) is int:
tmp = (<long>x) % p
v[se.j] = tmp + (tmp<0)*p
elif type(x) is IntegerMod_int and (<IntegerMod_int>x)._parent is R:
if type(x) is IntegerMod_int and (<IntegerMod_int>x)._parent is R:
v[se.j] = <celement>(<IntegerMod_int>x).ivalue
elif type(x) is Integer:
if coerce:
Expand Down
Loading
0