From 774924233c87a20c31a3232cbd01d9bf5170a951 Mon Sep 17 00:00:00 2001 From: Alberto Ruiz Date: Sat, 28 Jul 2007 10:44:43 +0000 Subject: a few automatic wrappers --- HSSL.cabal | 8 +- examples/tests.hs | 2 +- lib/GSL/Special.hs | 48 ++------ lib/GSL/Special/Airy.hs | 166 ++++++++++++++++++++++++++ lib/GSL/Special/Erf.hs | 93 +++++++++++++++ lib/GSL/Special/Gamma.hs | 277 ++++++++++++++++++++++++++++++++++++++++++++ lib/GSL/Special/Internal.hs | 65 +++++++++++ lib/GSL/Special/airy.h | 24 ++++ lib/GSL/Special/auto.hs | 201 ++++++++++++++++++++++++++++++++ lib/GSL/Special/erf.h | 12 ++ lib/GSL/Special/gamma.h | 43 +++++++ lib/HSSL.hs | 17 --- 12 files changed, 896 insertions(+), 60 deletions(-) create mode 100644 lib/GSL/Special/Airy.hs create mode 100644 lib/GSL/Special/Erf.hs create mode 100644 lib/GSL/Special/Gamma.hs create mode 100644 lib/GSL/Special/Internal.hs create mode 100644 lib/GSL/Special/airy.h create mode 100644 lib/GSL/Special/auto.hs create mode 100644 lib/GSL/Special/erf.h create mode 100644 lib/GSL/Special/gamma.h delete mode 100644 lib/HSSL.hs diff --git a/HSSL.cabal b/HSSL.cabal index 1377232..9859548 100644 --- a/HSSL.cabal +++ b/HSSL.cabal @@ -28,13 +28,15 @@ Exposed-modules: Data.Packed.Internal, GSL.Vector, GSL.Matrix GSL.Differentiation, GSL.Integration, - GSL.Special, + GSL.Special, GSL.Special.Internal, + GSL.Special.Gamma, GSL.Special.Erf, + GSL.Special.Airy, GSL.Fourier, GSL.Polynomials, GSL.Minimization, - LinearAlgebra, LinearAlgebra.Algorithms, GSL.Compat, - GSL, HSSL + GSL, + LinearAlgebra, LinearAlgebra.Algorithms Other-modules: C-sources: lib/Data/Packed/Internal/aux.c, lib/LAPACK/lapack-aux.c, diff --git a/examples/tests.hs b/examples/tests.hs index 66afca6..d385f2a 100644 --- a/examples/tests.hs +++ b/examples/tests.hs @@ -11,7 +11,7 @@ import Data.Packed.Internal.Matrix import GSL.Vector import GSL.Integration import GSL.Differentiation -import GSL.Special +import GSL.Special hiding (choose) import GSL.Fourier import GSL.Polynomials import LAPACK diff --git a/lib/GSL/Special.hs b/lib/GSL/Special.hs index fec96eb..01aec2b 100644 --- a/lib/GSL/Special.hs +++ b/lib/GSL/Special.hs @@ -9,25 +9,27 @@ Maintainer : Alberto Ruiz (aruiz at um dot es) Stability : provisional Portability : uses ffi -Special functions. +Wrappers for a few special functions. -} ----------------------------------------------------------------------------- module GSL.Special ( - erf, - erf_Z, + module GSL.Special.Airy, + module GSL.Special.Erf, + module GSL.Special.Gamma, bessel_J0_e, - exp_e10_e, - gamma + exp_e10_e ) where import Foreign -import Data.Packed.Internal.Common(check,(//)) +import GSL.Special.Internal +import GSL.Special.Gamma +import GSL.Special.Erf +import GSL.Special.Airy ----------------------------------------------------------------- -------------------- simple functions -------------------------- {- | The error function (/gsl_sf_erf/), defined as 2\/ \\sqrt \\pi * \int\_0\^t \\exp -t\^2 dt. @@ -46,24 +48,6 @@ foreign import ccall "gsl-aux.h gsl_sf_erf" erf :: Double -> Double -} foreign import ccall "gsl-aux.h gsl_sf_erf_Z" erf_Z :: Double -> Double -{- | The gamma function (/gsl_sf_gamma/), described in - ->> gamma 5 ->24.0 - --} -foreign import ccall "gsl-aux.h gsl_sf_gamma" gamma :: Double -> Double - ----------------------------------------------------------------- --- the sf_result struct is equivalent to an array of two doubles - -createSFR s f = unsafePerformIO $ do - p <- mallocArray 2 - f p // check "createSFR" [] - [val,err] <- peekArray 2 p - free p - return (val,err) - -------------------- functions returning sf_result ------------- {- | The regular cylindrical Bessel function of zeroth order, J_0(x). This is @@ -78,20 +62,6 @@ bessel_J0_e :: Double -> (Double,Double) bessel_J0_e x = createSFR "bessel_J0_e" (gsl_sf_bessel_J0_e x) foreign import ccall "gsl-aux.h gsl_sf_bessel_J0_e" gsl_sf_bessel_J0_e :: Double -> Ptr Double -> IO Int ---------------------------------------------------------------------- --- the sf_result_e10 contains two doubles and the exponent - -createSFR_E10 s f = unsafePerformIO $ do - let sd = sizeOf (0::Double) - let si = sizeOf (0::Int) - p <- mallocBytes (2*sd + si) - f p // check "createSFR_E10" [] - val <- peekByteOff p 0 - err <- peekByteOff p sd - expo <- peekByteOff p (2*sd) - free p - return (val,expo,err) - -------------------- functions returning sf_result_e10 ------------- {- | (From the GSL manual) \"This function computes the exponential \exp(x) using the @gsl_sf_result_e10@ type to return a result with extended range. This function may be useful if the value of \exp(x) would overflow the numeric range of double\". diff --git a/lib/GSL/Special/Airy.hs b/lib/GSL/Special/Airy.hs new file mode 100644 index 0000000..872f7c5 --- /dev/null +++ b/lib/GSL/Special/Airy.hs @@ -0,0 +1,166 @@ +------------------------------------------------------------ +{- | +Module : GSL.Special.Airy +Copyright : (c) Alberto Ruiz 2006 +License : GPL-style +Maintainer : Alberto Ruiz (aruiz at um dot es) +Stability : provisional +Portability : uses ffi + +Wrappers for selected functions described at: + + + +-} +------------------------------------------------------------ + +module GSL.Special.Airy( + Precision (..) +, airy_Ai_e +, airy_Ai +, airy_Bi_e +, airy_Bi +, airy_Ai_scaled_e +, airy_Ai_scaled +, airy_Bi_scaled_e +, airy_Bi_scaled +, airy_Ai_deriv_e +, airy_Ai_deriv +, airy_Bi_deriv_e +, airy_Bi_deriv +, airy_Ai_deriv_scaled_e +, airy_Ai_deriv_scaled +, airy_Bi_deriv_scaled_e +, airy_Bi_deriv_scaled +, airy_zero_Ai_e +, airy_zero_Ai +, airy_zero_Bi_e +, airy_zero_Bi +, airy_zero_Ai_deriv_e +, airy_zero_Ai_deriv +, airy_zero_Bi_deriv_e +, airy_zero_Bi_deriv +) where + +import Foreign(Ptr) +import GSL.Special.Internal + +-- | wrapper for int gsl_sf_airy_Ai_e(double x,gsl_mode_t mode,gsl_sf_result* result); +airy_Ai_e :: Double -> Precision -> (Double,Double) +airy_Ai_e x mode = createSFR "airy_Ai_e" $ gsl_sf_airy_Ai_e x (precCode mode) +foreign import ccall "airy.h gsl_sf_airy_Ai_e" gsl_sf_airy_Ai_e :: Double -> Gsl_mode_t -> Ptr Double -> IO(Int) + +-- | wrapper for double gsl_sf_airy_Ai(double x,gsl_mode_t mode); +airy_Ai :: Double -> Precision -> Double +airy_Ai x mode = gsl_sf_airy_Ai x (precCode mode) +foreign import ccall "airy.h gsl_sf_airy_Ai" gsl_sf_airy_Ai :: Double -> Gsl_mode_t -> Double + +-- | wrapper for int gsl_sf_airy_Bi_e(double x,gsl_mode_t mode,gsl_sf_result* result); +airy_Bi_e :: Double -> Precision -> (Double,Double) +airy_Bi_e x mode = createSFR "airy_Bi_e" $ gsl_sf_airy_Bi_e x (precCode mode) +foreign import ccall "airy.h gsl_sf_airy_Bi_e" gsl_sf_airy_Bi_e :: Double -> Gsl_mode_t -> Ptr Double -> IO(Int) + +-- | wrapper for double gsl_sf_airy_Bi(double x,gsl_mode_t mode); +airy_Bi :: Double -> Precision -> Double +airy_Bi x mode = gsl_sf_airy_Bi x (precCode mode) +foreign import ccall "airy.h gsl_sf_airy_Bi" gsl_sf_airy_Bi :: Double -> Gsl_mode_t -> Double + +-- | wrapper for int gsl_sf_airy_Ai_scaled_e(double x,gsl_mode_t mode,gsl_sf_result* result); +airy_Ai_scaled_e :: Double -> Precision -> (Double,Double) +airy_Ai_scaled_e x mode = createSFR "airy_Ai_scaled_e" $ gsl_sf_airy_Ai_scaled_e x (precCode mode) +foreign import ccall "airy.h gsl_sf_airy_Ai_scaled_e" gsl_sf_airy_Ai_scaled_e :: Double -> Gsl_mode_t -> Ptr Double -> IO(Int) + +-- | wrapper for double gsl_sf_airy_Ai_scaled(double x,gsl_mode_t mode); +airy_Ai_scaled :: Double -> Precision -> Double +airy_Ai_scaled x mode = gsl_sf_airy_Ai_scaled x (precCode mode) +foreign import ccall "airy.h gsl_sf_airy_Ai_scaled" gsl_sf_airy_Ai_scaled :: Double -> Gsl_mode_t -> Double + +-- | wrapper for int gsl_sf_airy_Bi_scaled_e(double x,gsl_mode_t mode,gsl_sf_result* result); +airy_Bi_scaled_e :: Double -> Precision -> (Double,Double) +airy_Bi_scaled_e x mode = createSFR "airy_Bi_scaled_e" $ gsl_sf_airy_Bi_scaled_e x (precCode mode) +foreign import ccall "airy.h gsl_sf_airy_Bi_scaled_e" gsl_sf_airy_Bi_scaled_e :: Double -> Gsl_mode_t -> Ptr Double -> IO(Int) + +-- | wrapper for double gsl_sf_airy_Bi_scaled(double x,gsl_mode_t mode); +airy_Bi_scaled :: Double -> Precision -> Double +airy_Bi_scaled x mode = gsl_sf_airy_Bi_scaled x (precCode mode) +foreign import ccall "airy.h gsl_sf_airy_Bi_scaled" gsl_sf_airy_Bi_scaled :: Double -> Gsl_mode_t -> Double + +-- | wrapper for int gsl_sf_airy_Ai_deriv_e(double x,gsl_mode_t mode,gsl_sf_result* result); +airy_Ai_deriv_e :: Double -> Precision -> (Double,Double) +airy_Ai_deriv_e x mode = createSFR "airy_Ai_deriv_e" $ gsl_sf_airy_Ai_deriv_e x (precCode mode) +foreign import ccall "airy.h gsl_sf_airy_Ai_deriv_e" gsl_sf_airy_Ai_deriv_e :: Double -> Gsl_mode_t -> Ptr Double -> IO(Int) + +-- | wrapper for double gsl_sf_airy_Ai_deriv(double x,gsl_mode_t mode); +airy_Ai_deriv :: Double -> Precision -> Double +airy_Ai_deriv x mode = gsl_sf_airy_Ai_deriv x (precCode mode) +foreign import ccall "airy.h gsl_sf_airy_Ai_deriv" gsl_sf_airy_Ai_deriv :: Double -> Gsl_mode_t -> Double + +-- | wrapper for int gsl_sf_airy_Bi_deriv_e(double x,gsl_mode_t mode,gsl_sf_result* result); +airy_Bi_deriv_e :: Double -> Precision -> (Double,Double) +airy_Bi_deriv_e x mode = createSFR "airy_Bi_deriv_e" $ gsl_sf_airy_Bi_deriv_e x (precCode mode) +foreign import ccall "airy.h gsl_sf_airy_Bi_deriv_e" gsl_sf_airy_Bi_deriv_e :: Double -> Gsl_mode_t -> Ptr Double -> IO(Int) + +-- | wrapper for double gsl_sf_airy_Bi_deriv(double x,gsl_mode_t mode); +airy_Bi_deriv :: Double -> Precision -> Double +airy_Bi_deriv x mode = gsl_sf_airy_Bi_deriv x (precCode mode) +foreign import ccall "airy.h gsl_sf_airy_Bi_deriv" gsl_sf_airy_Bi_deriv :: Double -> Gsl_mode_t -> Double + +-- | wrapper for int gsl_sf_airy_Ai_deriv_scaled_e(double x,gsl_mode_t mode,gsl_sf_result* result); +airy_Ai_deriv_scaled_e :: Double -> Precision -> (Double,Double) +airy_Ai_deriv_scaled_e x mode = createSFR "airy_Ai_deriv_scaled_e" $ gsl_sf_airy_Ai_deriv_scaled_e x (precCode mode) +foreign import ccall "airy.h gsl_sf_airy_Ai_deriv_scaled_e" gsl_sf_airy_Ai_deriv_scaled_e :: Double -> Gsl_mode_t -> Ptr Double -> IO(Int) + +-- | wrapper for double gsl_sf_airy_Ai_deriv_scaled(double x,gsl_mode_t mode); +airy_Ai_deriv_scaled :: Double -> Precision -> Double +airy_Ai_deriv_scaled x mode = gsl_sf_airy_Ai_deriv_scaled x (precCode mode) +foreign import ccall "airy.h gsl_sf_airy_Ai_deriv_scaled" gsl_sf_airy_Ai_deriv_scaled :: Double -> Gsl_mode_t -> Double + +-- | wrapper for int gsl_sf_airy_Bi_deriv_scaled_e(double x,gsl_mode_t mode,gsl_sf_result* result); +airy_Bi_deriv_scaled_e :: Double -> Precision -> (Double,Double) +airy_Bi_deriv_scaled_e x mode = createSFR "airy_Bi_deriv_scaled_e" $ gsl_sf_airy_Bi_deriv_scaled_e x (precCode mode) +foreign import ccall "airy.h gsl_sf_airy_Bi_deriv_scaled_e" gsl_sf_airy_Bi_deriv_scaled_e :: Double -> Gsl_mode_t -> Ptr Double -> IO(Int) + +-- | wrapper for double gsl_sf_airy_Bi_deriv_scaled(double x,gsl_mode_t mode); +airy_Bi_deriv_scaled :: Double -> Precision -> Double +airy_Bi_deriv_scaled x mode = gsl_sf_airy_Bi_deriv_scaled x (precCode mode) +foreign import ccall "airy.h gsl_sf_airy_Bi_deriv_scaled" gsl_sf_airy_Bi_deriv_scaled :: Double -> Gsl_mode_t -> Double + +-- | wrapper for int gsl_sf_airy_zero_Ai_e(int s,gsl_sf_result* result); +airy_zero_Ai_e :: Int -> (Double,Double) +airy_zero_Ai_e s = createSFR "airy_zero_Ai_e" $ gsl_sf_airy_zero_Ai_e s +foreign import ccall "airy.h gsl_sf_airy_zero_Ai_e" gsl_sf_airy_zero_Ai_e :: Int -> Ptr Double -> IO(Int) + +-- | wrapper for double gsl_sf_airy_zero_Ai(int s); +airy_zero_Ai :: Int -> Double +airy_zero_Ai = gsl_sf_airy_zero_Ai +foreign import ccall "airy.h gsl_sf_airy_zero_Ai" gsl_sf_airy_zero_Ai :: Int -> Double + +-- | wrapper for int gsl_sf_airy_zero_Bi_e(int s,gsl_sf_result* result); +airy_zero_Bi_e :: Int -> (Double,Double) +airy_zero_Bi_e s = createSFR "airy_zero_Bi_e" $ gsl_sf_airy_zero_Bi_e s +foreign import ccall "airy.h gsl_sf_airy_zero_Bi_e" gsl_sf_airy_zero_Bi_e :: Int -> Ptr Double -> IO(Int) + +-- | wrapper for double gsl_sf_airy_zero_Bi(int s); +airy_zero_Bi :: Int -> Double +airy_zero_Bi = gsl_sf_airy_zero_Bi +foreign import ccall "airy.h gsl_sf_airy_zero_Bi" gsl_sf_airy_zero_Bi :: Int -> Double + +-- | wrapper for int gsl_sf_airy_zero_Ai_deriv_e(int s,gsl_sf_result* result); +airy_zero_Ai_deriv_e :: Int -> (Double,Double) +airy_zero_Ai_deriv_e s = createSFR "airy_zero_Ai_deriv_e" $ gsl_sf_airy_zero_Ai_deriv_e s +foreign import ccall "airy.h gsl_sf_airy_zero_Ai_deriv_e" gsl_sf_airy_zero_Ai_deriv_e :: Int -> Ptr Double -> IO(Int) + +-- | wrapper for double gsl_sf_airy_zero_Ai_deriv(int s); +airy_zero_Ai_deriv :: Int -> Double +airy_zero_Ai_deriv = gsl_sf_airy_zero_Ai_deriv +foreign import ccall "airy.h gsl_sf_airy_zero_Ai_deriv" gsl_sf_airy_zero_Ai_deriv :: Int -> Double + +-- | wrapper for int gsl_sf_airy_zero_Bi_deriv_e(int s,gsl_sf_result* result); +airy_zero_Bi_deriv_e :: Int -> (Double,Double) +airy_zero_Bi_deriv_e s = createSFR "airy_zero_Bi_deriv_e" $ gsl_sf_airy_zero_Bi_deriv_e s +foreign import ccall "airy.h gsl_sf_airy_zero_Bi_deriv_e" gsl_sf_airy_zero_Bi_deriv_e :: Int -> Ptr Double -> IO(Int) + +-- | wrapper for double gsl_sf_airy_zero_Bi_deriv(int s); +airy_zero_Bi_deriv :: Int -> Double +airy_zero_Bi_deriv = gsl_sf_airy_zero_Bi_deriv +foreign import ccall "airy.h gsl_sf_airy_zero_Bi_deriv" gsl_sf_airy_zero_Bi_deriv :: Int -> Double diff --git a/lib/GSL/Special/Erf.hs b/lib/GSL/Special/Erf.hs new file mode 100644 index 0000000..30b7817 --- /dev/null +++ b/lib/GSL/Special/Erf.hs @@ -0,0 +1,93 @@ +------------------------------------------------------------ +{- | +Module : GSL.Special.Erf +Copyright : (c) Alberto Ruiz 2006 +License : GPL-style +Maintainer : Alberto Ruiz (aruiz at um dot es) +Stability : provisional +Portability : uses ffi + +Wrappers for selected functions described at: + + + +-} +------------------------------------------------------------ + +module GSL.Special.Erf( + erfc_e +, erfc +, log_erfc_e +, log_erfc +, erf_e +, erf +, erf_Z_e +, erf_Q_e +, erf_Z +, erf_Q +, hazard_e +, hazard +) where + +import Foreign(Ptr) +import GSL.Special.Internal + +-- | wrapper for int gsl_sf_erfc_e(double x,gsl_sf_result* result); +erfc_e :: Double -> (Double,Double) +erfc_e x = createSFR "erfc_e" $ gsl_sf_erfc_e x +foreign import ccall "erf.h gsl_sf_erfc_e" gsl_sf_erfc_e :: Double -> Ptr Double -> IO(Int) + +-- | wrapper for double gsl_sf_erfc(double x); +erfc :: Double -> Double +erfc = gsl_sf_erfc +foreign import ccall "erf.h gsl_sf_erfc" gsl_sf_erfc :: Double -> Double + +-- | wrapper for int gsl_sf_log_erfc_e(double x,gsl_sf_result* result); +log_erfc_e :: Double -> (Double,Double) +log_erfc_e x = createSFR "log_erfc_e" $ gsl_sf_log_erfc_e x +foreign import ccall "erf.h gsl_sf_log_erfc_e" gsl_sf_log_erfc_e :: Double -> Ptr Double -> IO(Int) + +-- | wrapper for double gsl_sf_log_erfc(double x); +log_erfc :: Double -> Double +log_erfc = gsl_sf_log_erfc +foreign import ccall "erf.h gsl_sf_log_erfc" gsl_sf_log_erfc :: Double -> Double + +-- | wrapper for int gsl_sf_erf_e(double x,gsl_sf_result* result); +erf_e :: Double -> (Double,Double) +erf_e x = createSFR "erf_e" $ gsl_sf_erf_e x +foreign import ccall "erf.h gsl_sf_erf_e" gsl_sf_erf_e :: Double -> Ptr Double -> IO(Int) + +-- | wrapper for double gsl_sf_erf(double x); +erf :: Double -> Double +erf = gsl_sf_erf +foreign import ccall "erf.h gsl_sf_erf" gsl_sf_erf :: Double -> Double + +-- | wrapper for int gsl_sf_erf_Z_e(double x,gsl_sf_result* result); +erf_Z_e :: Double -> (Double,Double) +erf_Z_e x = createSFR "erf_Z_e" $ gsl_sf_erf_Z_e x +foreign import ccall "erf.h gsl_sf_erf_Z_e" gsl_sf_erf_Z_e :: Double -> Ptr Double -> IO(Int) + +-- | wrapper for int gsl_sf_erf_Q_e(double x,gsl_sf_result* result); +erf_Q_e :: Double -> (Double,Double) +erf_Q_e x = createSFR "erf_Q_e" $ gsl_sf_erf_Q_e x +foreign import ccall "erf.h gsl_sf_erf_Q_e" gsl_sf_erf_Q_e :: Double -> Ptr Double -> IO(Int) + +-- | wrapper for double gsl_sf_erf_Z(double x); +erf_Z :: Double -> Double +erf_Z = gsl_sf_erf_Z +foreign import ccall "erf.h gsl_sf_erf_Z" gsl_sf_erf_Z :: Double -> Double + +-- | wrapper for double gsl_sf_erf_Q(double x); +erf_Q :: Double -> Double +erf_Q = gsl_sf_erf_Q +foreign import ccall "erf.h gsl_sf_erf_Q" gsl_sf_erf_Q :: Double -> Double + +-- | wrapper for int gsl_sf_hazard_e(double x,gsl_sf_result* result); +hazard_e :: Double -> (Double,Double) +hazard_e x = createSFR "hazard_e" $ gsl_sf_hazard_e x +foreign import ccall "erf.h gsl_sf_hazard_e" gsl_sf_hazard_e :: Double -> Ptr Double -> IO(Int) + +-- | wrapper for double gsl_sf_hazard(double x); +hazard :: Double -> Double +hazard = gsl_sf_hazard +foreign import ccall "erf.h gsl_sf_hazard" gsl_sf_hazard :: Double -> Double diff --git a/lib/GSL/Special/Gamma.hs b/lib/GSL/Special/Gamma.hs new file mode 100644 index 0000000..4586cb5 --- /dev/null +++ b/lib/GSL/Special/Gamma.hs @@ -0,0 +1,277 @@ +------------------------------------------------------------ +{- | +Module : GSL.Special.Gamma +Copyright : (c) Alberto Ruiz 2006 +License : GPL-style +Maintainer : Alberto Ruiz (aruiz at um dot es) +Stability : provisional +Portability : uses ffi + +Wrappers for selected functions described at: + + + + +-} +------------------------------------------------------------ + +module GSL.Special.Gamma( + lngamma_e +, lngamma +, gamma_e +, gamma +, gammastar_e +, gammastar +, gammainv_e +, gammainv +, taylorcoeff_e +, taylorcoeff +, fact_e +, fact +, doublefact_e +, doublefact +, lnfact_e +, lnfact +, lndoublefact_e +, lndoublefact +, lnchoose_e +, lnchoose +, choose_e +, choose +, lnpoch_e +, lnpoch +, poch_e +, poch +, pochrel_e +, pochrel +, gamma_inc_Q_e +, gamma_inc_Q +, gamma_inc_P_e +, gamma_inc_P +, gamma_inc_e +, gamma_inc +, lnbeta_e +, lnbeta +, beta_e +, beta +, beta_inc_e +, beta_inc +) where + +import Foreign(Ptr) +import GSL.Special.Internal + +-- | wrapper for int gsl_sf_lngamma_e(double x,gsl_sf_result* result); +lngamma_e :: Double -> (Double,Double) +lngamma_e x = createSFR "lngamma_e" $ gsl_sf_lngamma_e x +foreign import ccall "gamma.h gsl_sf_lngamma_e" gsl_sf_lngamma_e :: Double -> Ptr Double -> IO(Int) + +-- | wrapper for double gsl_sf_lngamma(double x); +lngamma :: Double -> Double +lngamma = gsl_sf_lngamma +foreign import ccall "gamma.h gsl_sf_lngamma" gsl_sf_lngamma :: Double -> Double + +-- | wrapper for int gsl_sf_lngamma_sgn_e(double x,gsl_sf_result* result_lg,double* sgn); +lngamma_sgn_e :: Double -> Ptr Double -> Ptr Double -> Int +lngamma_sgn_e = gsl_sf_lngamma_sgn_e +foreign import ccall "gamma.h gsl_sf_lngamma_sgn_e" gsl_sf_lngamma_sgn_e :: Double -> Ptr Double -> Ptr Double -> Int + +-- | wrapper for int gsl_sf_gamma_e(double x,gsl_sf_result* result); +gamma_e :: Double -> (Double,Double) +gamma_e x = createSFR "gamma_e" $ gsl_sf_gamma_e x +foreign import ccall "gamma.h gsl_sf_gamma_e" gsl_sf_gamma_e :: Double -> Ptr Double -> IO(Int) + +-- | wrapper for double gsl_sf_gamma(double x); +gamma :: Double -> Double +gamma = gsl_sf_gamma +foreign import ccall "gamma.h gsl_sf_gamma" gsl_sf_gamma :: Double -> Double + +-- | wrapper for int gsl_sf_gammastar_e(double x,gsl_sf_result* result); +gammastar_e :: Double -> (Double,Double) +gammastar_e x = createSFR "gammastar_e" $ gsl_sf_gammastar_e x +foreign import ccall "gamma.h gsl_sf_gammastar_e" gsl_sf_gammastar_e :: Double -> Ptr Double -> IO(Int) + +-- | wrapper for double gsl_sf_gammastar(double x); +gammastar :: Double -> Double +gammastar = gsl_sf_gammastar +foreign import ccall "gamma.h gsl_sf_gammastar" gsl_sf_gammastar :: Double -> Double + +-- | wrapper for int gsl_sf_gammainv_e(double x,gsl_sf_result* result); +gammainv_e :: Double -> (Double,Double) +gammainv_e x = createSFR "gammainv_e" $ gsl_sf_gammainv_e x +foreign import ccall "gamma.h gsl_sf_gammainv_e" gsl_sf_gammainv_e :: Double -> Ptr Double -> IO(Int) + +-- | wrapper for double gsl_sf_gammainv(double x); +gammainv :: Double -> Double +gammainv = gsl_sf_gammainv +foreign import ccall "gamma.h gsl_sf_gammainv" gsl_sf_gammainv :: Double -> Double + +-- | wrapper for int gsl_sf_lngamma_complex_e(double zr,double zi,gsl_sf_result* lnr,gsl_sf_result* arg); +lngamma_complex_e :: Double -> Double -> Ptr Double -> (Double,Double) +lngamma_complex_e zr zi lnr = createSFR "lngamma_complex_e" $ gsl_sf_lngamma_complex_e zr zi lnr +foreign import ccall "gamma.h gsl_sf_lngamma_complex_e" gsl_sf_lngamma_complex_e :: Double -> Double -> Ptr Double -> Ptr Double -> IO(Int) + +-- | wrapper for int gsl_sf_taylorcoeff_e(int n,double x,gsl_sf_result* result); +taylorcoeff_e :: Int -> Double -> (Double,Double) +taylorcoeff_e n x = createSFR "taylorcoeff_e" $ gsl_sf_taylorcoeff_e n x +foreign import ccall "gamma.h gsl_sf_taylorcoeff_e" gsl_sf_taylorcoeff_e :: Int -> Double -> Ptr Double -> IO(Int) + +-- | wrapper for double gsl_sf_taylorcoeff(int n,double x); +taylorcoeff :: Int -> Double -> Double +taylorcoeff = gsl_sf_taylorcoeff +foreign import ccall "gamma.h gsl_sf_taylorcoeff" gsl_sf_taylorcoeff :: Int -> Double -> Double + +-- | wrapper for int gsl_sf_fact_e(int n,gsl_sf_result* result); +fact_e :: Int -> (Double,Double) +fact_e n = createSFR "fact_e" $ gsl_sf_fact_e n +foreign import ccall "gamma.h gsl_sf_fact_e" gsl_sf_fact_e :: Int -> Ptr Double -> IO(Int) + +-- | wrapper for double gsl_sf_fact(int n); +fact :: Int -> Double +fact = gsl_sf_fact +foreign import ccall "gamma.h gsl_sf_fact" gsl_sf_fact :: Int -> Double + +-- | wrapper for int gsl_sf_doublefact_e(int n,gsl_sf_result* result); +doublefact_e :: Int -> (Double,Double) +doublefact_e n = createSFR "doublefact_e" $ gsl_sf_doublefact_e n +foreign import ccall "gamma.h gsl_sf_doublefact_e" gsl_sf_doublefact_e :: Int -> Ptr Double -> IO(Int) + +-- | wrapper for double gsl_sf_doublefact(int n); +doublefact :: Int -> Double +doublefact = gsl_sf_doublefact +foreign import ccall "gamma.h gsl_sf_doublefact" gsl_sf_doublefact :: Int -> Double + +-- | wrapper for int gsl_sf_lnfact_e(int n,gsl_sf_result* result); +lnfact_e :: Int -> (Double,Double) +lnfact_e n = createSFR "lnfact_e" $ gsl_sf_lnfact_e n +foreign import ccall "gamma.h gsl_sf_lnfact_e" gsl_sf_lnfact_e :: Int -> Ptr Double -> IO(Int) + +-- | wrapper for double gsl_sf_lnfact(int n); +lnfact :: Int -> Double +lnfact = gsl_sf_lnfact +foreign import ccall "gamma.h gsl_sf_lnfact" gsl_sf_lnfact :: Int -> Double + +-- | wrapper for int gsl_sf_lndoublefact_e(int n,gsl_sf_result* result); +lndoublefact_e :: Int -> (Double,Double) +lndoublefact_e n = createSFR "lndoublefact_e" $ gsl_sf_lndoublefact_e n +foreign import ccall "gamma.h gsl_sf_lndoublefact_e" gsl_sf_lndoublefact_e :: Int -> Ptr Double -> IO(Int) + +-- | wrapper for double gsl_sf_lndoublefact(int n); +lndoublefact :: Int -> Double +lndoublefact = gsl_sf_lndoublefact +foreign import ccall "gamma.h gsl_sf_lndoublefact" gsl_sf_lndoublefact :: Int -> Double + +-- | wrapper for int gsl_sf_lnchoose_e(int n,int m,gsl_sf_result* result); +lnchoose_e :: Int -> Int -> (Double,Double) +lnchoose_e n m = createSFR "lnchoose_e" $ gsl_sf_lnchoose_e n m +foreign import ccall "gamma.h gsl_sf_lnchoose_e" gsl_sf_lnchoose_e :: Int -> Int -> Ptr Double -> IO(Int) + +-- | wrapper for double gsl_sf_lnchoose(int n,int m); +lnchoose :: Int -> Int -> Double +lnchoose = gsl_sf_lnchoose +foreign import ccall "gamma.h gsl_sf_lnchoose" gsl_sf_lnchoose :: Int -> Int -> Double + +-- | wrapper for int gsl_sf_choose_e(int n,int m,gsl_sf_result* result); +choose_e :: Int -> Int -> (Double,Double) +choose_e n m = createSFR "choose_e" $ gsl_sf_choose_e n m +foreign import ccall "gamma.h gsl_sf_choose_e" gsl_sf_choose_e :: Int -> Int -> Ptr Double -> IO(Int) + +-- | wrapper for double gsl_sf_choose(int n,int m); +choose :: Int -> Int -> Double +choose = gsl_sf_choose +foreign import ccall "gamma.h gsl_sf_choose" gsl_sf_choose :: Int -> Int -> Double + +-- | wrapper for int gsl_sf_lnpoch_e(double a,double x,gsl_sf_result* result); +lnpoch_e :: Double -> Double -> (Double,Double) +lnpoch_e a x = createSFR "lnpoch_e" $ gsl_sf_lnpoch_e a x +foreign import ccall "gamma.h gsl_sf_lnpoch_e" gsl_sf_lnpoch_e :: Double -> Double -> Ptr Double -> IO(Int) + +-- | wrapper for double gsl_sf_lnpoch(double a,double x); +lnpoch :: Double -> Double -> Double +lnpoch = gsl_sf_lnpoch +foreign import ccall "gamma.h gsl_sf_lnpoch" gsl_sf_lnpoch :: Double -> Double -> Double + +-- | wrapper for int gsl_sf_lnpoch_sgn_e(double a,double x,gsl_sf_result* result,double* sgn); +lnpoch_sgn_e :: Double -> Double -> Ptr Double -> Ptr Double -> Int +lnpoch_sgn_e = gsl_sf_lnpoch_sgn_e +foreign import ccall "gamma.h gsl_sf_lnpoch_sgn_e" gsl_sf_lnpoch_sgn_e :: Double -> Double -> Ptr Double -> Ptr Double -> Int + +-- | wrapper for int gsl_sf_poch_e(double a,double x,gsl_sf_result* result); +poch_e :: Double -> Double -> (Double,Double) +poch_e a x = createSFR "poch_e" $ gsl_sf_poch_e a x +foreign import ccall "gamma.h gsl_sf_poch_e" gsl_sf_poch_e :: Double -> Double -> Ptr Double -> IO(Int) + +-- | wrapper for double gsl_sf_poch(double a,double x); +poch :: Double -> Double -> Double +poch = gsl_sf_poch +foreign import ccall "gamma.h gsl_sf_poch" gsl_sf_poch :: Double -> Double -> Double + +-- | wrapper for int gsl_sf_pochrel_e(double a,double x,gsl_sf_result* result); +pochrel_e :: Double -> Double -> (Double,Double) +pochrel_e a x = createSFR "pochrel_e" $ gsl_sf_pochrel_e a x +foreign import ccall "gamma.h gsl_sf_pochrel_e" gsl_sf_pochrel_e :: Double -> Double -> Ptr Double -> IO(Int) + +-- | wrapper for double gsl_sf_pochrel(double a,double x); +pochrel :: Double -> Double -> Double +pochrel = gsl_sf_pochrel +foreign import ccall "gamma.h gsl_sf_pochrel" gsl_sf_pochrel :: Double -> Double -> Double + +-- | wrapper for int gsl_sf_gamma_inc_Q_e(double a,double x,gsl_sf_result* result); +gamma_inc_Q_e :: Double -> Double -> (Double,Double) +gamma_inc_Q_e a x = createSFR "gamma_inc_Q_e" $ gsl_sf_gamma_inc_Q_e a x +foreign import ccall "gamma.h gsl_sf_gamma_inc_Q_e" gsl_sf_gamma_inc_Q_e :: Double -> Double -> Ptr Double -> IO(Int) + +-- | wrapper for double gsl_sf_gamma_inc_Q(double a,double x); +gamma_inc_Q :: Double -> Double -> Double +gamma_inc_Q = gsl_sf_gamma_inc_Q +foreign import ccall "gamma.h gsl_sf_gamma_inc_Q" gsl_sf_gamma_inc_Q :: Double -> Double -> Double + +-- | wrapper for int gsl_sf_gamma_inc_P_e(double a,double x,gsl_sf_result* result); +gamma_inc_P_e :: Double -> Double -> (Double,Double) +gamma_inc_P_e a x = createSFR "gamma_inc_P_e" $ gsl_sf_gamma_inc_P_e a x +foreign import ccall "gamma.h gsl_sf_gamma_inc_P_e" gsl_sf_gamma_inc_P_e :: Double -> Double -> Ptr Double -> IO(Int) + +-- | wrapper for double gsl_sf_gamma_inc_P(double a,double x); +gamma_inc_P :: Double -> Double -> Double +gamma_inc_P = gsl_sf_gamma_inc_P +foreign import ccall "gamma.h gsl_sf_gamma_inc_P" gsl_sf_gamma_inc_P :: Double -> Double -> Double + +-- | wrapper for int gsl_sf_gamma_inc_e(double a,double x,gsl_sf_result* result); +gamma_inc_e :: Double -> Double -> (Double,Double) +gamma_inc_e a x = createSFR "gamma_inc_e" $ gsl_sf_gamma_inc_e a x +foreign import ccall "gamma.h gsl_sf_gamma_inc_e" gsl_sf_gamma_inc_e :: Double -> Double -> Ptr Double -> IO(Int) + +-- | wrapper for double gsl_sf_gamma_inc(double a,double x); +gamma_inc :: Double -> Double -> Double +gamma_inc = gsl_sf_gamma_inc +foreign import ccall "gamma.h gsl_sf_gamma_inc" gsl_sf_gamma_inc :: Double -> Double -> Double + +-- | wrapper for int gsl_sf_lnbeta_e(double a,double b,gsl_sf_result* result); +lnbeta_e :: Double -> Double -> (Double,Double) +lnbeta_e a b = createSFR "lnbeta_e" $ gsl_sf_lnbeta_e a b +foreign import ccall "gamma.h gsl_sf_lnbeta_e" gsl_sf_lnbeta_e :: Double -> Double -> Ptr Double -> IO(Int) + +-- | wrapper for double gsl_sf_lnbeta(double a,double b); +lnbeta :: Double -> Double -> Double +lnbeta = gsl_sf_lnbeta +foreign import ccall "gamma.h gsl_sf_lnbeta" gsl_sf_lnbeta :: Double -> Double -> Double + +-- | wrapper for int gsl_sf_beta_e(double a,double b,gsl_sf_result* result); +beta_e :: Double -> Double -> (Double,Double) +beta_e a b = createSFR "beta_e" $ gsl_sf_beta_e a b +foreign import ccall "gamma.h gsl_sf_beta_e" gsl_sf_beta_e :: Double -> Double -> Ptr Double -> IO(Int) + +-- | wrapper for double gsl_sf_beta(double a,double b); +beta :: Double -> Double -> Double +beta = gsl_sf_beta +foreign import ccall "gamma.h gsl_sf_beta" gsl_sf_beta :: Double -> Double -> Double + +-- | wrapper for int gsl_sf_beta_inc_e(double a,double b,double x,gsl_sf_result* result); +beta_inc_e :: Double -> Double -> Double -> (Double,Double) +beta_inc_e a b x = createSFR "beta_inc_e" $ gsl_sf_beta_inc_e a b x +foreign import ccall "gamma.h gsl_sf_beta_inc_e" gsl_sf_beta_inc_e :: Double -> Double -> Double -> Ptr Double -> IO(Int) + +-- | wrapper for double gsl_sf_beta_inc(double a,double b,double x); +beta_inc :: Double -> Double -> Double -> Double +beta_inc = gsl_sf_beta_inc +foreign import ccall "gamma.h gsl_sf_beta_inc" gsl_sf_beta_inc :: Double -> Double -> Double -> Double diff --git a/lib/GSL/Special/Internal.hs b/lib/GSL/Special/Internal.hs new file mode 100644 index 0000000..c7455d9 --- /dev/null +++ b/lib/GSL/Special/Internal.hs @@ -0,0 +1,65 @@ +{-# OPTIONS #-} +----------------------------------------------------------------------------- +{- | +Module : GSL.Special.Internal +Copyright : (c) Alberto Ruiz 2007 +License : GPL-style + +Maintainer : Alberto Ruiz (aruiz at um dot es) +Stability : provisional +Portability : uses ffi + +Support for Special functions. + + +-} +----------------------------------------------------------------------------- + +module GSL.Special.Internal ( + createSFR, + createSFR_E10, + Precision(..), + Gsl_mode_t, + precCode +) +where + +import Foreign +import Data.Packed.Internal.Common(check,(//)) + + +data Precision = PrecDouble | PrecSingle | PrecApprox + +precCode :: Precision -> Int +precCode PrecDouble = 0 +precCode PrecSingle = 1 +precCode PrecApprox = 2 + +type Gsl_mode_t = Int + +---------------------------------------------------------------- +-- | access to a sf_result +createSFR :: Storable a => t -> (Ptr a -> IO Int) -> (a, a) +createSFR s f = unsafePerformIO $ do + p <- mallocArray 2 + f p // check "createSFR" [] + [val,err] <- peekArray 2 p + free p + return (val,err) + + +--------------------------------------------------------------------- +-- the sf_result_e10 contains two doubles and the exponent + +-- | acces to sf_result_e10 +createSFR_E10 :: (Storable t2, Storable t3, Storable t1) => t -> (Ptr a -> IO Int) -> (t1, t2, t3) +createSFR_E10 s f = unsafePerformIO $ do + let sd = sizeOf (0::Double) + let si = sizeOf (0::Int) + p <- mallocBytes (2*sd + si) + f p // check "createSFR_E10" [] + val <- peekByteOff p 0 + err <- peekByteOff p sd + expo <- peekByteOff p (2*sd) + free p + return (val,expo,err) diff --git a/lib/GSL/Special/airy.h b/lib/GSL/Special/airy.h new file mode 100644 index 0000000..e34e012 --- /dev/null +++ b/lib/GSL/Special/airy.h @@ -0,0 +1,24 @@ +int gsl_sf_airy_Ai_e(double x,int mode,double* result); +double gsl_sf_airy_Ai(double x,int mode); +int gsl_sf_airy_Bi_e(double x,int mode,double* result); +double gsl_sf_airy_Bi(double x,int mode); +int gsl_sf_airy_Ai_scaled_e(double x,int mode,double* result); +double gsl_sf_airy_Ai_scaled(double x,int mode); +int gsl_sf_airy_Bi_scaled_e(double x,int mode,double* result); +double gsl_sf_airy_Bi_scaled(double x,int mode); +int gsl_sf_airy_Ai_deriv_e(double x,int mode,double* result); +double gsl_sf_airy_Ai_deriv(double x,int mode); +int gsl_sf_airy_Bi_deriv_e(double x,int mode,double* result); +double gsl_sf_airy_Bi_deriv(double x,int mode); +int gsl_sf_airy_Ai_deriv_scaled_e(double x,int mode,double* result); +double gsl_sf_airy_Ai_deriv_scaled(double x,int mode); +int gsl_sf_airy_Bi_deriv_scaled_e(double x,int mode,double* result); +double gsl_sf_airy_Bi_deriv_scaled(double x,int mode); +int gsl_sf_airy_zero_Ai_e(int s,double* result); +double gsl_sf_airy_zero_Ai(int s); +int gsl_sf_airy_zero_Bi_e(int s,double* result); +double gsl_sf_airy_zero_Bi(int s); +int gsl_sf_airy_zero_Ai_deriv_e(int s,double* result); +double gsl_sf_airy_zero_Ai_deriv(int s); +int gsl_sf_airy_zero_Bi_deriv_e(int s,double* result); +double gsl_sf_airy_zero_Bi_deriv(int s); diff --git a/lib/GSL/Special/auto.hs b/lib/GSL/Special/auto.hs new file mode 100644 index 0000000..f047bcb --- /dev/null +++ b/lib/GSL/Special/auto.hs @@ -0,0 +1,201 @@ +-- automatic generation of wrappers for simple GSL special functions + +import Text.ParserCombinators.Parsec +import System +import Data.List(intersperse, isPrefixOf) +import Data.Char(toUpper) + +data Type = Normal Ident | Pointer Ident deriving (Eq, Show) + +type Ident = String + +data Header = Header Type Ident [(Type,Ident)] deriving Show + +headers f = case parse parseHeaders "" f of + Right l -> l + Left s -> error (show s) + + +rep (c,r) [] = [] +rep (c,r) f@(x:xs) + | c `isPrefixOf` f = r ++ rep (c,r) (drop (length c) f) + | otherwise = x:(rep (c,r) xs) + + +fixlong [] = [] +fixlong "\\" = [] +fixlong ('\\':'\n':xs) = xs +fixlong (x:xs) = x : fixlong xs + + +safe (Header _ _ args) = all ok args + || all ok (init args) && kn (last args) + where ok ((Normal s),_) | s `elem` ["double","float","int","gsl_mode_t"] = True + ok _ = False + kn ((Pointer "gsl_sf_result"),_) = True + kn _ = False + + + +fixC s = rep ("gsl_mode_t","int") $ rep ("gsl_sf_result","double") $ s + +main = do + args <- getArgs + file <- readFile (args!!1) + let name = args!!0 + putStrLn (args!!1) + --mapM_ print (headers $ fixlong file) + let parsed = (headers $ fixlong file) + writeFile (name ++".h") (fixC $ unlines $ map showC parsed) + + --putStrLn "" + --mapM (\(Header _ n _) -> putStrLn (drop 7 n ++",")) parsed + --putStrLn "" + --mapM_ (putStrLn.showFull (name ++".h")) parsed + let exports = rep (")",") where") $ rep ("(\n","(\n ") $ rep (",\n",", ") $ unlines $ ["("]++intersperse "," (map (\(Header _ n _) -> drop 7 n) (filter safe parsed))++[")"] + let defs = unlines $ map (showFull (name ++".h")) parsed + let imports = "\nimport Foreign(Ptr)\nimport GSL.Special.Internal\n" + let mod = modhead name ++ "module GSL.Special."++ upperFirst name++exports++imports++defs + writeFile (upperFirst name ++ ".hs") mod + + +modhead name = replicate 60 '-' ++ "\n" + ++"{- |\n" + ++"Module : GSL.Special."++upperFirst name++"\n" + ++"Copyright : (c) Alberto Ruiz 2006\n" + ++"License : GPL-style\n" + ++"Maintainer : Alberto Ruiz (aruiz at um dot es)\n" + ++"Stability : provisional\n" + ++"Portability : uses ffi\n" + ++"\n\n\n-}\n" + ++ replicate 60 '-' ++ "\n\n" + +upperFirst (x:xs) = toUpper x : xs + +comment = do + string "/*" + closecomment + spaces + return "comment" + +closecomment = try (string "*/") + <|> (do anyChar + closecomment) + +ident = do + spaces + id <- many1 (noneOf "()[]* \n\t,;") + spaces + return id + +comment' = between (char '(') (char ')') (many $ noneOf ")") + + +define = do + string "#" + closedefine + spaces + return "define" + +closedefine = try (string "\n") + <|> (do anyChar + closedefine) + +marks = do + try (string "__BEGIN_DECLS" >> spaces >> return "begin") + <|> + try (string "__END_DECLS" >> spaces >> return "end") + + + +irrelevant = + try comment + <|> + try define + <|> + marks + + +parseHeaders = many parseHeader + +parseHeader = do + spaces + many irrelevant + spaces + (res,name) <- typ + spaces + args <- between (char '(') (char ')') (sepBy typ (char ',')) + spaces + char ';' + spaces + many irrelevant + return $ Header res name args + +typ = try t1 <|> t2 + +symbol s = spaces >> string s >> spaces + +t1 = do + t <- try (symbol "const" >> symbol "unsigned" >> ident) -- aaagh + <|> + try (symbol "const" >> ident) + <|> + try (symbol "unsigned" >> ident) + <|> ident + n <- ident + return (Normal t,n) + +t2 = do + t <- ident + spaces + char '*' + spaces + n <- ident + return (Pointer t,n) + +pure (Header _ _ args) | fst (last args) == Pointer "gsl_sf_result" = False + | otherwise = True + +showC (Header t n args) = showCt t ++ " " ++ n ++ "(" ++ (concat $ intersperse "," $ map showCa args) ++ ");" + +showCt (Normal s) = s +showCt (Pointer s) = s ++ "*" + +showCa (t, a) = showCt t ++" "++ a + +showH hc h@(Header t n args) = "foreign import ccall \""++hc++" "++n++"\" "++n++" :: "++ (concat$intersperse" -> "$map showHa args) ++" -> " ++ t' + where t' | pure h = showHt t + | otherwise = "IO("++showHt t++")" + +showHt (Normal (s:ss)) = toUpper s : ss +showHt (Pointer "gsl_sf_result") = "Ptr Double" +showHt (Pointer (s:ss)) = "Ptr "++toUpper s : ss + +showHa (t,a) = showHt t + +showFull hc h@(Header t n args) = "\n-- | wrapper for "++showC h++"\n"++ boiler h ++"\n" ++showH hc h + +fixmd1 = rep ("Gsl_mode_t","Precision") +fixmd2 = rep ("mode"," (precCode mode)") + +boiler h@(Header t n args) | fst (last args) == Pointer "gsl_sf_result" = boilerResult h + | any isMode args = boilerMode h + | otherwise = boilerBasic h + +isMode (Normal "gsl_mode_t",_) = True +isMode _ = False + + +boilerResult h@(Header t n args) = + drop 7 n++" :: "++ (fixmd1 $ concat $ intersperse" -> "$ map showHa (init args)) ++" -> " ++ "(Double,Double)\n" ++ + drop 7 n ++ " "++(unwords (map snd (init args)))++ + " = createSFR \""++ drop 7 n ++"\" $ " ++ n ++ " "++(fixmd2 $ unwords (map snd (init args))) + +boilerBasic h@(Header t n args) = + drop 7 n++" :: "++ (fixmd1 $ concat $ intersperse" -> "$map showHa args) ++" -> " ++showHt t ++ "\n" ++ + drop 7 n ++ " = " ++fixmd2 n + +boilerMode h@(Header t n args) = + drop 7 n++" :: "++ (fixmd1 $ concat $ intersperse" -> "$ map showHa args) ++" -> " ++ showHt t++"\n" ++ + drop 7 n ++ " "++(unwords (map snd args))++ + " = " ++ n ++ " "++(fixmd2 $ unwords (map snd args)) diff --git a/lib/GSL/Special/erf.h b/lib/GSL/Special/erf.h new file mode 100644 index 0000000..17369cf --- /dev/null +++ b/lib/GSL/Special/erf.h @@ -0,0 +1,12 @@ +int gsl_sf_erfc_e(double x,double* result); +double gsl_sf_erfc(double x); +int gsl_sf_log_erfc_e(double x,double* result); +double gsl_sf_log_erfc(double x); +int gsl_sf_erf_e(double x,double* result); +double gsl_sf_erf(double x); +int gsl_sf_erf_Z_e(double x,double* result); +int gsl_sf_erf_Q_e(double x,double* result); +double gsl_sf_erf_Z(double x); +double gsl_sf_erf_Q(double x); +int gsl_sf_hazard_e(double x,double* result); +double gsl_sf_hazard(double x); diff --git a/lib/GSL/Special/gamma.h b/lib/GSL/Special/gamma.h new file mode 100644 index 0000000..c5cc417 --- /dev/null +++ b/lib/GSL/Special/gamma.h @@ -0,0 +1,43 @@ +int gsl_sf_lngamma_e(double x,double* result); +double gsl_sf_lngamma(double x); +int gsl_sf_lngamma_sgn_e(double x,double* result_lg,double* sgn); +int gsl_sf_gamma_e(double x,double* result); +double gsl_sf_gamma(double x); +int gsl_sf_gammastar_e(double x,double* result); +double gsl_sf_gammastar(double x); +int gsl_sf_gammainv_e(double x,double* result); +double gsl_sf_gammainv(double x); +int gsl_sf_lngamma_complex_e(double zr,double zi,double* lnr,double* arg); +int gsl_sf_taylorcoeff_e(int n,double x,double* result); +double gsl_sf_taylorcoeff(int n,double x); +int gsl_sf_fact_e(int n,double* result); +double gsl_sf_fact(int n); +int gsl_sf_doublefact_e(int n,double* result); +double gsl_sf_doublefact(int n); +int gsl_sf_lnfact_e(int n,double* result); +double gsl_sf_lnfact(int n); +int gsl_sf_lndoublefact_e(int n,double* result); +double gsl_sf_lndoublefact(int n); +int gsl_sf_lnchoose_e(int n,int m,double* result); +double gsl_sf_lnchoose(int n,int m); +int gsl_sf_choose_e(int n,int m,double* result); +double gsl_sf_choose(int n,int m); +int gsl_sf_lnpoch_e(double a,double x,double* result); +double gsl_sf_lnpoch(double a,double x); +int gsl_sf_lnpoch_sgn_e(double a,double x,double* result,double* sgn); +int gsl_sf_poch_e(double a,double x,double* result); +double gsl_sf_poch(double a,double x); +int gsl_sf_pochrel_e(double a,double x,double* result); +double gsl_sf_pochrel(double a,double x); +int gsl_sf_gamma_inc_Q_e(double a,double x,double* result); +double gsl_sf_gamma_inc_Q(double a,double x); +int gsl_sf_gamma_inc_P_e(double a,double x,double* result); +double gsl_sf_gamma_inc_P(double a,double x); +int gsl_sf_gamma_inc_e(double a,double x,double* result); +double gsl_sf_gamma_inc(double a,double x); +int gsl_sf_lnbeta_e(double a,double b,double* result); +double gsl_sf_lnbeta(double a,double b); +int gsl_sf_beta_e(double a,double b,double* result); +double gsl_sf_beta(double a,double b); +int gsl_sf_beta_inc_e(double a,double b,double x,double* result); +double gsl_sf_beta_inc(double a,double b,double x); diff --git a/lib/HSSL.hs b/lib/HSSL.hs deleted file mode 100644 index 4506386..0000000 --- a/lib/HSSL.hs +++ /dev/null @@ -1,17 +0,0 @@ -{- | - -Module : GSL -Copyright : (c) Alberto Ruiz 2006-7 -License : GPL-style - -Maintainer : Alberto Ruiz (aruiz at um dot es) -Stability : provisional -Portability : uses -fffi and -fglasgow-exts - -This module reexports the basic functionality and a collection of utilities. - --} - -module HSSL ( - -) where -- cgit v1.2.3