#11684: Obtaining coefficients of polynomials over finite fields is extremely 
slow
----------------------------------------+-----------------------------------
   Reporter:  johanbosman               |          Owner:  tbd                  
     
       Type:  defect                    |         Status:  positive_review      
     
   Priority:  major                     |      Milestone:  sage-4.7.2           
     
  Component:  performance               |       Keywords:  polynomials, finite 
fields
Work_issues:                            |       Upstream:  N/A                  
     
   Reviewer:  Simon King, Johan Bosman  |         Author:  Johan Bosman, Simon 
King  
     Merged:                            |   Dependencies:  #11685               
     
----------------------------------------+-----------------------------------

Old description:

> If we have a polynomial over a finite field and we want to obtain its
> coefficients, then there seems to be a lot of conversion overhead.  It is
> a lot slower than multiplying such polynomials:
> {{{
> sage: K.<a> = GF(5^3)
> sage: P = PolynomialRing(K, 'x')
> sage: f = P.random_element(100)
> sage: timeit('f.list()')
> 5 loops, best of 3: 115 ms per loop
> sage: timeit('f * f')
> 625 loops, best of 3: 794 µs per loop
> }}}
>
> If, on the other hand, we do not use NTL, then we can obtain the
> coefficient list without any delays, though in that case multiplication
> is a lot slower:
> {{{
> sage: P = PolynomialRing(K, 'x', implementation='not NTL')
> sage: f = P(f)
> sage: timeit('f.list()')
> 625 loops, best of 3: 968 ns per loop
> sage: timeit('f * f')
> 25 loops, best of 3: 12.3 ms per loop
> }}}
> This performance issue occurs in both 4.7 and 4.7.1.rc1.

New description:

 If we have a polynomial over a finite field and we want to obtain its
 coefficients, then there seems to be a lot of conversion overhead.  It is
 a lot slower than multiplying such polynomials:
 {{{
 sage: K.<a> = GF(5^3)
 sage: P = PolynomialRing(K, 'x')
 sage: f = P.random_element(100)
 sage: timeit('f.list()')
 5 loops, best of 3: 115 ms per loop
 sage: timeit('f * f')
 625 loops, best of 3: 794 µs per loop
 }}}

 If, on the other hand, we do not use NTL, then we can obtain the
 coefficient list without any delays, though in that case multiplication is
 a lot slower:
 {{{
 sage: P = PolynomialRing(K, 'x', implementation='not NTL')
 sage: f = P(f)
 sage: timeit('f.list()')
 625 loops, best of 3: 968 ns per loop
 sage: timeit('f * f')
 25 loops, best of 3: 12.3 ms per loop
 }}}
 This performance issue occurs in both 4.7 and 4.7.1.rc1.

 ----

 Apply
  1. [attachment:trac_11684_coefficient_speedup.patch]
  1. [attachment:trac_11684_list_speedup.patch]
 to the Sage library.

--

Comment(by leif):

 Make someone review #11685... ;-)

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