summaryrefslogtreecommitdiff
path: root/lib/Numeric/GSL/Differentiation.hs
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Numeric/GSL/Differentiation.hs')
-rw-r--r--lib/Numeric/GSL/Differentiation.hs10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/Numeric/GSL/Differentiation.hs b/lib/Numeric/GSL/Differentiation.hs
index 841f2a0..ebbada0 100644
--- a/lib/Numeric/GSL/Differentiation.hs
+++ b/lib/Numeric/GSL/Differentiation.hs
@@ -24,10 +24,10 @@ module Numeric.GSL.Differentiation (
24 24
25import Foreign 25import Foreign
26import Foreign.C.Types(CInt) 26import Foreign.C.Types(CInt)
27import Data.Packed.Internal(mkfun,check,(//)) 27import Data.Packed.Internal(check,(//))
28 28
29derivGen :: 29derivGen ::
30 Int -- ^ type: 0 central, 1 forward, 2 backward 30 CInt -- ^ type: 0 central, 1 forward, 2 backward
31 -> Double -- ^ initial step size 31 -> Double -- ^ initial step size
32 -> (Double -> Double) -- ^ function 32 -> (Double -> Double) -- ^ function
33 -> Double -- ^ point where the derivative is taken 33 -> Double -- ^ point where the derivative is taken
@@ -46,7 +46,7 @@ derivGen c h f x = unsafePerformIO $ do
46 return result 46 return result
47 47
48foreign import ccall "gsl-aux.h deriv" 48foreign import ccall "gsl-aux.h deriv"
49 c_deriv :: Int -> FunPtr (Double -> Ptr () -> Double) -> Double -> Double 49 c_deriv :: CInt -> FunPtr (Double -> Ptr () -> Double) -> Double -> Double
50 -> Ptr Double -> Ptr Double -> IO CInt 50 -> Ptr Double -> Ptr Double -> IO CInt
51 51
52 52
@@ -78,3 +78,7 @@ derivBackward ::Double -- ^ initial step size
78 -> Double -- ^ point where the derivative is taken 78 -> Double -- ^ point where the derivative is taken
79 -> (Double, Double) -- ^ result and absolute error 79 -> (Double, Double) -- ^ result and absolute error
80derivBackward = derivGen 2 80derivBackward = derivGen 2
81
82{- | conversion of Haskell functions into function pointers that can be used in the C side
83-}
84foreign import ccall "wrapper" mkfun:: (Double -> Ptr() -> Double) -> IO( FunPtr (Double -> Ptr() -> Double))