On Jan 24, 2008 12:03 PM, Joel B. Mohler <[EMAIL PROTECTED]> wrote: > > Hi, > > A long time ago I noticed a comment in the prod function about doing a > divide-and-conquer product scheme so as to take advantage of asymptotically > fast > multiplication. Ironically, at the time I thought it was a pretty esoteric > idea > which would only be useful in bizarre cases. But, I've been bit by the exact > same problem with *addition* and the python sum function. > > I have a list of n! monomials (arising from a symmetric group) and addition > in a > (sparse) mpoly ring over QQ is evidently asymptotically fast. This makes some > sense since the data structure is an ordered list of monomials (in singular). > Using the python sum function took 4 times as long as splitting the list into > 4 > pieces and sum'ming each of these sub-lists individually. > > Questions: Would it be accepted to write a sum function and replace python's? > Is there a better way to fix this asymptotic slowness on the part of sum?
The sum in Python is very sensible for general applications. Note that Robert Bradshaw implemented a _very_ nice divide and conquer version of the prod function now in Sage -- check it out. It might be trivial to adapt it to your purposes. All that said, there isn't a single case I'm aware of where doing "from sage.all import *" overwrites something that is standard in Python -- we don't overwrite range, we don't overwrite int, etc., We don't overwrite anything. I think this is a good precedent to uphold. Maybe you could just call your sum something else. -- William --~--~---------~--~----~------------~-------~--~----~ 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://www.sagemath.org -~----------~----~----~----~------~----~------~--~---