On 09/13/2017 04:53 PM, oldk1331 wrote:
> I see the stack exhausted in sbcl 1.3.21 after a long time,
> it happens in 'critBonD' of GroebnerInternalPackage.

Wow! That was quick. I'd be happy to learn how exactly you could locate
the problematic function.

> That's a recursion function and not tail recursion, and stack
> do get deeper than 20000 nested function calls.

Well, but then there must still have been a change from sbcl 1.2.4 to
1.3.15 (also 1.2.16 doesn't) work with current trunk) that does not
allow such a recursion depth anymore.

> I rewrite it using loop, and the result returns in 800s, #(gb) is 8536.
> (on 2.3GHz 6300HQ, and I was printing #(D))

> diff --git a/src/algebra/gbintern.spad b/src/algebra/gbintern.spad
> index 0003336b..d79579c8 100644
> --- a/src/algebra/gbintern.spad
> +++ b/src/algebra/gbintern.spad
> @@ -196,11 +196,11 @@ GroebnerInternalPackage(Dom, Expon, VarSet,
> Dpol) : T == C where
>               --- erase elements in D fullfilling crit B
> 
>     critBonD(h : Dpol, D : List(critPair))==
> -         empty?(D) => []
> -         x := first(D)
> -         critB(degree(h), x.lcmfij, degree(x.poli), degree(x.polj)) =>
> -           critBonD(h, rest(D))
> -         cons(x, critBonD(h, rest(D)))
> +       res : List(critPair) := []
> +       for x in D repeat
> +         if not critB(degree(h), x.lcmfij, degree(x.poli), degree(x.polj)) 
> then
> +            res := cons(x, res)
> +       reverse! res

Cool. But why not defining

   critBonD(h : Dpol, D : List(critPair))==
       d := degree(h)
       [x for x in D | not critB(d, x.lcmfij, degree(x.poli),
degree(x.polj))]

?

Anyway, thanks for digging that deep.

Ralf

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to