#7581: use prCopyR to coerce multivariate polynomials in the simple case
-----------------------------------+----------------------------------------
   Reporter:  malb                 |       Owner:  malb           
       Type:  enhancement          |      Status:  needs_work     
   Priority:  major                |   Milestone:  sage-4.3       
  Component:  commutative algebra  |    Keywords:                 
Work_issues:                       |      Author:  Martin Albrecht
   Upstream:  N/A                  |    Reviewer:                 
     Merged:                       |  
-----------------------------------+----------------------------------------
Changes (by newvalueoldvalue):

 * cc: SimonKing (added)
  * status:  new => needs_work
  * author:  => Martin Albrecht


Comment:

 The attached patch makes things slightly faster.

 '''Before'''
 {{{
 sage: R1 = PolynomialRing(QQ,'x',10001,order='lex')
 sage: R2 = PolynomialRing(QQ,'x',10002,order='deglex')
 sage: x10000 = R1('x10000')
 sage: %time a = R2(x10000)
 CPU times: user 5.77 s, sys: 0.18 s, total: 5.95 s
 Wall time: 7.54 s
 sage: %time a = R2(x10000)
 CPU times: user 5.43 s, sys: 0.00 s, total: 5.43 s
 Wall time: 5.59 s

 sage: x10001 = R2('x10001')
 sage: %time x10000 + x10001
 CPU times: user 16.87 s, sys: 0.00 s, total: 16.87 s
 Wall time: 17.05 s
 x10000 + x10001
 sage: %time x10000 + x10001
 CPU times: user 5.43 s, sys: 0.00 s, total: 5.43 s
 Wall time: 5.49 s
 x10000 + x10001
 }}}

 '''After'''
 {{{
 sage: R1 = PolynomialRing(QQ,'x',10001,order='lex')
 sage: R2 = PolynomialRing(QQ,'x',10002,order='deglex')
 sage: x10000 = R1('x10000')
 sage: %time a = R2(x10000)
 CPU times: user 1.18 s, sys: 0.16 s, total: 1.34 s
 Wall time: 1.36 s
 sage: %time a = R2(x10000)
 CPU times: user 0.87 s, sys: 0.00 s, total: 0.87 s
 Wall time: 0.92 s

 sage: x10001 = R2('x10001')
 sage: %time x10000 + x10001
 CPU times: user 7.67 s, sys: 0.00 s, total: 7.67 s
 Wall time: 7.77 s
 x10000 + x10001
 sage: %time x10000 + x10001
 CPU times: user 0.86 s, sys: 0.00 s, total: 0.87 s
 Wall time: 0.91 s
 x10000 + x10001
 }}}

 I haven't run doctests yet.

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