Bill Allombert on Sun, 09 Dec 2018 15:00:06 +0100


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

Re: [BUG 2.5.0–CURRENT] taille() and taille2() are mixed up in pariold.h


On Sat, Dec 08, 2018 at 02:15:17PM +0100, Bill Allombert wrote:
> On Fri, Dec 07, 2018 at 08:23:36PM -0800, Ilya Zakharevich wrote:
> > P.S.  My conjecture now is that the major missing part is “How to make
> >       «type=I» and «type=E» arguments”.  (But, as I explained above, I
> >       cannot check that “the rest” is working already…) 
> > 
> >       Suppose I have a C function
> >         GEN mysummand(GEN I, void *mydata);
> >       It is completely unclear how can I make out of it something to
> >       pass to (e.g.) somme() to make an analogue of
> >         sum(I=1,3,mysummand(I))
> 
> Hello Ilya,
> 
> To help you to upgrade, I join a program that should do what you want.

I need to add: in a lot of case you can avoid this by caling either the
corresponding wrapper function or use the iterators.

The wrappers are for the protocode "E":

For example for apply(), we provide
GEN genapply(void *E, GEN (*f)(void* E, GEN x), GEN x)

For intnum:
GEN intnum(void *E, GEN (*eval)(void*, GEN), GEN a, GEN b, GEN tab, long prec)
etc.

For the protocode "I" we provide iterators:
For forvec:
forvec_init/forvec_next
For forprime
forprime_init/forprime_next
etc.

They are meant to be used this way:
For forvec(X = v,seq,{flag = 0}):

    forvec_t iter;
    forvec_init(&iter, v, flag);
    GEN X;
    while ((X = forvec_next(&iter)))
    {
      seq
    }

Cheers,
Bill