Additional functions of GMP

GMP has a lot of functions, such as extracting roots, primality test, Legendre symbol, factorial and so on. These can be written in Haskell, of course, but isn't it better to use existing functions? They are also much faster than similar functions from NumericPrelude, I believe. I have heard GHC 7.2.1 now includes module named GHC.Integer.Logarithms, but I can't find its description anywhere. So, my question is: can I use full power of GMP's functions, and if I can — how?

On Thursday 11 August 2011, 14:06:21, Artyom Kazak wrote:
GMP has a lot of functions, such as extracting roots, primality test, Legendre symbol,
I'm writing a package (arithmoi) that will include reasonably fast implementations of those, but I never find the time to finish it :(
factorial and so on. These can be written in Haskell, of course, but isn't it better to use existing functions?
Not necessarily. But
They are also much faster than similar functions from NumericPrelude, I believe.
There's that.
I have heard GHC 7.2.1 now includes module named GHC.Integer.Logarithms, but I can't find its description anywhere.
http://haskell.org/ghc/docs/7.2.1/html/libraries/integer-gmp-0.3.0.0/GHC- Integer-Logarithms.html
So, my question is: can I use full power of GMP's functions, and if I can — how?
No, you can't, unfortunately (not easily, anyway).

I'm writing a package (arithmoi) that will include reasonably fast implementations of those, but I never find the time to finish it :(
Package is great, but sometimes it is useful to have such functions out of box (for example, when solving SPOJ problems).
No, you can't, unfortunately (not easily, anyway).
I have found a manual on including additional primops in GHC (exactly this situation), but this requires modifying GHC's sources, which also does not allow using them with SPOJ.
participants (2)
-
Artyom Kazak
-
Daniel Fischer