#7587: improve multi_polynomial_libsingular exponent method
---------------------------+------------------------------------------------
   Reporter:  ylchapuy     |       Owner:  AlexGhitza        
       Type:  enhancement  |      Status:  positive_review   
   Priority:  major        |   Milestone:                    
  Component:  algebra      |    Keywords:                    
Work_issues:               |      Author:  Yann Laigle-Chapuy
   Upstream:  N/A          |    Reviewer:                    
     Merged:               |  
---------------------------+------------------------------------------------
Changes (by SimonKing):

  * status:  needs_review => positive_review


Comment:

 Hi Yann!

 First good new: The patch cleanly applies to sage-4.3.alpha0.

 Second good news: Using regular expressions (as explained
 [http://groups.google.com/group/sage-
 devel/browse_thread/thread/20e0fc8f5c5be582 here]) seem to still be faster
 in my applications:
 {{{
 sage: Vars = ['x_'+str(n) for n in range(50)]+['y'+str(n) for n in
 range(50)]
 sage: R = PolynomialRing(QQ,Vars)
 sage: RE = re.compile('([a-zA-Z0-9]+)_([0-9]+)\^?([0-9]*)')
 sage: p = R.random_element()
 sage: p *= R.random_element()
 sage: p *= R.random_element()
 sage: p *= R.random_element()
 sage: p *= R.random_element()
 sage: p *= R.random_element()
 sage: L = [(Vars[i],e) for i,e in
 enumerate(p.lm().exponents(as_ETuples=False)[0][:50]) if e]
 sage: L
 [('x_0', 1),
  ('x_2', 1),
  ('x_4', 1),
  ('x_5', 2),
  ('x_10', 1),
  ('x_42', 1),
  ('x_47', 1)]
 sage: RE.findall(str(p.lm()))
 [('x', '0', ''),
  ('x', '2', ''),
  ('x', '4', ''),
  ('x', '5', '2'),
  ('x', '10', ''),
  ('x', '42', ''),
  ('x', '47', '')]
 sage: timeit('L = RE.findall(str(p.lm()))')
 625 loops, best of 3: 25.1 µs per loop
 sage: timeit('L = [(Vars[i],e) for i,e in
 enumerate(p.lm().exponents(as_ETuples=False)[0][:50]) if e] ')
 625 loops, best of 3: 11.2 µs per loop
 }}}

 I can also confirm that the computation time with the
 {{{as_ETuples=False}}} option is reduced by 90%. So, I can give it a
 positive review.

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