Karim BELABAS on Tue, 8 Jan 2002 15:59:14 +0100 (MET)


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: two bugs in 2.2.0


On Sun, 23 Dec 2001, Ilya Zakharevich wrote:
> First, since local() is not known as a function name, having it
> misplaced from the leading position leads to a very confusing message:
>
> ? xx() = if(1,,); local(y); 2
> ? xx
>   ***   expected character: '=' instead of: if(1,,);local(y);2
>                                                             ^--

I'll fix this.  I can make it so that local() anywhere within the function
body is accepted as if it had come first. It would be nice but very tough to
have a truly local scope for variables [ e.g within a for loop ]. It would
probably be easier to dump the whole parser and use the yacc code from gp2c.

> Second, is the following working as expected?  I do not think that
> such simple polynomials would require something as drastic as this:
>
>   ones(N) = (t^N - 1)/(t - 1)
>   allocatemem(132*1024^2)
>   p = 3456; ones(3*p-1) % ones(p)
>
> runs out of memory (and is quite slow if not).

The current implantation is geared (I dare not say optimized) towards number
field computations. When degrees are large (here 10000...), it needs a
disastrous amount of memory (quadratic!), besides using a naïve (quadratic)
algorithm.

It can be easily be improved conceptually, but it requires some work in
practice. At least, I can increase garbage collection but it will slow down
things in small degrees. I'll benchmark it just in case the penalty is small.

> BTW, I see that the documentation mentions a message "deep
> recursion".  Did not find it in PARI sources.

Look for STACK_CHECK in the code [ the crucial test is in
language/anal.c:identifier() ]

> Could not get it, neigher on Solaris, nor on OS/2.  What gives?

Configure needs to be able to detect the getrlimit() is available on your
system (STACK_CHECK is then defined in paricfg.h). Anything funny in your man
pages ?

This is on Solaris 2.8:

(15:49) gp > trap()
(15:49) gp > dive(n) = dive(n+1)
(15:50) gp > dive(0)
  ***   deep recursion: dive(n+1)
                        ^---------
  ***   Starting break loop (type 'break' to go back to GP)
> n
7122

    Karim.
-- 
Karim Belabas                    Tel: (+33) (0)1 69 15 57 48
Dép. de Mathematiques, Bat. 425  Fax: (+33) (0)1 69 15 60 19
Université Paris-Sud             Email: Karim.Belabas@math.u-psud.fr
F-91405 Orsay (France)           http://www.math.u-psud.fr/~belabas
--
PARI/GP Home Page: http://www.parigp-home.de/