summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorClark Gaebel <cgaebel@csclub.uwaterloo.ca>2012-03-10 22:47:13 -0500
committerClark Gaebel <cgaebel@csclub.uwaterloo.ca>2012-03-10 22:47:13 -0500
commit7832cb74240ba06a23a981c20db3c5da8324828a (patch)
treeb8afe01c34c75486eb3561377d574911422f63ee /lib
parentf8b7b3734fa6bb8d63914719e09d17940add27d4 (diff)
Added back some safety.
Diffstat (limited to 'lib')
-rw-r--r--lib/Numeric/GSL/Integration.hs12
-rw-r--r--lib/Numeric/GSL/Internal.hs10
-rw-r--r--lib/Numeric/GSL/Minimization.hs4
-rw-r--r--lib/Numeric/GSL/ODE.hs2
-rw-r--r--lib/Numeric/GSL/Root.hs4
5 files changed, 16 insertions, 16 deletions
diff --git a/lib/Numeric/GSL/Integration.hs b/lib/Numeric/GSL/Integration.hs
index b1e7930..defbf80 100644
--- a/lib/Numeric/GSL/Integration.hs
+++ b/lib/Numeric/GSL/Integration.hs
@@ -32,7 +32,7 @@ import System.IO.Unsafe(unsafePerformIO)
32 32
33{- | conversion of Haskell functions into function pointers that can be used in the C side 33{- | conversion of Haskell functions into function pointers that can be used in the C side
34-} 34-}
35foreign import ccall unsafe "wrapper" mkfun:: (Double -> Ptr() -> Double) -> IO( FunPtr (Double -> Ptr() -> Double)) 35foreign import ccall safe "wrapper" mkfun:: (Double -> Ptr() -> Double) -> IO( FunPtr (Double -> Ptr() -> Double))
36 36
37-------------------------------------------------------------------- 37--------------------------------------------------------------------
38{- | Numerical integration using /gsl_integration_qags/ (adaptive integration with singularities). For example: 38{- | Numerical integration using /gsl_integration_qags/ (adaptive integration with singularities). For example:
@@ -63,7 +63,7 @@ integrateQAGS prec n f a b = unsafePerformIO $ do
63 freeHaskellFunPtr fp 63 freeHaskellFunPtr fp
64 return result 64 return result
65 65
66foreign import ccall unsafe "gsl-aux.h integrate_qags" 66foreign import ccall safe "gsl-aux.h integrate_qags"
67 c_integrate_qags :: FunPtr (Double-> Ptr() -> Double) -> Double -> Double -> Double -> CInt 67 c_integrate_qags :: FunPtr (Double-> Ptr() -> Double) -> Double -> Double -> Double -> CInt
68 -> Ptr Double -> Ptr Double -> IO CInt 68 -> Ptr Double -> Ptr Double -> IO CInt
69 69
@@ -94,7 +94,7 @@ integrateQNG prec f a b = unsafePerformIO $ do
94 freeHaskellFunPtr fp 94 freeHaskellFunPtr fp
95 return result 95 return result
96 96
97foreign import ccall unsafe "gsl-aux.h integrate_qng" 97foreign import ccall safe "gsl-aux.h integrate_qng"
98 c_integrate_qng :: FunPtr (Double-> Ptr() -> Double) -> Double -> Double -> Double 98 c_integrate_qng :: FunPtr (Double-> Ptr() -> Double) -> Double -> Double -> Double
99 -> Ptr Double -> Ptr Double -> IO CInt 99 -> Ptr Double -> Ptr Double -> IO CInt
100 100
@@ -126,7 +126,7 @@ integrateQAGI prec n f = unsafePerformIO $ do
126 freeHaskellFunPtr fp 126 freeHaskellFunPtr fp
127 return result 127 return result
128 128
129foreign import ccall unsafe "gsl-aux.h integrate_qagi" 129foreign import ccall safe "gsl-aux.h integrate_qagi"
130 c_integrate_qagi :: FunPtr (Double-> Ptr() -> Double) -> Double -> CInt 130 c_integrate_qagi :: FunPtr (Double-> Ptr() -> Double) -> Double -> CInt
131 -> Ptr Double -> Ptr Double -> IO CInt 131 -> Ptr Double -> Ptr Double -> IO CInt
132 132
@@ -159,7 +159,7 @@ integrateQAGIU prec n f a = unsafePerformIO $ do
159 freeHaskellFunPtr fp 159 freeHaskellFunPtr fp
160 return result 160 return result
161 161
162foreign import ccall unsafe "gsl-aux.h integrate_qagiu" 162foreign import ccall safe "gsl-aux.h integrate_qagiu"
163 c_integrate_qagiu :: FunPtr (Double-> Ptr() -> Double) -> Double -> Double -> CInt 163 c_integrate_qagiu :: FunPtr (Double-> Ptr() -> Double) -> Double -> Double -> CInt
164 -> Ptr Double -> Ptr Double -> IO CInt 164 -> Ptr Double -> Ptr Double -> IO CInt
165 165
@@ -192,7 +192,7 @@ integrateQAGIL prec n f b = unsafePerformIO $ do
192 freeHaskellFunPtr fp 192 freeHaskellFunPtr fp
193 return result 193 return result
194 194
195foreign import ccall unsafe "gsl-aux.h integrate_qagil" 195foreign import ccall safe "gsl-aux.h integrate_qagil"
196 c_integrate_qagil :: FunPtr (Double-> Ptr() -> Double) -> Double -> Double -> CInt 196 c_integrate_qagil :: FunPtr (Double-> Ptr() -> Double) -> Double -> Double -> CInt
197 -> Ptr Double -> Ptr Double -> IO CInt 197 -> Ptr Double -> Ptr Double -> IO CInt
198 198
diff --git a/lib/Numeric/GSL/Internal.hs b/lib/Numeric/GSL/Internal.hs
index 4267b38..84417ce 100644
--- a/lib/Numeric/GSL/Internal.hs
+++ b/lib/Numeric/GSL/Internal.hs
@@ -26,14 +26,14 @@ iv f n p = f (createV (fromIntegral n) copy "iv") where
26 return 0 26 return 0
27 27
28-- | conversion of Haskell functions into function pointers that can be used in the C side 28-- | conversion of Haskell functions into function pointers that can be used in the C side
29foreign import ccall unsafe "wrapper" 29foreign import ccall safe "wrapper"
30 mkVecfun :: (CInt -> Ptr Double -> Double) 30 mkVecfun :: (CInt -> Ptr Double -> Double)
31 -> IO( FunPtr (CInt -> Ptr Double -> Double)) 31 -> IO( FunPtr (CInt -> Ptr Double -> Double))
32 32
33foreign import ccall unsafe "wrapper" 33foreign import ccall safe "wrapper"
34 mkVecVecfun :: TVV -> IO (FunPtr TVV) 34 mkVecVecfun :: TVV -> IO (FunPtr TVV)
35 35
36foreign import ccall unsafe "wrapper" 36foreign import ccall safe "wrapper"
37 mkDoubleVecVecfun :: (Double -> TVV) -> IO (FunPtr (Double -> TVV)) 37 mkDoubleVecVecfun :: (Double -> TVV) -> IO (FunPtr (Double -> TVV))
38 38
39aux_vTov :: (Vector Double -> Vector Double) -> TVV 39aux_vTov :: (Vector Double -> Vector Double) -> TVV
@@ -46,10 +46,10 @@ aux_vTov f n p nr r = g where
46 g = do unsafeWith v $ \p' -> copyArray r p' (fromIntegral nr) 46 g = do unsafeWith v $ \p' -> copyArray r p' (fromIntegral nr)
47 return 0 47 return 0
48 48
49foreign import ccall unsafe "wrapper" 49foreign import ccall safe "wrapper"
50 mkVecMatfun :: TVM -> IO (FunPtr TVM) 50 mkVecMatfun :: TVM -> IO (FunPtr TVM)
51 51
52foreign import ccall unsafe "wrapper" 52foreign import ccall safe "wrapper"
53 mkDoubleVecMatfun :: (Double -> TVM) -> IO (FunPtr (Double -> TVM)) 53 mkDoubleVecMatfun :: (Double -> TVM) -> IO (FunPtr (Double -> TVM))
54 54
55aux_vTom :: (Vector Double -> Matrix Double) -> TVM 55aux_vTom :: (Vector Double -> Matrix Double) -> TVM
diff --git a/lib/Numeric/GSL/Minimization.hs b/lib/Numeric/GSL/Minimization.hs
index 21ac8a1..af85135 100644
--- a/lib/Numeric/GSL/Minimization.hs
+++ b/lib/Numeric/GSL/Minimization.hs
@@ -122,7 +122,7 @@ minimizeV method eps maxit szv f xiv = unsafePerformIO $ do
122 return (sol, path) 122 return (sol, path)
123 123
124 124
125foreign import ccall unsafe "gsl-aux.h minimize" 125foreign import ccall safe "gsl-aux.h minimize"
126 c_minimize:: CInt -> FunPtr (CInt -> Ptr Double -> Double) -> Double -> CInt -> TVVM 126 c_minimize:: CInt -> FunPtr (CInt -> Ptr Double -> Double) -> Double -> CInt -> TVVM
127 127
128---------------------------------------------------------------------------------- 128----------------------------------------------------------------------------------
@@ -179,7 +179,7 @@ minimizeVD method eps maxit istep tol f df xiv = unsafePerformIO $ do
179 freeHaskellFunPtr dfp 179 freeHaskellFunPtr dfp
180 return (sol,path) 180 return (sol,path)
181 181
182foreign import ccall unsafe "gsl-aux.h minimizeD" 182foreign import ccall safe "gsl-aux.h minimizeD"
183 c_minimizeD :: CInt 183 c_minimizeD :: CInt
184 -> FunPtr (CInt -> Ptr Double -> Double) 184 -> FunPtr (CInt -> Ptr Double -> Double)
185 -> FunPtr TVV 185 -> FunPtr TVV
diff --git a/lib/Numeric/GSL/ODE.hs b/lib/Numeric/GSL/ODE.hs
index 797ba3f..4d2beed 100644
--- a/lib/Numeric/GSL/ODE.hs
+++ b/lib/Numeric/GSL/ODE.hs
@@ -91,7 +91,7 @@ odeSolveV method h epsAbs epsRel f mbjac xiv ts = unsafePerformIO $ do
91 freeHaskellFunPtr fp 91 freeHaskellFunPtr fp
92 return sol 92 return sol
93 93
94foreign import ccall unsafe "ode" 94foreign import ccall safe "ode"
95 ode_c :: CInt -> Double -> Double -> Double -> FunPtr (Double -> TVV) -> FunPtr (Double -> TVM) -> TVVM 95 ode_c :: CInt -> Double -> Double -> Double -> FunPtr (Double -> TVV) -> FunPtr (Double -> TVM) -> TVVM
96 96
97------------------------------------------------------- 97-------------------------------------------------------
diff --git a/lib/Numeric/GSL/Root.hs b/lib/Numeric/GSL/Root.hs
index 4128846..cd2982a 100644
--- a/lib/Numeric/GSL/Root.hs
+++ b/lib/Numeric/GSL/Root.hs
@@ -91,7 +91,7 @@ rootGen m f xi epsabs maxit = unsafePerformIO $ do
91 return (take n $ drop 1 sol, path) 91 return (take n $ drop 1 sol, path)
92 92
93 93
94foreign import ccall unsafe "root" 94foreign import ccall safe "root"
95 c_root:: CInt -> FunPtr TVV -> Double -> CInt -> TVM 95 c_root:: CInt -> FunPtr TVV -> Double -> CInt -> TVM
96 96
97------------------------------------------------------------------------- 97-------------------------------------------------------------------------
@@ -130,7 +130,7 @@ rootJGen m f jac xi epsabs maxit = unsafePerformIO $ do
130 return (take n $ drop 1 sol, path) 130 return (take n $ drop 1 sol, path)
131 131
132 132
133foreign import ccall unsafe "rootj" 133foreign import ccall safe "rootj"
134 c_rootj:: CInt -> FunPtr TVV -> FunPtr TVM -> Double -> CInt -> TVM 134 c_rootj:: CInt -> FunPtr TVV -> FunPtr TVM -> Double -> CInt -> TVM
135 135
136------------------------------------------------------- 136-------------------------------------------------------