Karim Belabas on Fri, 10 Jun 2005 11:56:17 +0200


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

Re: dumb question about rationals


* Vincent Torri [2005-06-09 14:43]:
> my program is almost working. But in some cases, i got the error message:
> 
> impossible assignment i-->s
> 
> it occurs when i try to get the value of the denominator of a rational. 
> the rational type is 4 and the denominator type is 1.
> 
> when could this error appear ?
> 
> another question: what i do is the following :
> 
> 1) i allocate 2 arrays of gen (with malloc), say t1, t2
> 2) i init the 2 arrays
> 3) i do my stuff (a loop) :
>   a) i fill t2 with modified values of t1
>   b) t1 = t2 (i do a loop on k : t1[k] = t2[k])
> 4) store the values of t1, at the end of the loop
> 5) I free the 2 arrays.
> 
> Could the problem above (it appears in step 4) arise from the fact that I 
> use allocated arrays and I'm doing step 3)b) ? Should I use PARI vector 
> instead of arrays 
> ?

Hi, sorry for the late answer (thx for handling this Bill !)

  you should check out the "User's guide to the PARI library" in 2.2.10 or
current CVS: the libpari documentation has been much improved in recent
PARI distributions (and is now separate from the User's guide to GP). In
particular, most of the low-level interface is now encapsulated in simpler
constructors, and the important issues (e.g. garbage collecting) are
explained in a hopefully less confusing way.

Cheers,

    Karim.
-- 
Karim Belabas                     Tel: (+33) (0)1 69 15 57 48
Dep. de Mathematiques, Bat. 425   Fax: (+33) (0)1 69 15 60 19
Universite Paris-Sud              http://www.math.u-psud.fr/~belabas/
F-91405 Orsay (France)            http://pari.math.u-bordeaux.fr/  [PARI/GP]