Skip to content

Commit 9161c6c

Browse files
author
Release Manager
committed
gh-35855: Extend MAX_MODULUS of matrix_modn_dense_double.pyx
<!-- Please provide a concise, informative and self-explanatory title. --> <!-- Don't put issue numbers in the title. Put it in the Description below. --> <!-- For example, instead of "Fixes #12345", use "Add a new method to multiply two integers" --> ### 📚 Description <!-- Describe your changes here in detail. --> Assign to `MAX_MODULUS` of `matrix_modn_dense_double.pyx` the actual limit for LinBox `Modular<double>` (Givaro's `maxCardinality`) <!-- Why is this change required? What problem does it solve? --> It allows better speed performances for matrices over the integers mod N, for N having 24 to 27 bits. <!-- If this PR resolves an open issue, please link to it here. For example "Fixes #12345". --> Fixes #35806 <!-- If your change requires a documentation PR, please link it appropriately. --> ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. It should be `[x]` not `[x ]`. --> - [x] The title is concise, informative, and self-explanatory. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [x] I have created tests covering the changes. - [x] I have updated the documentation accordingly. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on - #12345: short description why this is a dependency - #34567: ... --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> URL: #35855 Reported by: Marie Bonboire Reviewer(s): Vincent Neiger
2 parents 4294535 + 413f251 commit 9161c6c

File tree

4 files changed

+12
-11
lines changed

4 files changed

+12
-11
lines changed

build/pkgs/configure/checksums.ini

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
tarball=configure-VERSION.tar.gz
2-
sha1=b3604052037bc57fb64fcbe347b289dcd959366c
3-
md5=603842fccbd68e1125d32fed8d81ca86
4-
cksum=2053680048
2+
sha1=2852935b61f22d59a640dfe33a5f5bab10512296
3+
md5=b87baf9857489d7a70f5d9bee8322b64
4+
cksum=3781755388
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
4fa9c1c33b69fc6c3b948e9df3f7688b61b70589
1+
0779dd250ceb081a3a116c34a0a6b732de215bdf

src/sage/matrix/matrix_modn_dense_double.pyx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# distutils: include_dirs = CBLAS_INCDIR
55
# distutils: extra_compile_args = -D_XPG6
66
r"""
7-
Dense matrices over `\ZZ/n\ZZ` for `n < 2^{23}` using LinBox's ``Modular<double>``
7+
Dense matrices over `\ZZ/n\ZZ` for `n < 94906266` using LinBox's ``Modular<double>``
88
99
AUTHORS:
1010
@@ -38,7 +38,7 @@ from sage.libs.linbox.fflas cimport \
3838
ctypedef Poly1Dom[ModField, Dense] ModDensePolyRing
3939

4040
# Limit for LinBox Modular<double>
41-
MAX_MODULUS = 2**23
41+
MAX_MODULUS = 94906266
4242

4343
from sage.rings.finite_rings.integer_mod cimport IntegerMod_int64
4444

@@ -47,11 +47,11 @@ include "matrix_modn_dense_template.pxi"
4747

4848
cdef class Matrix_modn_dense_double(Matrix_modn_dense_template):
4949
r"""
50-
Dense matrices over `\ZZ/n\ZZ` for `n < 2^{23}` using LinBox's ``Modular<double>``
50+
Dense matrices over `\ZZ/n\ZZ` for `n < 94906266` using LinBox's ``Modular<double>``
5151
5252
These are matrices with integer entries mod ``n`` represented as
5353
floating-point numbers in a 64-bit word for use with LinBox routines.
54-
This allows for ``n`` up to `2^{23}`. By default, the analogous
54+
This allows for ``n`` up to `94906266`. By default, the analogous
5555
``Matrix_modn_dense_float`` class is used for smaller moduli, specifically
5656
for ``n`` up to `2^{8}`.
5757
@@ -70,7 +70,7 @@ cdef class Matrix_modn_dense_double(Matrix_modn_dense_template):
7070
<class 'sage.rings.finite_rings.integer_mod.IntegerMod_int64'>
7171
"""
7272
self._get_template = self._base_ring.zero()
73-
# note that INTEGER_MOD_INT32_LIMIT is ceil(sqrt(2^31-1)) < 2^23
73+
# note that INTEGER_MOD_INT32_LIMIT is ceil(sqrt(2^31-1)) < 94906266
7474
self._fits_int32 = ((<Matrix_modn_dense_template>self).p <= INTEGER_MOD_INT32_LIMIT)
7575

7676
cdef void set_unsafe_int(self, Py_ssize_t i, Py_ssize_t j, int value):

src/sage/matrix/matrix_space.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ def get_matrix_class(R, nrows, ncols, sparse, implementation):
166166
sage: get_matrix_class(Zmod(2**30), 2, 2, False, 'linbox-double')
167167
Traceback (most recent call last):
168168
...
169-
ValueError: 'linbox-double' matrices can only deal with order < 8388608
169+
ValueError: 'linbox-double' matrices can only deal with order < 94906266
170170
171171
sage: type(matrix(SR, 2, 2, 0))
172172
<class 'sage.matrix.matrix_symbolic_dense.Matrix_symbolic_dense'>
@@ -617,7 +617,8 @@ def __init__(self, base_ring, nrows, ncols, sparse, implementation):
617617
618618
- ``linbox-float`` - for integer mod rings up to `2^8 = 256`
619619
620-
- ``linbox-double`` - for integer mod rings up to `2^23 = 8388608`
620+
- ``linbox-double`` - for integer mod rings up to
621+
`floor(2^26*sqrt(2) + 1/2) = 94906266`
621622
622623
- ``numpy`` - for real and complex floating point numbers
623624

0 commit comments

Comments
 (0)