Re: Perl, BigInts/BigFloats and GMP
- Original Message - From: Jonathan Leto jal...@gmail.com To: module-authors@perl.org Cc: Bob Kuo bobj...@gmail.com; Sisyphus sisyph...@optusnet.com.au Sent: Tuesday, May 12, 2009 5:45 AM Subject: Re: Perl, BigInts/BigFloats and GMP Howdy, To my extreme enjoyment, I found out that someone has already taken the burden of creating a full interface to the GMP integer functions in the form of Math::GMPz [1]. There is also Math::GMPf and Math::GMPq, in case you were wondering. Thanks for the 'cc' Jonathan. I should point out that the current handling of gmp_printf() in those modules is a bit sub-standard. I haven't fixed it up because: a) gmp_printf() is not so trivial to wrap; b) I don't personally use it and it's not apparent to me that it's of great use in a 'perl' situation; c) no one has made any requests to improve it. So - if you do access gmp_printf from one of those modules, approach it with caution. And if you'd like it fixed, let me know, and I'll attend to the matter. (In fact, I'll attend to it anyway - just let me know if you're in a hurry.) All of the other wrappings of the gmp functions ahould be in good order - of course, if you find anything that's not in good order, please let me know. Cheers, Rob
Re: Perl, BigInts/BigFloats and GMP
Howdy, To my extreme enjoyment, I found out that someone has already taken the burden of creating a full interface to the GMP integer functions in the form of Math::GMPz [1]. There is also Math::GMPf and Math::GMPq, in case you were wondering. Cheers, [1] http://search.cpan.org/dist/Math-GMPz/ On Fri, May 1, 2009 at 12:31 PM, Jonathan Leto jal...@gmail.com wrote: Howdy, I want to give Perl full access to the GMP library [1] and I am making that happen so that these routines can be used by Crypto::* and Math::* modules. The ultimate goal of this is so that the Crypt::* namespace will not depend on Math::Pari. The first step on this path is Math::Primality [2], which is involved in Google Summer of Code 2009 [3] and which will provide is_prime() and next_prime() functions for BigInts. These functions seem to be the main reason why so many crypto modules have no choice but to use Math::Pari. After is_prime() and next_prime() are implemented, many modules could in theory be ported over to Math::BigInt, but there are many routines which are currently not available from Perl in GMP that will speed up things considerably. I cannot quantify this right now, but I am willing to bet roughly an order of magnitude or two. Currently there is: Math::GMP - only a small subset of the GMP library to emulate Math::BigInt API Math::BigInt::GMP - A faster implementation of the small subset for the Math::BigInt API Math::GMP::SWIG [4] (unreleased) - A full interface to GMP via SWIG, which I was actively working on but then ran into odd memory corruption errors and has been on hold lately. My main questions to this list are: 1) Does anybody have suggestions for a name for the CPAN module which will provide the full interface to GMP? 2) What do people hate/love/want to see in the Math::BigInt API ? Currently I have been hacking in the functions that I needed into my fork of Math::BigInt::GMP on github [5], but some stuff has nothing to do with the BigInt API and just doesn't belong there. I talked to Tels (who maintains Math::BigInt and Math::BigInt::GMP) and he gave me co-maintainer status, as he said that he does not have time to maintain these modules. If any one has any other comments regarding what they would like to see in regard to scientific computing with Perl, I would love to hear it. Cheers, NOTE: Crypto modules only require BigInts, not BigFloats, so the first iteration of all this will most probably only implement the integer algorithms of GMP. [1] http://gmplib.org/ [2] http://github.com/leto/math--primality/tree/master [3] http://leto.net/dukeleto.pl/2009/04/google-announces-nine-students-in-gsoc2009-with-the-perl-fou.html [4] http://leto.net/gitweb/?p=Math-GMP-SWIG.git;a=summary [5] http://github.com/leto/math--bigint--gmp/tree/master -- Jonathan Leto jonat...@leto.net http://leto.net -- Jonathan Leto jonat...@leto.net http://leto.net
Perl, BigInts/BigFloats and GMP
Howdy, I want to give Perl full access to the GMP library [1] and I am making that happen so that these routines can be used by Crypto::* and Math::* modules. The ultimate goal of this is so that the Crypt::* namespace will not depend on Math::Pari. The first step on this path is Math::Primality [2], which is involved in Google Summer of Code 2009 [3] and which will provide is_prime() and next_prime() functions for BigInts. These functions seem to be the main reason why so many crypto modules have no choice but to use Math::Pari. After is_prime() and next_prime() are implemented, many modules could in theory be ported over to Math::BigInt, but there are many routines which are currently not available from Perl in GMP that will speed up things considerably. I cannot quantify this right now, but I am willing to bet roughly an order of magnitude or two. Currently there is: Math::GMP - only a small subset of the GMP library to emulate Math::BigInt API Math::BigInt::GMP - A faster implementation of the small subset for the Math::BigInt API Math::GMP::SWIG [4] (unreleased) - A full interface to GMP via SWIG, which I was actively working on but then ran into odd memory corruption errors and has been on hold lately. My main questions to this list are: 1) Does anybody have suggestions for a name for the CPAN module which will provide the full interface to GMP? 2) What do people hate/love/want to see in the Math::BigInt API ? Currently I have been hacking in the functions that I needed into my fork of Math::BigInt::GMP on github [5], but some stuff has nothing to do with the BigInt API and just doesn't belong there. I talked to Tels (who maintains Math::BigInt and Math::BigInt::GMP) and he gave me co-maintainer status, as he said that he does not have time to maintain these modules. If any one has any other comments regarding what they would like to see in regard to scientific computing with Perl, I would love to hear it. Cheers, NOTE: Crypto modules only require BigInts, not BigFloats, so the first iteration of all this will most probably only implement the integer algorithms of GMP. [1] http://gmplib.org/ [2] http://github.com/leto/math--primality/tree/master [3] http://leto.net/dukeleto.pl/2009/04/google-announces-nine-students-in-gsoc2009-with-the-perl-fou.html [4] http://leto.net/gitweb/?p=Math-GMP-SWIG.git;a=summary [5] http://github.com/leto/math--bigint--gmp/tree/master -- Jonathan Leto jonat...@leto.net http://leto.net