Karim BELABAS on Mon, 27 Apr 1998 11:57:02 +0200


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

Re: Missing API in PARI? (fwd)


> > [Ilya:]
> > > No, this is not what I had in mind.  (At least in 1.36 or around)
> > > calculator knows that aa[2,4] is placed after aa[2,3], so one can find
> > > the allocation size of aa[2,3] by subtracting addresses of aa[2,4] and
> > > aa[2,3].  If the size of aa[2,3] is big enough (bigger than size
> > > needed to store 4 in the above example ;-), the calculator will write
> > > GEN(4) in the chunk of memory occupied by aa[2,3] - without reallocing
> > > aa.
> [Me:]
> > 
> > Not anymore. This was cancelled a long time ago (around 1.38) since it led to
> > a HUGE number of fatal errors (SIGBUS mostly) in perfectly valid (and
> > previously working) scripts. Basically, it only worked under some additional
> > conditions on the _values_ themselves (non-recursive ones were always ok).
[Ilya:]
> You mean that there was a way to put a vector into a variable so that
> it the components do not occupy consequent chunks of memory?  

No there was not. (There is now... to avoid useless copies in loops). I think
the problem was that you ended up with garbage within your vectors (when you
replaced a component with a smaller one) and gerepile could not cope with it.

Anyway, even if all went well, you could only fill an array element-wise in
O(n) when all elements had the same size as the original ones. (For instance
initializing an array with 0s and replacing them by practically anything else
took O(n^2)). The present mechanism is completely independant of the new
values.

Karim.
--
Karim Belabas                     e-mail: belabas@math.u-psud.fr
Dep. de Mathematiques, Bat. 425
Universite Paris-Sud              Tel: (33 1) 01 69 15 57 48
F-91405 ORSAY                     Fax: (33 1) 01 69 15 60 19