#4973: [with patch, needs review] rewrite the function __getitem__ in 
matrix0.pyx
to support slices better, negative indices, and be faster
----------------------+-----------------------------------------------------
 Reporter:  mabshoff  |        Owner:  jason   
     Type:  defect    |       Status:  assigned
 Priority:  major     |    Milestone:  sage-3.3
Component:  misc      |   Resolution:          
 Keywords:            |  
----------------------+-----------------------------------------------------
Comment (by jason):

 Okay, pt3 fixes the regression.  Here are my new timings:

 {{{
 AFTER PATCH:

 sage: m=[(1, -2, -1, -1,9), (1, 8, 6, 2,2), (1, 1, -1, 1,4), (-1, 2, -2,
 -1,4)];M= matrix(m)
 sage: timeit('M[[1,2],[0,1,2]]')
 625 loops, best of 3: 167 µs per loop
 sage: timeit('M[[1,2],[0,1,2]]')
 625 loops, best of 3: 168 µs per loop
 sage: timeit('M[[1,2],[0,1,2]]')
 625 loops, best of 3: 166 µs per loop


 BEFORE PATCH:

 sage: m=[(1, -2, -1, -1,9), (1, 8, 6, 2,2), (1, 1, -1, 1,4), (-1, 2, -2,
 -1,4)];M= matrix(m)
 sage: timeit('M[[1,2],[0,1,2]]')
 625 loops, best of 3: 134 µs per loop
 sage: timeit('M[[1,2],[0,1,2]]')
 625 loops, best of 3: 138 µs per loop
 sage: timeit('M[[1,2],[0,1,2]]')
 625 loops, best of 3: 143 µs per loop
 }}}

 So we're faster than the original code again.

 Great job. Positive review, with the doctest fix that I'm going to post in
 a second.  I presume that mabshoff will run all doctests on it to make
 sure that there are no errors in other code because of the additional
 capabilities.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/4973#comment:14>
Sage <http://sagemath.org/>
Sage - Open Source Mathematical Software: Building the Car Instead of 
Reinventing the Wheel
--~--~---------~--~----~------------~-------~--~----~
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