On Nov 8, 10:46 pm, John Voight <[EMAIL PROTECTED]> wrote:
> Hello all,
Hi John,
>
> Check this out:
>
> sage: def stupid_function(n):
> ....: Z_F = NumberField(x^2-x-1, 't').maximal_order()
> ....: for i in range(n):
> ....: Z_F([5,1])
> ....:
> sage: prun stupid_function(10^4)
>
> Ordered by: internal time
>
> ncalls tottime percall cumtime percall
> filename:lineno(function)
> 30000 1.527 0.000 2.299 0.000
> polynomial_element_generic.py:520(__init__)
> 80000 1.011 0.000 1.189 0.000 rational_field.py:
> 120(__call__)
> 10000 0.993 0.000 7.056 0.001 number_field.py:
> 1086(_coerce_non_number_field_element_in)
> 40000 0.974 0.000 1.462 0.000 free_module.py:
> 494(__call__)
> 480000 0.959 0.000 0.959 0.000 {isinstance}
> 40000/30000 0.859 0.000 3.747 0.000 polynomial_ring.py:
> 167(__call__)
> 10000 0.514 0.000 2.477 0.000 free_module.py:
> 3078(echelon_coordinates)
> 20000 0.511 0.000 1.767 0.000 {method
> 'linear_combination_of_rows' of 'sage.matrix.matrix0.Matrix' objects}
> 40000 0.443 0.000 1.980 0.000 free_module.py:
> 2804(__call__)
> 10000 0.428 0.000 1.198 0.000 maps.py:52(__call__)
> 10000 0.334 0.000 0.770 0.000
> polynomial_element_generic.py:873(list)
> 40000 0.326 0.000 0.523 0.000
> polynomial_element_generic.py:783(degree)
> 10000 0.317 0.000 12.564 0.001 order.py:703(__call__)
> 10000 0.214 0.000 3.312 0.000 free_module.py:
> 3393(echelon_coordinate_vector)
> 10000 0.204 0.000 3.777 0.000 free_module.py:
> 579(__contains__)
> 20000 0.192 0.000 0.580 0.000
> polynomial_element_generic.py:586(__getitem__)
> 100000 0.182 0.000 0.182 0.000 {method 'parent' of
> 'sage.structure.element.Element' objects}
> 10000 0.167 0.000 0.196 0.000 {method '_coefficients'
> of
> 'sage.rings.number_field.number_field_element_quadratic.NumberFieldElement_quadratic'
> objects}
> 20000 0.163 0.000 7.296 0.000 number_field.py:
> 1004(__call__)
> 30000 0.146 0.000 0.146 0.000 {method 'list' of
> 'sage.modules.free_module_element.FreeModuleElement' objects}
> 10000 0.144 0.000 0.742 0.000
> polynomial_element_generic.py:726(_mul_)
> 40000 0.138 0.000 0.138 0.000 {method 'Polrev' of
> 'sage.libs.pari.gen.gen' objects}
> 50000 0.131 0.000 0.131 0.000 free_module.py:
> 820(degree)
> 40000 0.115 0.000 0.115 0.000 {method 'poldegree' of
> 'sage.libs.pari.gen.gen' objects}
> 30000 0.114 0.000 0.175 0.000 singular.py:
> 1131(is_SingularElement)
> 60000 0.103 0.000 0.103 0.000
> {sage.structure.element.is_Element}
> 30000 0.093 0.000 0.093 0.000 {hasattr}
> 10000 0.087 0.000 0.173 0.000 free_module.py:
> 154(FreeModule)
> 40000 0.083 0.000 0.083 0.000 {max}
> 50000 0.083 0.000 0.083 0.000 {method 'base_ring' of
> 'sage.structure.parent_base.ParentWithBase' objects}
>
> Woah! Can someone explain to me the various calls above? I'd think
> this should take epsilon time to coerce the elements of the sequence.
> Or perhaps is there another better way to coerce into Z_F (or,
> equivalently for me, F)?
>
There is without a doubt something fishy going on with coercion. See
also malb's report with polynomial rings at
http://www.sagetrac.org/sage_trac/ticket/1046
> Thanks!
>
> Yours,
>
> John Voight
Cheers,
Michael
> Assistant Professor of Mathematics
> University of Vermont
> [EMAIL PROTECTED]
> [EMAIL PROTECTED]://www.cems.uvm.edu/~voight/
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/
-~----------~----~----~----~------~----~------~--~---