Karim BELABAS on Wed, 22 Apr 1998 16:52:09 +0200

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

Re: Missing API in PARI?

(I more or less lost net access for a while. I'm catching up now)

Ilya Zakharevich wrote:
> 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

The (major) restriction is that the whole expression is processed at one
time and not piecewise. i.e in your example above "a[2]", "=" and "7"
are processed in the same function. And we also have the op= constructs to
take care of.

This is more an oversight than anything else. The function responsible for
all that (matrix_block in anal.c) can (and should) be neatly broken in many
smaller pieces (where to copy the object?, what's the RHS ?, what operator
to call on LHS+RHS ?, etc.). 

This is easy and I will do that sooner or later (but right now, I'm trying
to put together the next alpha...).

Karim Belabas                     e-mail: belabas@math.u-psud.fr
Universite Paris Sud              tel: (00 33) 01 69 15 57 48
Dep. de Mathematiques (bat. 425)
F-91405 Orsay