GMP

Serge D. Mechveliani mechvel at botik.ru
Thu Jun 10 07:10:24 EDT 2004


On Wed, Jun 09, 2004 at 05:14:45PM -0700, John Meacham wrote:
> I was curious what the best way would be to access the various useful
> GMP functions which are not exported for Integers. I was thinking of
> making my own (strict) Integer type, but it would be much easier if I
> can just use the FFI to import the required functions and get at the
> mpz_t inside Integers somehow. 
> 
> I am not positive, but it looks like ghc seems to have primitives which
> call the gmp functions internally rather than using the FFI.. At least I
> didn't see an obvious example poking around in the library.
> 
> Has someone already done this? a Math.Integer.Advanced (or something)
> library would be quite a useful addition to ghc.
>


Yes, advanced algebra library for Integer should be very useful.
It is a very mathematical and complex piece of Computation.

For example, my DoCon library for CA suffers of a very slow method for 
factoring large integers greater than 10^10. I cannot just 
study-do-implement all the algorithmic mathematics myself, 
it is better to port pieces from some good open-source library.
They say, there exist libraries (maybe, GMP is one of them) for Integer, 
and generally, for Algebraic numbers (also important). 
Open source libraries written in C, algorithms developed by great 
experts, like Lenstra.
The idea is just arrange an interface to GHC and join to GHC library.
I had not looked into such possibilities, so far, because deal with 
other tasks.

-----------------
Serge Mechveliani
mechvel at botik.ru










More information about the Glasgow-haskell-users mailing list