summaryrefslogtreecommitdiff
path: root/lib/Numeric/GSL/Differentiation.hs
diff options
context:
space:
mode:
authorAlberto Ruiz <aruiz@um.es>2008-01-22 10:08:07 +0000
committerAlberto Ruiz <aruiz@um.es>2008-01-22 10:08:07 +0000
commit1bdc3af98f098f45e97e9c1a3225c5dcb64e3119 (patch)
treee6d2ad7bb2dae1be433a2facaa555305b7cc90b4 /lib/Numeric/GSL/Differentiation.hs
parent17749900a9146ddf6cd8ebf59dc35e56d6bff413 (diff)
CInt in GSL args
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))