Please try it with https://trac.sagemath.org/ticket/25476; the specialized 
_echbelon_in_place_classical code might not have been getting called. (Note 
also that it has also become a cpdef method, and IIRC, those don't get 
separated as a separate function call by %prun when called from within a 
cdef class.)

However, is there an overall speed regression in the test? Can you try it 
on the same machine against 8.3.beta2 and post the total time?

Thanks,
Travis


On Tuesday, June 5, 2018 at 3:25:54 AM UTC+10, Nils Bruin wrote:
>
> I suspect some of the changes to matrix construction recently merged might 
> need some fine tuning.
>
> With the code on
>
> https://trac.sagemath.org/ticket/15113 
> <https://www.google.com/url?q=https%3A%2F%2Ftrac.sagemath.org%2Fticket%2F15113&sa=D&sntz=1&usg=AFQjCNGspoG49DNZjoJovOy7-5dkp30P4w>
>
> I ran the following example:
>
> load("picard_group.sage")
> n=4
> k.<a>=GF(41)
> R.<x,y,z>=k[]
> F=x^3*y+x^3*z+x^2*y^2+x^2*y*z+x^2*z^2+x*y^2*z+x*y*z^2+y^3*z+y*z^3
> I=plane_curve(F)
> Z=I.zeros(n)[1]
> L=[I.point(l,n) for l in [ 0, 1, 0 ],[ 0, 0, 1 ],[ -1, 0, 1 ],[ 1, 0, 0 
> ],[ -1, 1, 0 ]]
> G=[l+L[0]-(L[0]+L[0]) for l in L[1:]]
> [42*g == Z for g in G]
> %prun _=10^30*G[1]
>
> (not on the same machine, so getting a real idea of the impact would need 
> some further benchmarking)
>
> sage 8.2 on a Intel(R) Xeon(R) CPU E5-2660 0 @ 2.20GHz
>       552    0.134    0.000    0.165    0.000 {method 
> 'right_kernel_matrix' of 
> 'sage.matrix.matrix_modn_dense_float.Matrix_modn_dense_template' objects}
>      1071    0.106    0.000    0.126    0.000 {method 'echelonize' of 
> 'sage.matrix.matrix_modn_dense_float.Matrix_modn_dense_template' objects}
>      1212    0.097    0.000    0.213    0.000 <string>:74(mumat)
>      6760    0.036    0.000    0.065    0.000 
> matrix_space.py:438(__classcall__)
>      6396    0.032    0.000    0.036    0.000 {method '__copy__' of 
> 'sage.matrix.matrix_modn_dense_float.Matrix_modn_dense_template' objects}
>      7608    0.024    0.000    0.073    0.000 matrix_space.py:1681(matrix)
>       276    0.018    0.000    0.425    0.002 <string>:97(mu_preimage)
>      6760    0.017    0.000    0.024    0.000 
> matrix_space.py:108(get_matrix_class)
>     25943    0.015    0.000    0.015    0.000 {isinstance}
>      4350    0.015    0.000    0.015    0.000 {resource.getrusage}
>      4350    0.014    0.000    0.034    0.000 misc.py:199(cputime)
>      1071    0.013    0.000    0.030    0.000 {method 'row' of 
> 'sage.matrix.matrix1.Matrix' objects}
>       135    0.013    0.000    0.191    0.001 <string>:82(mu_space_product)
>      1212    0.013    0.000    0.029    0.000 {method 
> '_matrices_from_rows' of 
> 'sage.matrix.matrix_modn_dense_float.Matrix_modn_dense_template' objects}
>      1071    0.012    0.000    0.029    0.000 {method 'submatrix' of 
> 'sage.matrix.matrix_modn_dense_float.Matrix_modn_dense_template' objects}
>
>
> sage 8.3b0 on a Intel(R) Core(TM) i7-2600 CPU @ 3.40GHz
>      7608    0.110    0.000    0.118    0.000 matrix_space.py:771(__call__)
>       552    0.102    0.000    0.161    0.000 {method 
> 'right_kernel_matrix' of 
> 'sage.matrix.matrix_modn_dense_float.Matrix_modn_dense_template' objects}
>      2402    0.099    0.000    0.252    0.000 matrix_space.py:473(__init__)
>      1071    0.080    0.000    0.094    0.000 {method 'echelonize' of 
> 'sage.matrix.matrix_modn_dense_float.Matrix_modn_dense_template' objects}
>      1212    0.051    0.000    0.212    0.000 <string>:74(mumat)
>    142738    0.044    0.000    0.044    0.000 {isinstance}
>      7880    0.041    0.000    0.333    0.000 
> matrix_space.py:437(__classcall__)
>       276    0.030    0.000    0.635    0.002 <string>:97(mu_preimage)
>      2402    0.024    0.000    0.024    0.000 {hasattr}
>    112894    0.023    0.000    0.053    0.000 category.py:749(<genexpr>)
>      7880    0.018    0.000    0.025    0.000 
> matrix_space.py:107(get_matrix_class)
>      2402    0.013    0.000    0.046    0.000 
> modules.py:112(__classcall_private__)
>       560    0.011    0.000    0.047    0.000 
> matrix_space.py:936(_get_action_)
>      4350    0.011    0.000    0.023    0.000 misc.py:199(cputime)
>       135    0.010    0.000    0.172    0.001 <string>:82(mu_space_product)
>      1071    0.010    0.000    0.023    0.000 {method 'row' of 
> 'sage.matrix.matrix1.Matrix' objects}
>      1212    0.010    0.000    0.103    0.000 {method 
> '_matrices_from_rows' of 
> 'sage.matrix.matrix_modn_dense_float.Matrix_modn_dense_template' objects}
>      2402    0.010    0.000    0.062    0.000 {any}
>      4350    0.009    0.000    0.009    0.000 {resource.getrusage}
>      1071    0.008    0.000    0.078    0.000 {method 'submatrix' of 
> 'sage.matrix.matrix_modn_dense_float.Matrix_modn_dense_template' objects}
>      2402    0.008    0.000    0.019    0.000 fields.py:62(__contains__)
>
> As you can see, the __call__ in matrix_space has gone from a minor 
> contributor to being the dominant cost, overtaking "echelonize" by a 
> significant margin (one would expect "echelonize" to take the most time in 
> these computations).
>
> I think a careful analysis of the regression in "matrix_space" and 
> hopefully a signifcant improvement is warranted. I know that previously 
> great care was taken to *defer* expensive parent initialization on matrices 
> exactly because there are common scenarios where a lot of matrices are 
> constructed without them having to interact with parents all that much. 
> That was a very useful optimization, and I would hope we can reestablish 
> the capability to do efficient matrix algebra (on lots of smallish 
> matrices).
>

-- 
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 https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to