You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The constructor for matrices of type matrix_modn_dense is supposed to accept a matrix of Python integers int. Yet it will fail with overflow if given integers that exceed the maximum value for a long.
Try the following example:
sage: x = int(2**128 + 1)
sage: mat = matrix(GF(9001), [[x]])
Expected Behavior
We expect that mat is constructed as an 1 x 1 matrix with single entry the element GF(9001)(x) (represented by 7633 in sage).
Actual Behavior
[...]
File src/sage/matrix/matrix_modn_dense_template.pxi:531, in sage.matrix.matrix_modn_dense_double.Matrix_modn_dense_template.__init__()
529 x = next(it)
530 if type(x) is int:
--> 531 tmp = (<long>x) % p
532 v[j] = tmp + (tmp<0)*p
533 elif type(x) is IntegerMod_int and (<IntegerMod_int>x)._parent is R:
OverflowError: Python int too large to convert to C long
Additional Information
We see in the error message that there is an attempt to convert x into a long, hence the overflow error.
Environment
-**OS**: ubuntu 22.04
-**Sage Version**: 10.1.rc0
Checklist
I have searched the existing issues for a bug report that matches the one I want to file, without success.
I have read the documentation and troubleshoot guide
The text was updated successfully, but these errors were encountered:
Steps To Reproduce
The constructor for matrices of type
matrix_modn_dense
is supposed to accept a matrix of Python integersint
. Yet it will fail with overflow if given integers that exceed the maximum value for along
.Try the following example:
Expected Behavior
We expect that mat is constructed as an
1 x 1
matrix with single entry the elementGF(9001)(x)
(represented by7633
in sage).Actual Behavior
Additional Information
We see in the error message that there is an attempt to convert
x
into along
, hence the overflow error.Environment
Checklist
The text was updated successfully, but these errors were encountered: