On Wed, Jul 15, 2009 at 5:03 AM, Martin Albrecht<m...@informatik.uni-bremen.de> wrote: > >> For the ring of polynomials with coefficients over ZZ: >> >> ---------------------------------------------------------------------- >> >> | Sage Version 4.1, Release Date: 2009-07-09 | >> | Type notebook() for the GUI, and license() for information. | >> >> ---------------------------------------------------------------------- >> sage: K.<x> = ZZ["x"] >> sage: f = 2*x^2 + 3*x + 1 >> sage: %timeit power_mod(f, 10, 24) >> 10000 loops, best of 3: 93.7 µs per loop > > This is about 5x slower than the native way using FLINT's zmod_poly on my > machine: > > sage: K.<x> = ZZ["x"] > sage: f = 2*x^2 + 3*x + 1 > sage: %timeit power_mod(f, 10, 24) > 10000 loops, best of 3: 104 µs per loop > > sage: P.<x> = PolynomialRing(Zmod(24)) > sage: f = 2*x^2 + 3*x + 1 > sage: %timeit f**10 > 100000 loops, best of 3: 19.3 µs per loop > > Cheers, > Martin
That's not surprising given what power_mod does. Do power_mod?? to see. It's generic code that does the arithmetic in the parent ring, then calls mod after each multiply. so in the above first example, zmod_poly is never used. So this sounds to me like a good opportunity to improve power_mod in some cases! -- William --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---