#14888: Make FiniteField_pari_ffelt the default for generic finite fields
-------------------------------------------+-------------------------------
       Reporter:  pbruin                   |        Owner:  cpernet
           Type:  enhancement              |       Status:  needs_work
       Priority:  major                    |    Milestone:  sage-5.12
      Component:  finite rings             |   Resolution:
       Keywords:  FiniteField performance  |    Merged in:
        Authors:  Peter Bruin              |    Reviewers:  Jean-Pierre
Report Upstream:  N/A                      |  Flori
         Branch:                           |  Work issues:
   Dependencies:  #12142                   |       Commit:
                                           |     Stopgaps:
-------------------------------------------+-------------------------------

Comment (by jdemeyer):

 The first problem is in the following code:
 {{{
         elif isinstance(x, int) or isinstance(x, long):
             g = (<pari_gen>self._parent._gen_pari).g
             sig_on()
             x_GEN = stoi(x)
             self.construct(INT_to_FFELT(g, x_GEN))
 }}}
 The Python `long` type doesn't convert to a C `long` (confusingly, a `C`
 long corresponds to a Python `int`).

 To see the problem on 64 bits (let this inspire a doctest):
 {{{
 sage: GF(7^20, 'a')(long(2^63))
 ---------------------------------------------------------------------------
 OverflowError                             Traceback (most recent call
 last)
 <ipython-input-18-d85771ca8953> in <module>()
 ----> 1 GF(Integer(7)**Integer(20), 'a')(long(Integer(2)**Integer(63)))

 /mazur/release/merger/sage-5.12.beta4/local/lib/python2.7/site-
 packages/sage/structure/parent.so in sage.structure.parent.Parent.__call__
 (sage/structure/parent.c:8372)()

 /mazur/release/merger/sage-5.12.beta4/local/lib/python2.7/site-
 packages/sage/structure/coerce_maps.so in
 sage.structure.coerce_maps.DefaultConvertMap_unique._call_
 (sage/structure/coerce_maps.c:3856)()

 /mazur/release/merger/sage-5.12.beta4/local/lib/python2.7/site-
 packages/sage/structure/coerce_maps.so in
 sage.structure.coerce_maps.DefaultConvertMap_unique._call_
 (sage/structure/coerce_maps.c:3757)()

 /mazur/release/merger/sage-5.12.beta4/local/lib/python2.7/site-
 packages/sage/rings/finite_rings/finite_field_pari_ffelt.pyc in
 _element_constructor_(self, x)
     499             return x
     500         else:
 --> 501             return self.element_class(self, x)
     502
     503     def _coerce_map_from_(self, R):

 /mazur/release/merger/sage-5.12.beta4/local/lib/python2.7/site-
 packages/sage/rings/finite_rings/element_pari_ffelt.so in
 
sage.rings.finite_rings.element_pari_ffelt.FiniteFieldElement_pari_ffelt.__init__
 (sage/rings/finite_rings/element_pari_ffelt.c:2975)()

 /mazur/release/merger/sage-5.12.beta4/local/lib/python2.7/site-
 packages/sage/rings/finite_rings/element_pari_ffelt.so in
 
sage.rings.finite_rings.element_pari_ffelt.FiniteFieldElement_pari_ffelt.construct_from
 (sage/rings/finite_rings/element_pari_ffelt.c:3341)()

 OverflowError: Python int too large to convert to C long
 }}}

--
Ticket URL: <http://trac.sagemath.org/ticket/14888#comment:6>
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