-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Fast functions on integers. -- -- Fast functions for number theory and combinatorics with a high level -- of safety guaranteed by ATS. This package also provides a -- Storable instance for GMP's mpz type. @package fast-arithmetic @version 0.2.3.0 -- | This module defines a storable instance for GMP's mpz integer -- type. module Data.GMP -- | The GMP integer type holds information about array size as well as a -- pointer to an array. data GMPInt GMPInt :: !Word32 -> !Word32 -> !(Ptr Word64) -> GMPInt -- | Number of limbs allocated. [_mp_alloc] :: GMPInt -> !Word32 -- | Number of limbs used. [_mp_size] :: GMPInt -> !Word32 -- | Pointer to an array containing the limbs. [_mp_d] :: GMPInt -> !(Ptr Word64) -- | Convert a GMP mpz to Haskell's Integer type. gmpToInteger :: GMPInt -> IO Integer conjugateGMP :: (CInt -> Ptr GMPInt) -> Int -> IO Integer instance Foreign.Storable.Storable Data.GMP.GMPInt -- | This provides a few facilities for working with common combinatorial -- functions. module Numeric.Combinatorics -- | See here. choose :: Int -> Int -> IO Integer -- | See here. doubleFactorial :: Int -> IO Integer -- | The nth Catalan number, with indexing beginning at -- 0. See here. -- --
-- λ:> mapM catalan [0..9] -- [1,1,2,5,14,42,132,429,1430,4862] --catalan :: Int -> IO Integer factorial :: Int -> IO Integer -- | This module provides a fast primality check. module Numeric.Integer -- | O(√n) isPrime :: Int -> Bool -- | Indexed starting at 0. This function is slower on small -- values but faster on large values. fibonacci :: Int -> IO Integer -- | This module provides fast number theoretic functions when possible. module Numeric.NumberTheory -- | Euler totient function. totient :: Int -> Int -- | Number of distinct divisors. tau :: Int -> Int littleOmega :: Int -> Int -- | See here isPerfect :: Int -> Bool -- | Sum of proper divisors. sumDivisors :: Int -> Int -- | Pure Haskell functions. These tend to be more general than the -- equivalents in ATS. module Numeric.Pure -- | See here. -- --
-- λ:> fmap derangement [0..10] :: [Integer] -- [1,0,1,2,9,44,265,1854,14833,133496,1334961] --derangement :: (Integral a) => Int -> a hsIsPrime :: (Integral a) => a -> Bool hsDoubleFactorial :: (Integral a) => a -> a hsChoose :: (Integral a) => a -> a -> a hsTotient :: (Integral a) => a -> a hsTau :: (Integral a) => a -> Int hsTotientSum :: (Integral a) => a -> a hsLittleOmega :: (Integral a) => a -> Int hsIsPerfect :: (Integral a) => a -> Bool hsSumDivisors :: (Integral a) => a -> a hsCatalan :: (Integral a) => a -> a hsFibonacci :: (Integral a) => Int -> a hsFactorial :: (Integral a) => a -> a