On Fri, Jun 1, 2012 at 10:59 AM, Jeroen Demeyer <jdeme...@cage.ugent.be> wrote:

> Looks like an infinite recursion, leading to stack exhaustion, leading
> to a SIGSEGV:

I agree with the last two but not the first.  I think it's just a
really long LazyBinop chain, which is why I was having trouble
debugging the problematic part of polynomial_element.pyx:

        elif (d < 4 or d > 50000) and self._compiled is None:
            while i >= 0:
                result = result * a + self[i]
                i -= 1

Even putting in print statements triggered "unlazification", or
whatever the word is (evaluation?), which blew the stack.  For
example:

-----
from sage.rings.real_lazy import LazyBinop

def loop(n):
    x = RealLazyField()(1)
    for i in xrange(n):
        x = LazyBinop(RLF, x, x, operator.mul)
-----

produces

sage: loop(10)
sage: loop(100)
sage: loop(1000)
sage: loop(10000)
sage: loop(100000)
sage: loop(1000000)
/home/mcneil/sagedev/sage-5.1.beta1/spkg/bin/sage: line 326:  8729
Segmentation fault      (core dumped) sage-ipython "$@" -i


Doug

PS:

Side issue #1: evaluating LazyBinops  is *really* slow as soon as
there get to be more than a few terms.

Side issue # 2: it looks weird to me that we loop over every item in
the polynomial list rather than over every coefficient in the elif
branch I quoted above.  Having lots of zeroes is a pretty common use
case, I'd've thought.

-- 
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
URL: http://www.sagemath.org

Reply via email to