Ilya Zakharevich on Wed, 22 Apr 1998 21:00:10 +0200


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

Re: Missing API in PARI? (fwd)


Forwarded message:
> > From the calculator you can set
> > 
> >      a[2] = 7
> >      aa[2,] = [4,5,6]
> >      aa[,3] = [7,8]~
> >      aa[2,3] = 4
> > 
> > Is it possible to do it from PARI?
> 
> No. And in 2.0, the reason is not the following anymore:
> 
> > Note that in the above examples the calculator makes some assumptions
> > about layout of a and aa in memory (these assumptions are valid for
> > data created by calculator).
> 
> > so it may be that in order to create such an API one may need to
> > introduce an additional flag and mark GENs which are created in
> > consequent chunks as such...
> (in fact this is exactly what I've done in 2.0: CLONEBIT is set to denote
> an object cloned out of the stack. Thus you can change an entry in a
> complicated structure without copying the whole thing as used to be the
> case)

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.

Ilya