Karim BELABAS on Sun, 19 Jan 2003 10:55:50 +0100 (MET)


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

Re: how to free pari's memory


On Sat, 18 Jan 2003, Ramón Casero Cañas wrote:
> Karim BELABAS wrote:
>
>>On Thu, 16 Jan 2003, Ramón Casero Cañas wrote:
>
>>Anyway, if you want to use PARI, then remove it completely [ not a good idea
>>if you do this more than once : it involves a very significant overhead ],
>>you have to do it by hand:
>>
>>  void freeall(void);
>>  void pari_sig_init(void (*f)(int));
>>
>>  freeall();
>>  if (INIT_SIG) pari_sig_init(SIG_DFL);
>
> Um, I don't know whether I have undestood you completely. Do you mean that I
> have to add the to first declarations at the beginning of the file where the
> function with PARI is used, and then just copy & paste the other two before
> the return of the function? So freeall() and pari_sig_init() are both
> compiled in the library, but there's no declaration included from "pari.h",
> aren't they?

Quite right.

Good luck,

    Karim.

P.S:
> I'm with Bill in that it would be nice to be able to use the PARI system as
> a secondary system, like most libraries allow. But it's just an idea.

It is possible, but non-trivial if we want a small overhead. Many
non-obvious initializations are nevertheless necessary, e.g we need prime
numbers for polynomial arithmetic and linear algebra [ Chinese remaindering ],
full parser setup to interpret lisexpr() calls [ currently needed by MPQS for
instance ].

It is cumbersome to perform partial initializations, remember, and extend
them whenever needed. I'll think about it.

In any case, it is easy to document the above two calls. In fact, to
encapsulate them in a nicer way [ pari_uninit() ? ].

NB: For your original example (dim. 128 matrix over F_2), I'd expect that
loading the library takes more time than inverting the matrix [at least
using the u_* routine...]
-- 
Karim Belabas                    Tel: (+33) (0)1 69 15 57 48
Dép. de Mathématiques, Bât. 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/