Bill Allombert on Mon, 17 Sep 2012 22:58:14 +0200


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

Re: forprime


On Mon, Sep 17, 2012 at 10:21:03PM +0200, Karim Belabas wrote:
> * Bill Allombert [2012-09-17 18:50]:
> > I feel concerned because I will have to write dedicated code for GP2C to
> > handle it...
> 
> How much dedicated code ? I intended to add a few more loop constructs to GP: 
> 
>   - forstepprime()    [ loop over primes in an arithmetic progression ]
>   - forprimepowers()  [ loop over prime powers ]
> 
> How costly would these be ? (The first one is already in master, only not
> exported to GP yet.)
> 
> Those are (much) more useful than forcomposite(), although I thought it didn't
> hurt to have the latter. Since it's non-trivial to write properly...

There are basically two way to do it: either libpari provides
forcomposite_init/forcomposite_next or GP2C inlines the code of forcomposite
using forprime_init/forprime_next for each usage of forcomposite. Both of them
require a significant amount of coding.

It is still hard to imagine an application of forcomposite() where performances
matter.

Cheers,
Bill.