#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.13
      Component:  finite rings       |   Resolution:
       Keywords:  FiniteField        |    Merged in:
  performance                        |    Reviewers:  Jean-Pierre Flori,
        Authors:  Peter Bruin        |  Jeroen Demeyer
Report Upstream:  N/A                |  Work issues:
         Branch:                     |       Commit:
   Dependencies:  #12142, #15124,    |     Stopgaps:
  #15125                             |
-------------------------------------+-------------------------------------

Comment (by jdemeyer):

 Replying to [comment:32 pbruin]:
 > > > In the line `ret = ret + c`, could you replace `c` by `base(c)`
 > > With that change, I no longer get the error (which unfortunately
 doesn't imply that the bug is fixed).
 > Mysterious.  I checked that the coercion system does exactly the same
 thing internally
 How did you check? I think it's more and more likely that the coercion
 system is the problem here, because

 1) The coercion system is notorious for generating hard-to-reproduce bugs
 since it relies on (hashes of) memory addresses.

 2) Making the conversions explicit (see diff below) fixes the problem.
 {{{
 #!diff
 diff --git a/sage/libs/singular/singular.pyx
 b/sage/libs/singular/singular.pyx
 --- a/sage/libs/singular/singular.pyx
 +++ b/sage/libs/singular/singular.pyx
 @@ -232,9 +232,9 @@
          c = <long>napGetCoeff(z)
          e = napGetExpFrom(z,1, _ring)
          if e == 0:
 -            ret = ret + c
 +            ret = ret + base(c)
          elif c != 0:
 -            ret = ret  + c * a**e
 +            ret = ret  + (a**e) * base(c)
          z = <napoly*>pNext(<poly*>z)
      return ret

 }}}

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