Karim Belabas on Fri, 21 Sep 2012 14:39:06 +0200


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

Re: forprime


* Charles Greathouse [2012-09-20 15:21]:
> > forfactored() is also interesting [ since one can quickly emulate
> > forsquarefree(), fordisc(), etc. from this one ].
> >
> > Do you already have code for it ?
> 
> No, unfortunately.
> 
> I guess basic code wouldn't be too hard to write, and even though it
> would be inefficient compared to optimized code it would be orders of
> magnitude faster than running a for-loop with factor (to say nothing
> of the case where you fail to write your own arithmetic functions and
> end up factoring each number more than once, like sum(n=1,1e7,
> sigma(n)+eulerphi(n)) ). Would you like me to take a whack at it?
> 
> It's a pity that many of the arithmetic functions use map_proto_G,
> since that blocks the obvious path to "doing the right thing" with
> 
> f = factor(BIGNUMBER);
> sigma(f)*eulerphi(f)

No longer.

We decided during the last "Atelier PARI" to remove the ability to apply
arithmetic function to t_MAT, specifically with the above application
in mind: being able to repreÑent integers via their factorization
matrix and not through some obscure new ad hoc data type.

We also agreed to leave transcendental functions as they stand, and to
still allow t_VEC / t_COL with their current meaning. It is true that 
these constructions are rather useless, now that we have apply(), but
there's no need to potentially break scripts without a specific
application in mind. (We could apply transcendental functions to
square matrices with their usual mathematical meanings instead of
current componentwise computation, but nobody ever requested this... :-)

Cheers,

    K.B.
--
Karim Belabas, IMB (UMR 5251)  Tel: (+33) (0)5 40 00 26 17
Universite Bordeaux 1          Fax: (+33) (0)5 40 00 69 50
351, cours de la Liberation    http://www.math.u-bordeaux1.fr/~belabas/
F-33405 Talence (France)       http://pari.math.u-bordeaux1.fr/  [PARI/GP]
`