#16116: Multiplication of dense cyclotomic matrices should be faster
-------------------------------------------------+-------------------------
       Reporter:  jipilab                        |        Owner:
           Type:  enhancement                    |       Status:  new
       Priority:  major                          |    Milestone:  sage-6.4
      Component:  number fields                  |   Resolution:
       Keywords:  cyclotomic field, matrix,      |    Merged in:
  multiplication, benchmark, days57              |    Reviewers:
        Authors:                                 |  Work issues:
Report Upstream:  N/A                            |       Commit:
         Branch:                                 |     Stopgaps:
   Dependencies:                                 |
-------------------------------------------------+-------------------------

Comment (by tscrim):

 We also have a related issue:
 {{{
 sage: R = CyclotomicField(12)
 sage: M = matrix.random(R, 40,40)
 sage: N = matrix.random(R, 3, 3)
 sage: %time K = M.tensor_product(N)
 CPU times: user 5.75 s, sys: 28.4 ms, total: 5.78 s
 Wall time: 5.73 s
 sage: R.defining_polynomial()
 x^4 - x^2 + 1
 sage: type(M)
 <type 'sage.matrix.matrix_cyclo_dense.Matrix_cyclo_dense'>

 sage: R = NumberField(x^4 - x^2 + 1, 'a')
 sage: M = matrix.random(R, 40,40)
 sage: N = matrix.random(R, 3, 3)
 sage: %time K = M.tensor_product(N)
 CPU times: user 225 ms, sys: 16.4 ms, total: 241 ms
 Wall time: 232 ms
 sage: type(M)
 <type 'sage.matrix.matrix_generic_dense.Matrix_generic_dense'>
 }}}
 Where the issue is coming from having a scalar times a matrix. Here's some
 profiling info of doing it over the cyclotomic field:
 {{{
    594202    1.806    0.000    3.620    0.000
 number_field.py:9200(_element_constructor_)
    594202    0.816    0.000    1.171    0.000
 number_field.py:6628(_coerce_non_number_field_element_in)
   4184691    0.569    0.000    0.569    0.000 {isinstance}
 }}}
 This is nowhere to be found when doing it over the number field. (For very
 small matrices this isn't a problem per se, but it still is visible when
 profiling.)

 So my conclusion is that we are doing something wrong with how we handle
 multiplication with cyclotomics in the matrix versus our generic dense
 cases.

--
Ticket URL: <http://trac.sagemath.org/ticket/16116#comment:14>
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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to