Skip to content
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

Extend MAX_MODULUS of matrix_modn_dense_double.pyx #35855

Merged
merged 3 commits into from
Jul 1, 2023
Merged
Show file tree
Hide file tree
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
10 changes: 5 additions & 5 deletions src/sage/matrix/matrix_modn_dense_double.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# distutils: include_dirs = CBLAS_INCDIR
# distutils: extra_compile_args = -D_XPG6
r"""
Dense matrices over `\ZZ/n\ZZ` for `n < 2^{23}` using LinBox's ``Modular<double>``
Dense matrices over `\ZZ/n\ZZ` for `n < 94906266` using LinBox's ``Modular<double>``

AUTHORS:

Expand Down Expand Up @@ -38,7 +38,7 @@ from sage.libs.linbox.fflas cimport \
ctypedef Poly1Dom[ModField, Dense] ModDensePolyRing

# Limit for LinBox Modular<double>
MAX_MODULUS = 2**23
MAX_MODULUS = 94906266

from sage.rings.finite_rings.integer_mod cimport IntegerMod_int64

Expand All @@ -47,11 +47,11 @@ include "matrix_modn_dense_template.pxi"

cdef class Matrix_modn_dense_double(Matrix_modn_dense_template):
r"""
Dense matrices over `\ZZ/n\ZZ` for `n < 2^{23}` using LinBox's ``Modular<double>``
Dense matrices over `\ZZ/n\ZZ` for `n < 94906266` using LinBox's ``Modular<double>``

These are matrices with integer entries mod ``n`` represented as
floating-point numbers in a 64-bit word for use with LinBox routines.
This allows for ``n`` up to `2^{23}`. By default, the analogous
This allows for ``n`` up to `94906266`. By default, the analogous
``Matrix_modn_dense_float`` class is used for smaller moduli, specifically
for ``n`` up to `2^{8}`.

Expand All @@ -70,7 +70,7 @@ cdef class Matrix_modn_dense_double(Matrix_modn_dense_template):
<class 'sage.rings.finite_rings.integer_mod.IntegerMod_int64'>
"""
self._get_template = self._base_ring.zero()
# note that INTEGER_MOD_INT32_LIMIT is ceil(sqrt(2^31-1)) < 2^23
# note that INTEGER_MOD_INT32_LIMIT is ceil(sqrt(2^31-1)) < 94906266
self._fits_int32 = ((<Matrix_modn_dense_template>self).p <= INTEGER_MOD_INT32_LIMIT)

cdef void set_unsafe_int(self, Py_ssize_t i, Py_ssize_t j, int value):
Expand Down
5 changes: 3 additions & 2 deletions src/sage/matrix/matrix_space.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def get_matrix_class(R, nrows, ncols, sparse, implementation):
sage: get_matrix_class(Zmod(2**30), 2, 2, False, 'linbox-double')
Traceback (most recent call last):
...
ValueError: 'linbox-double' matrices can only deal with order < 8388608
ValueError: 'linbox-double' matrices can only deal with order < 94906266

sage: type(matrix(SR, 2, 2, 0))
<class 'sage.matrix.matrix_symbolic_dense.Matrix_symbolic_dense'>
Expand Down Expand Up @@ -617,7 +617,8 @@ def __init__(self, base_ring, nrows, ncols, sparse, implementation):

- ``linbox-float`` - for integer mod rings up to `2^8 = 256`

- ``linbox-double`` - for integer mod rings up to `2^23 = 8388608`
- ``linbox-double`` - for integer mod rings up to
`floor(2^26*sqrt(2) + 1/2) = 94906266`

- ``numpy`` - for real and complex floating point numbers

Expand Down