#8096: Speed up parent creation for multiplication of square matrices
------------------------------+---------------------------------------------
   Reporter:  boothby         |       Owner:  boothby     
       Type:  defect          |      Status:  needs_review
   Priority:  minor           |   Milestone:              
  Component:  linear algebra  |    Keywords:              
     Author:                  |    Upstream:  N/A         
   Reviewer:                  |      Merged:              
Work_issues:                  |  
------------------------------+---------------------------------------------

Comment(by SimonKing):

 Replying to [comment:4 boothby]:

 > You'll note that the 32.5µs is matrix-by-matrix, whereas the 142ns is
 element-by-element.  Before my patch, the matrix-by-matrix time was 101µs.
 I'd like the 32.5µs to go away, but I don't know how much of that would be
 possible, at the moment.

 OK, then it is an improvement. I hope to be able to do some refereeing
 later today or tomorrow.

 Anyway, I still wonder why basic matrix operations in Sage tend to be so
 slow. I mean, do any complicated operations with parents happen behind the
 scenes? By "slow", I mean "compared with MeatAxe matrices as provided by
 my cohomology spkg":

 {{{
 sage: from pGroupCohomology.mtx import MTX
 sage: F = GF(3)
 sage: A = random_matrix(F,3)
 sage: B = random_matrix(F,3)
 sage: a = MTX(3,[list(r) for r in A.rows()])
 sage: b = MTX(3,[list(r) for r in B.rows()])
 sage: timeit("C=A*B")
 625 loops, best of 3: 99.6 µs per loop
 sage: timeit("c=a*b")
 625 loops, best of 3: 1.01 µs per loop
 sage: a*b == MTX(3,[list(r) for r in C.rows()])
 True
 sage: A = random_matrix(F,100)
 sage: B = random_matrix(F,100)
 sage: a = MTX(3,[list(r) for r in A.rows()])
 sage: b = MTX(3,[list(r) for r in B.rows()])
 sage: timeit("C=A*B")
 125 loops, best of 3: 2.43 ms per loop
 sage: timeit("c=a*b")
 625 loops, best of 3: 376 µs per loop
 sage: a*b == MTX(3,[list(r) for r in C.rows()])
 True
 }}}

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