#10752: Matrix pivots are cached, should be immutable
------------------------------+---------------------------------------------
   Reporter:  rbeezer         |       Owner:  jason, was   
       Type:  defect          |      Status:  needs_work   
   Priority:  minor           |   Milestone:  sage-4.7     
  Component:  linear algebra  |    Keywords:  matrix pivots
     Author:  John Palmieri   |    Upstream:  N/A          
   Reviewer:                  |      Merged:               
Work_issues:                  |  
------------------------------+---------------------------------------------
Changes (by jhpalmieri):

  * status:  needs_review => needs_work


Comment:

 Right now I'm leaning away from the current patch and perhaps toward the
 tuple approach.  If I add a keyword (which I called "safe" so as not to
 conflict with the "copy" function):
 {{{
 sage: A = random_matrix(QQ, 100)
 sage: timeit('A.pivots(safe=True)')
 625 loops, best of 3: 6.38 µs per loop
 sage: timeit('A.pivots(safe=False)')
 625 loops, best of 3: 3.13 µs per loop
 sage: timeit('A.pivots(safe=False)')
 }}}
 Whereas if I use tuples as output (via another modification of the current
 patch):
 {{{
 sage: A = random_matrix(QQ, 100)
 sage: timeit('A.pivots(use_tuple=False)')
 625 loops, best of 3: 3.14 µs per loop
 sage: timeit('A.pivots(use_tuple=True)')
 625 loops, best of 3: 3.55 µs per loop

 sage: timeit('A = random_matrix(QQ, 100); A.pivots(use_tuple=False)')
 25 loops, best of 3: 22.2 ms per loop
 sage: timeit('A = random_matrix(QQ, 100); A.pivots(use_tuple=True)')
 25 loops, best of 3: 22.2 ms per loop
 }}}
 I suppose using tuples may cause a slow-down in other places, but the
 "pivots" method gets slowed down by maybe 10%, as opposed to copying the
 list, which doubles the time.

 I'm marking this as "needs work" because I'm not happy with the slowdown
 in the current patch.

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