I haven't looked at the underlying code, but my impression is that this sort of thing is unavoidable to some extent.
MatrixSpace(QQ['t'], 8).random_element() has the option of using relatively well optimised underlying code for elements of QQ['t']. MatrixSpace(QQ['t'].fraction_field(), 8).random_element() might use generic code for elements of QQ['t'].fraction_field(). Sebastian Pancratz wrote some very fast basic code for rational function fields by representing the elements as quotients of flint integer polynomials: http://www.pancratz.org/code.html It probably isn't being used here (though I haven't checked). Bill. On Apr 29, 5:54 pm, Pierre <pierre.guil...@gmail.com> wrote: > Dear all, > > Not sure if this is for sage-devel or sage-support. Here's a > 'benchmark' which I find stunning: > > sage: A= MatrixSpace(QQ['t'], 8).random_element() > sage: %time B= A*A > CPU times: user 0.04 s, sys: 0.00 s, total: 0.04 s > Wall time: 0.04 s > > sage: C= MatrixSpace(QQ['t'].fraction_field(), 8).random_element() > sage: %time D= C*C > CPU times: user 17.28 s, sys: 0.19 s, total: 17.48 s > Wall time: 17.57 s > > Is something wrong ? 17 seconds instead of 0.04 ? 400 times slower ? > is it my particular system ? is there an option perhaps for performing > the computations without simplifying the fractions, or something ? > > (of course this came up in an example more interesting than squaring > random matrices...) > > It is my humble opinion that this issue is serious. Rational fractions > tend to be all over the place in formal computations. > > any thoughts ? > thanks > pierre > > -- > To post to this group, send an email to sage-devel@googlegroups.com > To unsubscribe from this group, send an email to > sage-devel+unsubscr...@googlegroups.com > For more options, visit this group athttp://groups.google.com/group/sage-devel > URL:http://www.sagemath.org -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org