Hi Martin!

On 1 Dez., 19:02, Martin Albrecht <m...@informatik.uni-bremen.de>
wrote:
> Hi there,
>
> the following code is really, really really (REALLY!) slow:

Well, the default implementation creates a polynomial ring with 10000
variables in the background when you say x[10000], and another ring
with 10001 variables if you then say x[10001].

My original motivation for the InfinitePolynomialRings was the
computation of Symmetric Gröbner Bases. But from a couple of recent
posts I learn that people use it for different applications. And for
these applications, the sparse implementation might be better. So,
perhaps one should change the default?

Anyway, it is not slow at all when doing it sparsely:

sage: IP = InfinitePolynomialRing(QQ,implementation='sparse')
sage: x = IP.gen()
sage: x10000 = x[10000]
sage: %time 1/2*x10000
CPU times: user 0.00 s, sys: 0.02 s, total: 0.02 s
Wall time: 0.04 s
1/2*x10000
sage: timeit('y=1/2*x10000')
625 loops, best of 3: 133 µs per loop

Here, you just have one variable in the background:

sage: x10000.polynomial().parent()
Univariate Polynomial Ring in x10000 over Rational Field

So, who votes for changing the default?

Cheers,
Simon

-- 
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

Reply via email to