#12292: charpoly is recomputed when called with a different variable
-------------------------------+--------------------------------------------
   Reporter:  zimmerma         |          Owner:  jason, was      
       Type:  enhancement      |         Status:  needs_review    
   Priority:  minor            |      Milestone:  sage-5.0        
  Component:  linear algebra   |       Keywords:  sd35.5          
Work_issues:                   |       Upstream:  N/A             
   Reviewer:  Paul Zimmermann  |         Author:  Michael Orlitzky
     Merged:                   |   Dependencies:                  
-------------------------------+--------------------------------------------

Comment(by rbeezer):

 A few comments from Review Days:

   1.  For a matrix A, you can examine A._cache directly.  Instead of doing
 timings, might it be better to check the cached value before and after the
 second request (the one with a new variable specified)?  A return value
 with the new variable and a cached value with the original variable would
 strike me as sufficient evidence, and superior to using timings in a
 doctest.
   1.  In poking around with this it appears that the algorithm name is
 part of the cache key in some instances, while there are places (eg
 determinant computations) that just check for the "charpoly" cache key.
   1.  Applies on 5.0-beta8, FWIW.

 {{{
 sage: A = random_matrix(QQ, 3)
 sage: A.charpoly()
 x^3 + x^2 + 3*x - 13
 sage: A._cache
 {'clear_denom': ([ 1  0 -2]
 [-2 -1 -2]
 [ 0  2 -1], 1), 'charpoly_linbox': x^3 + x^2 + 3*x - 13}
 sage: A.charpoly('t')
 t^3 + t^2 + 3*t - 13
 sage: A._cache
 {'clear_denom': ([ 1  0 -2]
 [-2 -1 -2]
 [ 0  2 -1], 1), 'charpoly_linbox': x^3 + x^2 + 3*x - 13}
 sage: A._cache['charpoly_linbox']
 x^3 + x^2 + 3*x - 13
 }}}

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