#10763: Speedup of  matrix multiplication
------------------------------+---------------------------------------------
   Reporter:  SimonKing       |       Owner:  jason, was           
       Type:  enhancement     |      Status:  needs_review         
   Priority:  major           |   Milestone:  sage-4.6.2           
  Component:  linear algebra  |    Keywords:  matrix multiplication
     Author:  Simon King      |    Upstream:  N/A                  
   Reviewer:                  |      Merged:                       
Work_issues:                  |  
------------------------------+---------------------------------------------
Changes (by newvalueoldvalue):

  * status:  new => needs_review
  * author:  => Simon King


Comment:

 I did not run the doc test yet, but I think it already ready for review.

 Here are timings. Note that the reduced overhead is most visible when the
 multiplication itself is trivial.

 Without the patch:
 {{{
 sage: def test(M):
 ....:     for i in xrange(10^6):
 ....:         M*=M
 ....:     return M
 ....:
 sage: m = matrix(GF(3),[[1]])
 sage: %time test(m)
 CPU times: user 51.36 s, sys: 0.16 s, total: 51.52 s
 Wall time: 51.67 s
 [1]
 sage: m = matrix(GF(2),[[1]])
 sage: %time test(m)
 CPU times: user 39.16 s, sys: 0.20 s, total: 39.36 s
 Wall time: 39.47 s
 [1]
 sage: m = matrix(ZZ,[[1]])
 # apparently there is no overhead for matrices over ZZ
 sage: %time test(m)
 CPU times: user 7.81 s, sys: 0.15 s, total: 7.96 s
 Wall time: 7.99 s
 [1]
 }}}

 With the patch
 {{{
 sage: def test(M):
 ....:     for i in xrange(10^6):
 ....:         M*=M
 ....:     return M
 ....:
 sage: m = matrix(GF(3),[[1]])
 sage: %time test(m)
 CPU times: user 33.65 s, sys: 0.30 s, total: 33.95 s
 Wall time: 34.05 s
 [1]
 sage: m = matrix(GF(2),[[1]])
 sage: %time test(m)
 CPU times: user 25.41 s, sys: 0.10 s, total: 25.51 s
 Wall time: 25.58 s
 [1]
 sage: m = matrix(ZZ,[[1]])
 sage: %time test(m)
 CPU times: user 7.62 s, sys: 0.16 s, total: 7.78 s
 Wall time: 7.80 s
 [1]
 }}}

 Thus, over `GF(3)` and `GF(2)` the overhead is clearly reduced.

 I don't know how the patch could be doc-tested, as it only concerns the
 performance.

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