Hi,

I posted a ticket this morning about some profiling I did on product of 
matrices (see http://trac.sagemath.org/ticket/16116). Here is a minimal 
example:

sage: PR=PolynomialRing(QQ,[x])
> sage: I=Ideal(x^2 - 1/2*x - 1/4) 

sage: Q=PR.quotient(I) 

sage: elmt_uni=matrix(Q,[[-2*x, 1, 6*x + 2],[-2*x, 2*x, 4*x + 1],[0,0,1]]) 

sage: %timeit elmt_uni*elmt_uni 

1000 loops, best of 3: 1.46 ms per loop  
>

> sage: CF.<F>=CyclotomicField(2*5) 

sage: f5=(F+~F)/2 

sage: m=matrix(CF,[[-2*f5, 1, 6*f5 + 2],[-2*f5, 2*f5, 4*f5 + 1],[0,0,1]]) 

sage: type(m) <type 'sage.matrix.matrix_cyclo_dense.Matrix_cyclo_dense'> 

sage: m.parent() 
>
Full MatrixSpace of 3 by 3 dense matrices over Cyclotomic Field of order 10 
> and degree 4 

sage: %timeit m*m 100 loops, best of 3: 1.98 ms per loop
>

Both computation seems to take the same time although more complicated 
example show that the first method is faster. Then, I disactivated the 
verification on cyclotomic fields on line 962 of the file 
/src/sage/matrix/matrix_space.py to get a matrix_generic_dense instead of 
matrix_cyclo_dense.

It gives me:

sage: CF.<F>=CyclotomicField(2*5)
>
> sage: f5=(F+~F)/2 
>
> sage: m=matrix(CF,[[-2*f5, 1, 6*f5 + 2],[-2*f5, 2*f5, 4*f5 + 1],[0,0,1]]) 
>
> sage: m.parent()
>
> Full MatrixSpace of 3 by 3 dense matrices over Cyclotomic Field of order 10 
> and degree 4
>
> sage: type(m)
>
> <type 'sage.matrix.matrix_generic_dense.Matrix_generic_dense'>
>
> sage: %timeit m*m
>
> 1000 loops, best of 3: 251 µs per loop
>
>
The question is now: what is the method *_matrix_times_matrix_,* located in 
the module *matrix_cyclo_dense.pyx*, doing so that it takes so much time 
compared to the usual generic multiplication of the module 
matrix_generic_dense? Is there a known use case when the multiplication in 
matrix_cyclo_dense is faster than the generic one?

Thanks,
JPLab


-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to