#11257: Avoid a coercion when computing an element to the power of 0
---------------------------+------------------------------------------------
   Reporter:  nborie       |          Owner:  nborie                        
       Type:  enhancement  |         Status:  needs_review                  
   Priority:  major        |      Milestone:  sage-4.7.1                    
  Component:  performance  |       Keywords:  coercion, element, power, zero
Work_issues:               |       Upstream:  N/A                           
   Reviewer:               |         Author:                                
     Merged:               |   Dependencies:                                
---------------------------+------------------------------------------------
Changes (by nborie):

  * status:  new => needs_review


Comment:

 With the patch applied, same tests give:
 {{{
 sage: K = CyclotomicField(46)
 sage: z = K.gen()
 sage: %prun z^0
          2 function calls in 0.000 CPU seconds

    Ordered by: internal time

    ncalls  tottime  percall  cumtime  percall filename:lineno(function)
         1    0.000    0.000    0.000    0.000 <string>:1(<module>)
         1    0.000    0.000    0.000    0.000 {method 'disable' of
 '_lsprof.Profiler' objects}

 sage: %prun z^3
          2 function calls in 0.000 CPU seconds

    Ordered by: internal time

    ncalls  tottime  percall  cumtime  percall filename:lineno(function)
         1    0.000    0.000    0.000    0.000 <string>:1(<module>)
         1    0.000    0.000    0.000    0.000 {method 'disable' of
 '_lsprof.Profiler' objects}
 }}}
 And
 {{{
 sage: timeit('z^0')
 625 loops, best of 3: 1.01 µs per loop
 sage: timeit('z^3')
 625 loops, best of 3: 7.68 µs per loop
 }}}

 We will see what the builbot will say. What pass, what crash ....

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11257#comment:1>
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to