diff options
author | Alberto Ruiz <aruiz@um.es> | 2007-11-23 13:25:42 +0000 |
---|---|---|
committer | Alberto Ruiz <aruiz@um.es> | 2007-11-23 13:25:42 +0000 |
commit | 30fdf02aff2ac1c4da2bb9292fc08cc8330580d0 (patch) | |
tree | 82b062214626c20922959c82581decb3df2ba5ec /lib/Numeric/GSL | |
parent | 48139eb50c9052406839ee8375e378374e973207 (diff) |
removed many -Wall warnings
Diffstat (limited to 'lib/Numeric/GSL')
-rw-r--r-- | lib/Numeric/GSL/Differentiation.hs | 2 | ||||
-rw-r--r-- | lib/Numeric/GSL/Matrix.hs | 24 | ||||
-rw-r--r-- | lib/Numeric/GSL/Minimization.hs | 27 | ||||
-rw-r--r-- | lib/Numeric/GSL/Special.hs | 2 |
4 files changed, 25 insertions, 30 deletions
diff --git a/lib/Numeric/GSL/Differentiation.hs b/lib/Numeric/GSL/Differentiation.hs index 09236bd..071704a 100644 --- a/lib/Numeric/GSL/Differentiation.hs +++ b/lib/Numeric/GSL/Differentiation.hs | |||
@@ -34,7 +34,7 @@ derivGen :: | |||
34 | derivGen c h f x = unsafePerformIO $ do | 34 | derivGen c h f x = unsafePerformIO $ do |
35 | r <- malloc | 35 | r <- malloc |
36 | e <- malloc | 36 | e <- malloc |
37 | fp <- mkfun (\x _ -> f x) | 37 | fp <- mkfun (\y _ -> f y) |
38 | c_deriv c fp x h r e // check "deriv" | 38 | c_deriv c fp x h r e // check "deriv" |
39 | vr <- peek r | 39 | vr <- peek r |
40 | ve <- peek e | 40 | ve <- peek e |
diff --git a/lib/Numeric/GSL/Matrix.hs b/lib/Numeric/GSL/Matrix.hs index 07d4660..d51728e 100644 --- a/lib/Numeric/GSL/Matrix.hs +++ b/lib/Numeric/GSL/Matrix.hs | |||
@@ -17,13 +17,13 @@ module Numeric.GSL.Matrix( | |||
17 | eigSg, eigHg, | 17 | eigSg, eigHg, |
18 | svdg, | 18 | svdg, |
19 | qr, qrPacked, unpackQR, | 19 | qr, qrPacked, unpackQR, |
20 | cholR, -- cholC, | 20 | cholR, cholC, |
21 | luSolveR, luSolveC, | 21 | luSolveR, luSolveC, |
22 | luR, luC | 22 | luR, luC |
23 | ) where | 23 | ) where |
24 | 24 | ||
25 | import Data.Packed.Internal | 25 | import Data.Packed.Internal |
26 | import Data.Packed.Matrix(fromLists,ident,takeDiag) | 26 | import Data.Packed.Matrix(ident) |
27 | import Numeric.GSL.Vector | 27 | import Numeric.GSL.Vector |
28 | import Foreign | 28 | import Foreign |
29 | import Complex | 29 | import Complex |
@@ -44,7 +44,7 @@ import Complex | |||
44 | 44 | ||
45 | -} | 45 | -} |
46 | eigSg :: Matrix Double -> (Vector Double, Matrix Double) | 46 | eigSg :: Matrix Double -> (Vector Double, Matrix Double) |
47 | eigSg = eigSg . cmat | 47 | eigSg = eigSg' . cmat |
48 | 48 | ||
49 | eigSg' m | 49 | eigSg' m |
50 | | r == 1 = (fromList [cdat m `at` 0], singleton 1) | 50 | | r == 1 = (fromList [cdat m `at` 0], singleton 1) |
@@ -159,24 +159,24 @@ qrPacked :: Matrix Double -> (Matrix Double, Vector Double) | |||
159 | qrPacked = qrPacked' . cmat | 159 | qrPacked = qrPacked' . cmat |
160 | 160 | ||
161 | qrPacked' x = unsafePerformIO $ do | 161 | qrPacked' x = unsafePerformIO $ do |
162 | qr <- createMatrix RowMajor r c | 162 | qrp <- createMatrix RowMajor r c |
163 | tau <- createVector (min r c) | 163 | tau <- createVector (min r c) |
164 | app3 c_qrPacked mat x mat qr vec tau "qrUnpacked" | 164 | app3 c_qrPacked mat x mat qrp vec tau "qrUnpacked" |
165 | return (qr,tau) | 165 | return (qrp,tau) |
166 | where r = rows x | 166 | where r = rows x |
167 | c = cols x | 167 | c = cols x |
168 | foreign import ccall "gsl-aux.h QRpacked" c_qrPacked :: TMMV | 168 | foreign import ccall "gsl-aux.h QRpacked" c_qrPacked :: TMMV |
169 | 169 | ||
170 | unpackQR :: (Matrix Double, Vector Double) -> (Matrix Double, Matrix Double) | 170 | unpackQR :: (Matrix Double, Vector Double) -> (Matrix Double, Matrix Double) |
171 | unpackQR (qr,tau) = unpackQR' (cmat qr, tau) | 171 | unpackQR (qrp,tau) = unpackQR' (cmat qrp, tau) |
172 | 172 | ||
173 | unpackQR' (qr,tau) = unsafePerformIO $ do | 173 | unpackQR' (qrp,tau) = unsafePerformIO $ do |
174 | q <- createMatrix RowMajor r r | 174 | q <- createMatrix RowMajor r r |
175 | res <- createMatrix RowMajor r c | 175 | res <- createMatrix RowMajor r c |
176 | app4 c_qrUnpack mat qr vec tau mat q mat res "qrUnpack" | 176 | app4 c_qrUnpack mat qrp vec tau mat q mat res "qrUnpack" |
177 | return (q,res) | 177 | return (q,res) |
178 | where r = rows qr | 178 | where r = rows qrp |
179 | c = cols qr | 179 | c = cols qrp |
180 | foreign import ccall "gsl-aux.h QRunpack" c_qrUnpack :: TMVMM | 180 | foreign import ccall "gsl-aux.h QRunpack" c_qrUnpack :: TMVMM |
181 | 181 | ||
182 | 182 | ||
@@ -259,7 +259,6 @@ luRaux' x = unsafePerformIO $ do | |||
259 | app2 c_luRaux mat x vec res "luRaux" | 259 | app2 c_luRaux mat x vec res "luRaux" |
260 | return res | 260 | return res |
261 | where r = rows x | 261 | where r = rows x |
262 | c = cols x | ||
263 | foreign import ccall "gsl-aux.h luRaux" c_luRaux :: TMV | 262 | foreign import ccall "gsl-aux.h luRaux" c_luRaux :: TMV |
264 | 263 | ||
265 | {- | lu decomposition of complex matrix (packed as a vector including l, u, the permutation and sign) | 264 | {- | lu decomposition of complex matrix (packed as a vector including l, u, the permutation and sign) |
@@ -272,7 +271,6 @@ luCaux' x = unsafePerformIO $ do | |||
272 | app2 c_luCaux mat x vec res "luCaux" | 271 | app2 c_luCaux mat x vec res "luCaux" |
273 | return res | 272 | return res |
274 | where r = rows x | 273 | where r = rows x |
275 | c = cols x | ||
276 | foreign import ccall "gsl-aux.h luCaux" c_luCaux :: TCMCV | 274 | foreign import ccall "gsl-aux.h luCaux" c_luCaux :: TCMCV |
277 | 275 | ||
278 | {- | The LU decomposition of a square matrix. Is based on /gsl_linalg_LU_decomp/ and /gsl_linalg_complex_LU_decomp/ as described in <http://www.gnu.org/software/Numeric.GSL/manual/Numeric.GSL-ref_13.html#SEC223>. | 276 | {- | The LU decomposition of a square matrix. Is based on /gsl_linalg_LU_decomp/ and /gsl_linalg_complex_LU_decomp/ as described in <http://www.gnu.org/software/Numeric.GSL/manual/Numeric.GSL-ref_13.html#SEC223>. |
diff --git a/lib/Numeric/GSL/Minimization.hs b/lib/Numeric/GSL/Minimization.hs index 235a88f..98c0ca9 100644 --- a/lib/Numeric/GSL/Minimization.hs +++ b/lib/Numeric/GSL/Minimization.hs | |||
@@ -24,7 +24,6 @@ module Numeric.GSL.Minimization ( | |||
24 | import Data.Packed.Internal | 24 | import Data.Packed.Internal |
25 | import Data.Packed.Matrix | 25 | import Data.Packed.Matrix |
26 | import Foreign | 26 | import Foreign |
27 | import Complex | ||
28 | 27 | ||
29 | ------------------------------------------------------------------------- | 28 | ------------------------------------------------------------------------- |
30 | 29 | ||
@@ -84,9 +83,9 @@ minimizeNMSimplex f xi sz tol maxit = unsafePerformIO $ do | |||
84 | szv = fromList sz | 83 | szv = fromList sz |
85 | n = dim xiv | 84 | n = dim xiv |
86 | fp <- mkVecfun (iv (f.toList)) | 85 | fp <- mkVecfun (iv (f.toList)) |
87 | rawpath <- ww2 withVector xiv withVector szv $ \xiv szv -> | 86 | rawpath <- ww2 withVector xiv withVector szv $ \xiv' szv' -> |
88 | createMIO maxit (n+3) | 87 | createMIO maxit (n+3) |
89 | (c_minimizeNMSimplex fp tol maxit // xiv // szv) | 88 | (c_minimizeNMSimplex fp tol maxit // xiv' // szv') |
90 | "minimizeNMSimplex" | 89 | "minimizeNMSimplex" |
91 | let it = round (rawpath @@> (maxit-1,0)) | 90 | let it = round (rawpath @@> (maxit-1,0)) |
92 | path = takeRows it rawpath | 91 | path = takeRows it rawpath |
@@ -150,9 +149,9 @@ minimizeConjugateGradient istep minimpar tol maxit f df xi = unsafePerformIO $ d | |||
150 | df' = (fromList . df . toList) | 149 | df' = (fromList . df . toList) |
151 | fp <- mkVecfun (iv f') | 150 | fp <- mkVecfun (iv f') |
152 | dfp <- mkVecVecfun (aux_vTov df') | 151 | dfp <- mkVecVecfun (aux_vTov df') |
153 | rawpath <- withVector xiv $ \xiv -> | 152 | rawpath <- withVector xiv $ \xiv' -> |
154 | createMIO maxit (n+2) | 153 | createMIO maxit (n+2) |
155 | (c_minimizeConjugateGradient fp dfp istep minimpar tol maxit // xiv) | 154 | (c_minimizeConjugateGradient fp dfp istep minimpar tol maxit // xiv') |
156 | "minimizeDerivV" | 155 | "minimizeDerivV" |
157 | let it = round (rawpath @@> (maxit-1,0)) | 156 | let it = round (rawpath @@> (maxit-1,0)) |
158 | path = takeRows it rawpath | 157 | path = takeRows it rawpath |
@@ -171,8 +170,8 @@ foreign import ccall "gsl-aux.h minimizeWithDeriv" | |||
171 | --------------------------------------------------------------------- | 170 | --------------------------------------------------------------------- |
172 | iv :: (Vector Double -> Double) -> (Int -> Ptr Double -> Double) | 171 | iv :: (Vector Double -> Double) -> (Int -> Ptr Double -> Double) |
173 | iv f n p = f (createV n copy "iv") where | 172 | iv f n p = f (createV n copy "iv") where |
174 | copy n q = do | 173 | copy n' q = do |
175 | copyArray q p n | 174 | copyArray q p n' |
176 | return 0 | 175 | return 0 |
177 | 176 | ||
178 | -- | conversion of Haskell functions into function pointers that can be used in the C side | 177 | -- | conversion of Haskell functions into function pointers that can be used in the C side |
@@ -187,12 +186,12 @@ foreign import ccall "wrapper" | |||
187 | 186 | ||
188 | aux_vTov :: (Vector Double -> Vector Double) -> (Int -> Ptr Double -> Ptr Double -> IO()) | 187 | aux_vTov :: (Vector Double -> Vector Double) -> (Int -> Ptr Double -> Ptr Double -> IO()) |
189 | aux_vTov f n p r = g where | 188 | aux_vTov f n p r = g where |
190 | v@V {fptr = pr} = f x | 189 | V {fptr = pr} = f x |
191 | x = createV n copy "aux_vTov" | 190 | x = createV n copy "aux_vTov" |
192 | copy n q = do | 191 | copy n' q = do |
193 | copyArray q p n | 192 | copyArray q p n' |
194 | return 0 | 193 | return 0 |
195 | g = withForeignPtr pr $ \p -> copyArray r p n | 194 | g = withForeignPtr pr $ \p' -> copyArray r p' n |
196 | 195 | ||
197 | -------------------------------------------------------------------- | 196 | -------------------------------------------------------------------- |
198 | 197 | ||
@@ -202,6 +201,6 @@ createV n fun msg = unsafePerformIO $ do | |||
202 | return r | 201 | return r |
203 | 202 | ||
204 | createMIO r c fun msg = do | 203 | createMIO r c fun msg = do |
205 | r <- createMatrix RowMajor r c | 204 | res <- createMatrix RowMajor r c |
206 | app1 fun mat r msg | 205 | app1 fun mat res msg |
207 | return r | 206 | return res |
diff --git a/lib/Numeric/GSL/Special.hs b/lib/Numeric/GSL/Special.hs index b6cea2b..3fd2ac2 100644 --- a/lib/Numeric/GSL/Special.hs +++ b/lib/Numeric/GSL/Special.hs | |||
@@ -44,8 +44,6 @@ module Numeric.GSL.Special ( | |||
44 | ) | 44 | ) |
45 | where | 45 | where |
46 | 46 | ||
47 | import Foreign | ||
48 | import Numeric.GSL.Special.Internal | ||
49 | import Numeric.GSL.Special.Airy | 47 | import Numeric.GSL.Special.Airy |
50 | import Numeric.GSL.Special.Bessel | 48 | import Numeric.GSL.Special.Bessel |
51 | import Numeric.GSL.Special.Clausen | 49 | import Numeric.GSL.Special.Clausen |