On Nov 26, 2009, at 1:16 AM, Simon King wrote: > Hi Robert! > > On Nov 26, 8:43 am, Robert Bradshaw <rober...@math.washington.edu> > wrote: >> On Nov 26, 2009, at 12:35 AM, Florent Hivert wrote: >>> Though this could be improved by using a similar trick than >>> doubling the size of a list when appending element, I'm not sure >>> that's what we want. >> >> I think this makes perfect sense...I'm actually surprised it's not >> implemented that way already. > > That's impossible.
Over-allocating the number of generators ahead of time whenever you need more to achieve O(log(n)) rather than O(n) ring enlargements for n used variables (where n is, of course, not know ahead of time) seems easy enough to me. > The whole point of InfinitePolynomialRing is that you do *not* know in > advance how many variables you will eventually need. Its main purpose > is to compute Groebner bases of so-called Symmetric Ideals, and during > such computation it may very well be that the number of variables > increases during computation. > > And then, as I mentioned in my previous post, there is the problem > that in some cases you will use only very few variables, although the > indices may be very large and, again, you don't know in advance *what* > indices you will need. This is why there is a non-default sparse > implementation. > >>> In the mean time. I have the following workaround: Just start by >>> declaring your last variable: > > Or start summation with the highest index, which has the same effect. > Or use *symbolic* variables right away, since this is what Nathann > needed anyway. I'm clearly not following you--I thought the point was that one didn't know ahead of time the highest index. - Robert -- 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