diff options
-rw-r--r-- | lib/Data/Packed/Internal/Matrix.hs | 12 | ||||
-rw-r--r-- | lib/Data/Packed/Internal/Vector.hs | 7 | ||||
-rw-r--r-- | lib/Data/Packed/Matrix.hs | 5 | ||||
-rw-r--r-- | lib/Data/Packed/ST.hs | 12 | ||||
-rw-r--r-- | lib/Numeric/GSL/Differentiation.hs | 5 | ||||
-rw-r--r-- | lib/Numeric/GSL/Fitting.hs | 6 | ||||
-rw-r--r-- | lib/Numeric/GSL/Fourier.hs | 2 | ||||
-rw-r--r-- | lib/Numeric/GSL/Integration.hs | 6 | ||||
-rw-r--r-- | lib/Numeric/GSL/Internal.hs | 5 | ||||
-rw-r--r-- | lib/Numeric/GSL/Minimization.hs | 6 | ||||
-rw-r--r-- | lib/Numeric/GSL/ODE.hs | 6 | ||||
-rw-r--r-- | lib/Numeric/GSL/Polynomials.hs | 2 | ||||
-rw-r--r-- | lib/Numeric/GSL/Root.hs | 6 | ||||
-rw-r--r-- | lib/Numeric/GSL/Vector.hs | 5 | ||||
-rw-r--r-- | lib/Numeric/LinearAlgebra/LAPACK.hs | 7 |
15 files changed, 65 insertions, 27 deletions
diff --git a/lib/Data/Packed/Internal/Matrix.hs b/lib/Data/Packed/Internal/Matrix.hs index 57142b7..d5fa5a0 100644 --- a/lib/Data/Packed/Internal/Matrix.hs +++ b/lib/Data/Packed/Internal/Matrix.hs | |||
@@ -39,10 +39,14 @@ import Data.Packed.Internal.Common | |||
39 | import Data.Packed.Internal.Signatures | 39 | import Data.Packed.Internal.Signatures |
40 | import Data.Packed.Internal.Vector | 40 | import Data.Packed.Internal.Vector |
41 | 41 | ||
42 | import Foreign hiding (xor) | 42 | import Foreign.Marshal.Alloc(alloca, free) |
43 | import Data.Complex | 43 | import Foreign.Marshal.Array(newArray) |
44 | import Foreign.C.Types | 44 | import Foreign.Ptr(Ptr, castPtr) |
45 | import Foreign.C.String | 45 | import Foreign.Storable(Storable, peekElemOff, pokeElemOff, poke, sizeOf) |
46 | import Data.Complex(Complex) | ||
47 | import Foreign.C.Types(CInt, CChar) | ||
48 | import Foreign.C.String(newCString) | ||
49 | import System.IO.Unsafe(unsafePerformIO) | ||
46 | 50 | ||
47 | ----------------------------------------------------------------- | 51 | ----------------------------------------------------------------- |
48 | 52 | ||
diff --git a/lib/Data/Packed/Internal/Vector.hs b/lib/Data/Packed/Internal/Vector.hs index 8f403f4..e5a7782 100644 --- a/lib/Data/Packed/Internal/Vector.hs +++ b/lib/Data/Packed/Internal/Vector.hs | |||
@@ -32,11 +32,16 @@ module Data.Packed.Internal.Vector ( | |||
32 | 32 | ||
33 | import Data.Packed.Internal.Common | 33 | import Data.Packed.Internal.Common |
34 | import Data.Packed.Internal.Signatures | 34 | import Data.Packed.Internal.Signatures |
35 | import Foreign | 35 | import Foreign.Marshal.Alloc(free) |
36 | import Foreign.Marshal.Array(peekArray, pokeArray, copyArray, advancePtr) | ||
37 | import Foreign.ForeignPtr(ForeignPtr, castForeignPtr) | ||
38 | import Foreign.Ptr(Ptr) | ||
39 | import Foreign.Storable(Storable, peekElemOff, pokeElemOff, sizeOf) | ||
36 | import Foreign.C.String | 40 | import Foreign.C.String |
37 | import Foreign.C.Types(CInt,CChar) | 41 | import Foreign.C.Types(CInt,CChar) |
38 | import Data.Complex | 42 | import Data.Complex |
39 | import Control.Monad(when) | 43 | import Control.Monad(when) |
44 | import System.IO.Unsafe(unsafePerformIO) | ||
40 | 45 | ||
41 | #if __GLASGOW_HASKELL__ >= 605 | 46 | #if __GLASGOW_HASKELL__ >= 605 |
42 | import GHC.ForeignPtr (mallocPlainForeignPtrBytes) | 47 | import GHC.ForeignPtr (mallocPlainForeignPtrBytes) |
diff --git a/lib/Data/Packed/Matrix.hs b/lib/Data/Packed/Matrix.hs index 0b23b2f..27fa36c 100644 --- a/lib/Data/Packed/Matrix.hs +++ b/lib/Data/Packed/Matrix.hs | |||
@@ -42,9 +42,10 @@ module Data.Packed.Matrix ( | |||
42 | 42 | ||
43 | import Data.Packed.Internal | 43 | import Data.Packed.Internal |
44 | import qualified Data.Packed.ST as ST | 44 | import qualified Data.Packed.ST as ST |
45 | import Data.List(transpose,intersperse) | ||
46 | import Data.Array | 45 | import Data.Array |
47 | import Foreign.Storable | 46 | |
47 | import Data.List(transpose,intersperse) | ||
48 | import Foreign.Storable(Storable) | ||
48 | import Control.Arrow((***)) | 49 | import Control.Arrow((***)) |
49 | 50 | ||
50 | ------------------------------------------------------------------- | 51 | ------------------------------------------------------------------- |
diff --git a/lib/Data/Packed/ST.hs b/lib/Data/Packed/ST.hs index 2fad6ae..22aff07 100644 --- a/lib/Data/Packed/ST.hs +++ b/lib/Data/Packed/ST.hs | |||
@@ -1,3 +1,4 @@ | |||
1 | {-# LANGUAGE CPP #-} | ||
1 | {-# LANGUAGE TypeOperators #-} | 2 | {-# LANGUAGE TypeOperators #-} |
2 | {-# LANGUAGE Rank2Types #-} | 3 | {-# LANGUAGE Rank2Types #-} |
3 | {-# LANGUAGE BangPatterns #-} | 4 | {-# LANGUAGE BangPatterns #-} |
@@ -33,8 +34,15 @@ module Data.Packed.ST ( | |||
33 | ) where | 34 | ) where |
34 | 35 | ||
35 | import Data.Packed.Internal | 36 | import Data.Packed.Internal |
36 | import Control.Monad.ST | 37 | |
37 | import Foreign | 38 | import Control.Monad.ST(ST, runST) |
39 | import Foreign.Storable(Storable, peekElemOff, pokeElemOff) | ||
40 | |||
41 | #if MIN_VERSION_base(4,4,0) | ||
42 | import Control.Monad.ST.Unsafe(unsafeIOToST) | ||
43 | #else | ||
44 | import Control.Monad.ST(unsafeIOToST) | ||
45 | #endif | ||
38 | 46 | ||
39 | {-# INLINE ioReadV #-} | 47 | {-# INLINE ioReadV #-} |
40 | ioReadV :: Storable t => Vector t -> Int -> IO t | 48 | ioReadV :: Storable t => Vector t -> Int -> IO t |
diff --git a/lib/Numeric/GSL/Differentiation.hs b/lib/Numeric/GSL/Differentiation.hs index ebbada0..a3c1aea 100644 --- a/lib/Numeric/GSL/Differentiation.hs +++ b/lib/Numeric/GSL/Differentiation.hs | |||
@@ -22,9 +22,12 @@ module Numeric.GSL.Differentiation ( | |||
22 | derivBackward | 22 | derivBackward |
23 | ) where | 23 | ) where |
24 | 24 | ||
25 | import Foreign | ||
26 | import Foreign.C.Types(CInt) | 25 | import Foreign.C.Types(CInt) |
26 | import Foreign.Marshal.Alloc(malloc, free) | ||
27 | import Foreign.Ptr(Ptr, FunPtr, freeHaskellFunPtr) | ||
28 | import Foreign.Storable(peek) | ||
27 | import Data.Packed.Internal(check,(//)) | 29 | import Data.Packed.Internal(check,(//)) |
30 | import System.IO.Unsafe(unsafePerformIO) | ||
28 | 31 | ||
29 | derivGen :: | 32 | derivGen :: |
30 | CInt -- ^ type: 0 central, 1 forward, 2 backward | 33 | CInt -- ^ type: 0 central, 1 forward, 2 backward |
diff --git a/lib/Numeric/GSL/Fitting.hs b/lib/Numeric/GSL/Fitting.hs index e5aa528..337dc6a 100644 --- a/lib/Numeric/GSL/Fitting.hs +++ b/lib/Numeric/GSL/Fitting.hs | |||
@@ -51,10 +51,12 @@ module Numeric.GSL.Fitting ( | |||
51 | 51 | ||
52 | import Data.Packed.Internal | 52 | import Data.Packed.Internal |
53 | import Numeric.LinearAlgebra | 53 | import Numeric.LinearAlgebra |
54 | import Foreign | ||
55 | import Foreign.C.Types(CInt) | ||
56 | import Numeric.GSL.Internal | 54 | import Numeric.GSL.Internal |
57 | 55 | ||
56 | import Foreign.Ptr(FunPtr, freeHaskellFunPtr) | ||
57 | import Foreign.C.Types(CInt) | ||
58 | import System.IO.Unsafe(unsafePerformIO) | ||
59 | |||
58 | ------------------------------------------------------------------------- | 60 | ------------------------------------------------------------------------- |
59 | 61 | ||
60 | data FittingMethod = LevenbergMarquardtScaled -- ^ Interface to gsl_multifit_fdfsolver_lmsder. This is a robust and efficient version of the Levenberg-Marquardt algorithm as implemented in the scaled lmder routine in minpack. Minpack was written by Jorge J. More, Burton S. Garbow and Kenneth E. Hillstrom. | 62 | data FittingMethod = LevenbergMarquardtScaled -- ^ Interface to gsl_multifit_fdfsolver_lmsder. This is a robust and efficient version of the Levenberg-Marquardt algorithm as implemented in the scaled lmder routine in minpack. Minpack was written by Jorge J. More, Burton S. Garbow and Kenneth E. Hillstrom. |
diff --git a/lib/Numeric/GSL/Fourier.hs b/lib/Numeric/GSL/Fourier.hs index 22782b7..25487d4 100644 --- a/lib/Numeric/GSL/Fourier.hs +++ b/lib/Numeric/GSL/Fourier.hs | |||
@@ -22,8 +22,8 @@ module Numeric.GSL.Fourier ( | |||
22 | 22 | ||
23 | import Data.Packed.Internal | 23 | import Data.Packed.Internal |
24 | import Data.Complex | 24 | import Data.Complex |
25 | import Foreign | ||
26 | import Foreign.C.Types(CInt) | 25 | import Foreign.C.Types(CInt) |
26 | import System.IO.Unsafe (unsafePerformIO) | ||
27 | 27 | ||
28 | genfft code v = unsafePerformIO $ do | 28 | genfft code v = unsafePerformIO $ do |
29 | r <- createVector (dim v) | 29 | r <- createVector (dim v) |
diff --git a/lib/Numeric/GSL/Integration.hs b/lib/Numeric/GSL/Integration.hs index 7103ea4..84e8546 100644 --- a/lib/Numeric/GSL/Integration.hs +++ b/lib/Numeric/GSL/Integration.hs | |||
@@ -20,10 +20,12 @@ module Numeric.GSL.Integration ( | |||
20 | integrateQAGS | 20 | integrateQAGS |
21 | ) where | 21 | ) where |
22 | 22 | ||
23 | import Foreign | ||
24 | import Foreign.C.Types(CInt) | 23 | import Foreign.C.Types(CInt) |
24 | import Foreign.Marshal.Alloc(malloc, free) | ||
25 | import Foreign.Ptr(Ptr, FunPtr, freeHaskellFunPtr) | ||
26 | import Foreign.Storable(peek) | ||
25 | import Data.Packed.Internal(check,(//)) | 27 | import Data.Packed.Internal(check,(//)) |
26 | 28 | import System.IO.Unsafe(unsafePerformIO) | |
27 | 29 | ||
28 | {- | conversion of Haskell functions into function pointers that can be used in the C side | 30 | {- | conversion of Haskell functions into function pointers that can be used in the C side |
29 | -} | 31 | -} |
diff --git a/lib/Numeric/GSL/Internal.hs b/lib/Numeric/GSL/Internal.hs index 2ccc3ef..db2c633 100644 --- a/lib/Numeric/GSL/Internal.hs +++ b/lib/Numeric/GSL/Internal.hs | |||
@@ -13,8 +13,11 @@ | |||
13 | module Numeric.GSL.Internal where | 13 | module Numeric.GSL.Internal where |
14 | 14 | ||
15 | import Data.Packed.Internal | 15 | import Data.Packed.Internal |
16 | import Foreign | 16 | |
17 | import Foreign.Marshal.Array(copyArray) | ||
18 | import Foreign.Ptr(Ptr, FunPtr) | ||
17 | import Foreign.C.Types(CInt) | 19 | import Foreign.C.Types(CInt) |
20 | import System.IO.Unsafe(unsafePerformIO) | ||
18 | 21 | ||
19 | iv :: (Vector Double -> Double) -> (CInt -> Ptr Double -> Double) | 22 | iv :: (Vector Double -> Double) -> (CInt -> Ptr Double -> Double) |
20 | iv f n p = f (createV (fromIntegral n) copy "iv") where | 23 | iv f n p = f (createV (fromIntegral n) copy "iv") where |
diff --git a/lib/Numeric/GSL/Minimization.hs b/lib/Numeric/GSL/Minimization.hs index 729f383..5770c91 100644 --- a/lib/Numeric/GSL/Minimization.hs +++ b/lib/Numeric/GSL/Minimization.hs | |||
@@ -62,10 +62,12 @@ module Numeric.GSL.Minimization ( | |||
62 | 62 | ||
63 | import Data.Packed.Internal | 63 | import Data.Packed.Internal |
64 | import Data.Packed.Matrix | 64 | import Data.Packed.Matrix |
65 | import Foreign | ||
66 | import Foreign.C.Types(CInt) | ||
67 | import Numeric.GSL.Internal | 65 | import Numeric.GSL.Internal |
68 | 66 | ||
67 | import Foreign.Ptr(Ptr, FunPtr, freeHaskellFunPtr) | ||
68 | import Foreign.C.Types(CInt) | ||
69 | import System.IO.Unsafe(unsafePerformIO) | ||
70 | |||
69 | ------------------------------------------------------------------------ | 71 | ------------------------------------------------------------------------ |
70 | 72 | ||
71 | {-# DEPRECATED minimizeNMSimplex "use minimize NMSimplex2 eps maxit sizes f xi" #-} | 73 | {-# DEPRECATED minimizeNMSimplex "use minimize NMSimplex2 eps maxit sizes f xi" #-} |
diff --git a/lib/Numeric/GSL/ODE.hs b/lib/Numeric/GSL/ODE.hs index 912e8a8..ea064d6 100644 --- a/lib/Numeric/GSL/ODE.hs +++ b/lib/Numeric/GSL/ODE.hs | |||
@@ -33,10 +33,12 @@ module Numeric.GSL.ODE ( | |||
33 | ) where | 33 | ) where |
34 | 34 | ||
35 | import Data.Packed.Internal | 35 | import Data.Packed.Internal |
36 | import Foreign | ||
37 | import Foreign.C.Types(CInt) | ||
38 | import Numeric.GSL.Internal | 36 | import Numeric.GSL.Internal |
39 | 37 | ||
38 | import Foreign.Ptr(FunPtr, nullFunPtr, freeHaskellFunPtr) | ||
39 | import Foreign.C.Types(CInt) | ||
40 | import System.IO.Unsafe(unsafePerformIO) | ||
41 | |||
40 | ------------------------------------------------------------------------- | 42 | ------------------------------------------------------------------------- |
41 | 43 | ||
42 | -- | Stepping functions | 44 | -- | Stepping functions |
diff --git a/lib/Numeric/GSL/Polynomials.hs b/lib/Numeric/GSL/Polynomials.hs index 19e8944..9885920 100644 --- a/lib/Numeric/GSL/Polynomials.hs +++ b/lib/Numeric/GSL/Polynomials.hs | |||
@@ -21,7 +21,7 @@ module Numeric.GSL.Polynomials ( | |||
21 | 21 | ||
22 | import Data.Packed.Internal | 22 | import Data.Packed.Internal |
23 | import Data.Complex | 23 | import Data.Complex |
24 | import Foreign | 24 | import System.IO.Unsafe (unsafePerformIO) |
25 | 25 | ||
26 | {- | Solution of general polynomial equations, using /gsl_poly_complex_solve/. For example, | 26 | {- | Solution of general polynomial equations, using /gsl_poly_complex_solve/. For example, |
27 | the three solutions of x^3 + 8 = 0 | 27 | the three solutions of x^3 + 8 = 0 |
diff --git a/lib/Numeric/GSL/Root.hs b/lib/Numeric/GSL/Root.hs index ddb090d..784bbd4 100644 --- a/lib/Numeric/GSL/Root.hs +++ b/lib/Numeric/GSL/Root.hs | |||
@@ -51,10 +51,12 @@ module Numeric.GSL.Root ( | |||
51 | 51 | ||
52 | import Data.Packed.Internal | 52 | import Data.Packed.Internal |
53 | import Data.Packed.Matrix | 53 | import Data.Packed.Matrix |
54 | import Foreign | ||
55 | import Foreign.C.Types(CInt) | ||
56 | import Numeric.GSL.Internal | 54 | import Numeric.GSL.Internal |
57 | 55 | ||
56 | import Foreign.Ptr(FunPtr, freeHaskellFunPtr) | ||
57 | import Foreign.C.Types(CInt) | ||
58 | import System.IO.Unsafe(unsafePerformIO) | ||
59 | |||
58 | ------------------------------------------------------------------------- | 60 | ------------------------------------------------------------------------- |
59 | 61 | ||
60 | data RootMethod = Hybrids | 62 | data RootMethod = Hybrids |
diff --git a/lib/Numeric/GSL/Vector.hs b/lib/Numeric/GSL/Vector.hs index 40abfa8..e912953 100644 --- a/lib/Numeric/GSL/Vector.hs +++ b/lib/Numeric/GSL/Vector.hs | |||
@@ -28,8 +28,11 @@ import Data.Packed.Internal.Signatures | |||
28 | import Data.Packed.Internal.Vector | 28 | import Data.Packed.Internal.Vector |
29 | 29 | ||
30 | import Data.Complex | 30 | import Data.Complex |
31 | import Foreign | 31 | import Foreign.Marshal.Alloc(free) |
32 | import Foreign.Marshal.Array(newArray) | ||
33 | import Foreign.Ptr(Ptr) | ||
32 | import Foreign.C.Types(CInt) | 34 | import Foreign.C.Types(CInt) |
35 | import System.IO.Unsafe(unsafePerformIO) | ||
33 | 36 | ||
34 | fromei x = fromIntegral (fromEnum x) :: CInt | 37 | fromei x = fromIntegral (fromEnum x) :: CInt |
35 | 38 | ||
diff --git a/lib/Numeric/LinearAlgebra/LAPACK.hs b/lib/Numeric/LinearAlgebra/LAPACK.hs index fbc5460..2fac1ee 100644 --- a/lib/Numeric/LinearAlgebra/LAPACK.hs +++ b/lib/Numeric/LinearAlgebra/LAPACK.hs | |||
@@ -43,12 +43,13 @@ module Numeric.LinearAlgebra.LAPACK ( | |||
43 | 43 | ||
44 | import Data.Packed.Internal | 44 | import Data.Packed.Internal |
45 | import Data.Packed.Matrix | 45 | import Data.Packed.Matrix |
46 | --import Data.Complex | ||
47 | import Numeric.Conversion | 46 | import Numeric.Conversion |
48 | import Numeric.GSL.Vector(vectorMapValR, FunCodeSV(Scale)) | 47 | import Numeric.GSL.Vector(vectorMapValR, FunCodeSV(Scale)) |
49 | import Foreign | 48 | |
50 | import Foreign.C.Types (CInt) | 49 | import Foreign.Ptr(nullPtr) |
50 | import Foreign.C.Types(CInt) | ||
51 | import Control.Monad(when) | 51 | import Control.Monad(when) |
52 | import System.IO.Unsafe(unsafePerformIO) | ||
52 | 53 | ||
53 | ----------------------------------------------------------------------------------- | 54 | ----------------------------------------------------------------------------------- |
54 | 55 | ||