#15220: Vector_modn_dense used for too large a modulus?
------------------------------+-----------------------------
   Reporter:  mmezzarobba     |            Owner:
       Type:  defect          |           Status:  new
   Priority:  major           |        Milestone:  sage-5.12
  Component:  linear algebra  |         Keywords:
  Merged in:                  |          Authors:
  Reviewers:                  |  Report Upstream:  N/A
Work issues:                  |           Branch:
     Commit:                  |     Dependencies:
   Stopgaps:                  |
------------------------------+-----------------------------
 `sage.rings.finite_rings.integer_mod?` says that `IntegerMod_int64` "is
 used if the modulus is less than `2^{31}-1`".

 Consider however a vector of elements of `GF(p)` with `p` between 2^31^
 and 2^32^:

 {{{
 sage: K = GF(3037000493)
 sage: v = vector(K, [42])
 sage: type(v)
 <type 'sage.modules.vector_modn_dense.Vector_modn_dense'>
 }}}

 Then:
 {{{
 sage: type(v[0])
 <type 'sage.rings.finite_rings.integer_mod.IntegerMod_int64'>
 }}}
 which breaks some operations:
 {{{
 sage: ~v[0]
 ---------------------------------------------------------------------------
 ZeroDivisionError                         Traceback (most recent call
 last)
 <ipython-input-5-43d86000256e> in <module>()
 ----> 1 ~v[Integer(0)]

 /home/marc/co/sage/local/lib/python2.7/site-
 packages/sage/rings/finite_rings/integer_mod.so in
 sage.rings.finite_rings.integer_mod.IntegerMod_int64.__invert__
 (sage/rings/finite_rings/integer_mod.c:29992)()

 /home/marc/co/sage/local/lib/python2.7/site-
 packages/sage/rings/finite_rings/integer_mod.so in
 sage.rings.finite_rings.integer_mod.mod_inverse_int64
 (sage/rings/finite_rings/integer_mod.c:30920)()

 ZeroDivisionError: Inverse does not exist.
 }}}

 This does not happens with modular integers themselves:
 {{{
 sage: type(K(42))
 <type 'sage.rings.finite_rings.integer_mod.IntegerMod_gmp'>
 sage: ~K(42)
 2241595602
 }}}
 Matrices do not seem affected either.

 Things work fine with sage-5.8 on the same machine. This makes me suspect
 that the issue might have been introduced in
 aa83d6e996d552dfa871f510b1bc9af6f1127076 (#14627)—but I didn't check.

--
Ticket URL: <http://trac.sagemath.org/ticket/15220>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to