diff options
author | Alberto Ruiz <aruiz@um.es> | 2011-12-25 03:33:01 -0800 |
---|---|---|
committer | Alberto Ruiz <aruiz@um.es> | 2011-12-25 03:33:01 -0800 |
commit | ea4da824ebc0ad09431aa276d8d44e4908e542c0 (patch) | |
tree | 950e968a34d46011476bb7fe0adf25c2f6c37ae4 /lib/Numeric | |
parent | c3bda2d38c432fb53ce456cba295b097fd4d6ad1 (diff) | |
parent | 43956aff360476d095b03fbbdef20f18df2dc933 (diff) |
Merge pull request #1 from basvandijk/master
Fix build on GHC-7.4.1-rc1 and some other patches
Diffstat (limited to 'lib/Numeric')
-rw-r--r-- | lib/Numeric/ContainerBoot.hs | 9 | ||||
-rw-r--r-- | lib/Numeric/GSL/Differentiation.hs | 2 | ||||
-rw-r--r-- | lib/Numeric/GSL/Fitting.hs | 2 | ||||
-rw-r--r-- | lib/Numeric/GSL/Fourier.hs | 2 | ||||
-rw-r--r-- | lib/Numeric/GSL/Integration.hs | 2 | ||||
-rw-r--r-- | lib/Numeric/GSL/Internal.hs | 2 | ||||
-rw-r--r-- | lib/Numeric/GSL/Minimization.hs | 2 | ||||
-rw-r--r-- | lib/Numeric/GSL/ODE.hs | 2 | ||||
-rw-r--r-- | lib/Numeric/GSL/Polynomials.hs | 6 | ||||
-rw-r--r-- | lib/Numeric/GSL/Root.hs | 4 | ||||
-rw-r--r-- | lib/Numeric/GSL/Vector.hs | 2 | ||||
-rw-r--r-- | lib/Numeric/LinearAlgebra/Algorithms.hs | 5 | ||||
-rw-r--r-- | lib/Numeric/LinearAlgebra/LAPACK.hs | 2 |
13 files changed, 28 insertions, 14 deletions
diff --git a/lib/Numeric/ContainerBoot.hs b/lib/Numeric/ContainerBoot.hs index a605545..0215711 100644 --- a/lib/Numeric/ContainerBoot.hs +++ b/lib/Numeric/ContainerBoot.hs | |||
@@ -1,3 +1,4 @@ | |||
1 | {-# LANGUAGE CPP #-} | ||
1 | {-# LANGUAGE TypeFamilies #-} | 2 | {-# LANGUAGE TypeFamilies #-} |
2 | {-# LANGUAGE FlexibleContexts #-} | 3 | {-# LANGUAGE FlexibleContexts #-} |
3 | {-# LANGUAGE FlexibleInstances #-} | 4 | {-# LANGUAGE FlexibleInstances #-} |
@@ -50,6 +51,10 @@ import Numeric.Conversion | |||
50 | import Data.Packed.Internal | 51 | import Data.Packed.Internal |
51 | import Numeric.GSL.Vector | 52 | import Numeric.GSL.Vector |
52 | 53 | ||
54 | #if __GLASGOW_HASKELL__ >= 704 | ||
55 | import Foreign.C.Types(CInt(..)) | ||
56 | #endif | ||
57 | |||
53 | import Data.Complex | 58 | import Data.Complex |
54 | import Control.Monad(ap) | 59 | import Control.Monad(ap) |
55 | 60 | ||
@@ -59,12 +64,12 @@ import System.IO.Unsafe | |||
59 | 64 | ||
60 | ------------------------------------------------------------------- | 65 | ------------------------------------------------------------------- |
61 | 66 | ||
62 | type family IndexOf c | 67 | type family IndexOf (c :: * -> *) |
63 | 68 | ||
64 | type instance IndexOf Vector = Int | 69 | type instance IndexOf Vector = Int |
65 | type instance IndexOf Matrix = (Int,Int) | 70 | type instance IndexOf Matrix = (Int,Int) |
66 | 71 | ||
67 | type family ArgOf c a | 72 | type family ArgOf (c :: * -> *) a |
68 | 73 | ||
69 | type instance ArgOf Vector a = a -> a | 74 | type instance ArgOf Vector a = a -> a |
70 | type instance ArgOf Matrix a = a -> a -> a | 75 | type instance ArgOf Matrix a = a -> a -> a |
diff --git a/lib/Numeric/GSL/Differentiation.hs b/lib/Numeric/GSL/Differentiation.hs index a3c1aea..ab5eb50 100644 --- a/lib/Numeric/GSL/Differentiation.hs +++ b/lib/Numeric/GSL/Differentiation.hs | |||
@@ -22,7 +22,7 @@ module Numeric.GSL.Differentiation ( | |||
22 | derivBackward | 22 | derivBackward |
23 | ) where | 23 | ) where |
24 | 24 | ||
25 | import Foreign.C.Types(CInt) | 25 | import Foreign.C.Types |
26 | import Foreign.Marshal.Alloc(malloc, free) | 26 | import Foreign.Marshal.Alloc(malloc, free) |
27 | import Foreign.Ptr(Ptr, FunPtr, freeHaskellFunPtr) | 27 | import Foreign.Ptr(Ptr, FunPtr, freeHaskellFunPtr) |
28 | import Foreign.Storable(peek) | 28 | import Foreign.Storable(peek) |
diff --git a/lib/Numeric/GSL/Fitting.hs b/lib/Numeric/GSL/Fitting.hs index 337dc6a..79db23f 100644 --- a/lib/Numeric/GSL/Fitting.hs +++ b/lib/Numeric/GSL/Fitting.hs | |||
@@ -54,7 +54,7 @@ import Numeric.LinearAlgebra | |||
54 | import Numeric.GSL.Internal | 54 | import Numeric.GSL.Internal |
55 | 55 | ||
56 | import Foreign.Ptr(FunPtr, freeHaskellFunPtr) | 56 | import Foreign.Ptr(FunPtr, freeHaskellFunPtr) |
57 | import Foreign.C.Types(CInt) | 57 | import Foreign.C.Types |
58 | import System.IO.Unsafe(unsafePerformIO) | 58 | import System.IO.Unsafe(unsafePerformIO) |
59 | 59 | ||
60 | ------------------------------------------------------------------------- | 60 | ------------------------------------------------------------------------- |
diff --git a/lib/Numeric/GSL/Fourier.hs b/lib/Numeric/GSL/Fourier.hs index 25487d4..71bc8a1 100644 --- a/lib/Numeric/GSL/Fourier.hs +++ b/lib/Numeric/GSL/Fourier.hs | |||
@@ -22,7 +22,7 @@ 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.C.Types(CInt) | 25 | import Foreign.C.Types |
26 | import System.IO.Unsafe (unsafePerformIO) | 26 | import System.IO.Unsafe (unsafePerformIO) |
27 | 27 | ||
28 | genfft code v = unsafePerformIO $ do | 28 | genfft code v = unsafePerformIO $ do |
diff --git a/lib/Numeric/GSL/Integration.hs b/lib/Numeric/GSL/Integration.hs index 84e8546..a0e922b 100644 --- a/lib/Numeric/GSL/Integration.hs +++ b/lib/Numeric/GSL/Integration.hs | |||
@@ -20,7 +20,7 @@ module Numeric.GSL.Integration ( | |||
20 | integrateQAGS | 20 | integrateQAGS |
21 | ) where | 21 | ) where |
22 | 22 | ||
23 | import Foreign.C.Types(CInt) | 23 | import Foreign.C.Types |
24 | import Foreign.Marshal.Alloc(malloc, free) | 24 | import Foreign.Marshal.Alloc(malloc, free) |
25 | import Foreign.Ptr(Ptr, FunPtr, freeHaskellFunPtr) | 25 | import Foreign.Ptr(Ptr, FunPtr, freeHaskellFunPtr) |
26 | import Foreign.Storable(peek) | 26 | import Foreign.Storable(peek) |
diff --git a/lib/Numeric/GSL/Internal.hs b/lib/Numeric/GSL/Internal.hs index db2c633..303e7e1 100644 --- a/lib/Numeric/GSL/Internal.hs +++ b/lib/Numeric/GSL/Internal.hs | |||
@@ -16,7 +16,7 @@ import Data.Packed.Internal | |||
16 | 16 | ||
17 | import Foreign.Marshal.Array(copyArray) | 17 | import Foreign.Marshal.Array(copyArray) |
18 | import Foreign.Ptr(Ptr, FunPtr) | 18 | import Foreign.Ptr(Ptr, FunPtr) |
19 | import Foreign.C.Types(CInt) | 19 | import Foreign.C.Types |
20 | import System.IO.Unsafe(unsafePerformIO) | 20 | import System.IO.Unsafe(unsafePerformIO) |
21 | 21 | ||
22 | iv :: (Vector Double -> Double) -> (CInt -> Ptr Double -> Double) | 22 | iv :: (Vector Double -> Double) -> (CInt -> Ptr Double -> Double) |
diff --git a/lib/Numeric/GSL/Minimization.hs b/lib/Numeric/GSL/Minimization.hs index 5770c91..88acfac 100644 --- a/lib/Numeric/GSL/Minimization.hs +++ b/lib/Numeric/GSL/Minimization.hs | |||
@@ -65,7 +65,7 @@ import Data.Packed.Matrix | |||
65 | import Numeric.GSL.Internal | 65 | import Numeric.GSL.Internal |
66 | 66 | ||
67 | import Foreign.Ptr(Ptr, FunPtr, freeHaskellFunPtr) | 67 | import Foreign.Ptr(Ptr, FunPtr, freeHaskellFunPtr) |
68 | import Foreign.C.Types(CInt) | 68 | import Foreign.C.Types |
69 | import System.IO.Unsafe(unsafePerformIO) | 69 | import System.IO.Unsafe(unsafePerformIO) |
70 | 70 | ||
71 | ------------------------------------------------------------------------ | 71 | ------------------------------------------------------------------------ |
diff --git a/lib/Numeric/GSL/ODE.hs b/lib/Numeric/GSL/ODE.hs index ea064d6..2251acd 100644 --- a/lib/Numeric/GSL/ODE.hs +++ b/lib/Numeric/GSL/ODE.hs | |||
@@ -36,7 +36,7 @@ import Data.Packed.Internal | |||
36 | import Numeric.GSL.Internal | 36 | import Numeric.GSL.Internal |
37 | 37 | ||
38 | import Foreign.Ptr(FunPtr, nullFunPtr, freeHaskellFunPtr) | 38 | import Foreign.Ptr(FunPtr, nullFunPtr, freeHaskellFunPtr) |
39 | import Foreign.C.Types(CInt) | 39 | import Foreign.C.Types |
40 | import System.IO.Unsafe(unsafePerformIO) | 40 | import System.IO.Unsafe(unsafePerformIO) |
41 | 41 | ||
42 | ------------------------------------------------------------------------- | 42 | ------------------------------------------------------------------------- |
diff --git a/lib/Numeric/GSL/Polynomials.hs b/lib/Numeric/GSL/Polynomials.hs index 9885920..b21b1b6 100644 --- a/lib/Numeric/GSL/Polynomials.hs +++ b/lib/Numeric/GSL/Polynomials.hs | |||
@@ -1,4 +1,4 @@ | |||
1 | {-# LANGUAGE ForeignFunctionInterface #-} | 1 | {-# LANGUAGE CPP, ForeignFunctionInterface #-} |
2 | ----------------------------------------------------------------------------- | 2 | ----------------------------------------------------------------------------- |
3 | {- | | 3 | {- | |
4 | Module : Numeric.GSL.Polynomials | 4 | Module : Numeric.GSL.Polynomials |
@@ -23,6 +23,10 @@ import Data.Packed.Internal | |||
23 | import Data.Complex | 23 | import Data.Complex |
24 | import System.IO.Unsafe (unsafePerformIO) | 24 | import System.IO.Unsafe (unsafePerformIO) |
25 | 25 | ||
26 | #if __GLASGOW_HASKELL__ >= 704 | ||
27 | import Foreign.C.Types (CInt(..)) | ||
28 | #endif | ||
29 | |||
26 | {- | Solution of general polynomial equations, using /gsl_poly_complex_solve/. For example, | 30 | {- | Solution of general polynomial equations, using /gsl_poly_complex_solve/. For example, |
27 | the three solutions of x^3 + 8 = 0 | 31 | the three solutions of x^3 + 8 = 0 |
28 | 32 | ||
diff --git a/lib/Numeric/GSL/Root.hs b/lib/Numeric/GSL/Root.hs index 784bbd4..9c2e5ab 100644 --- a/lib/Numeric/GSL/Root.hs +++ b/lib/Numeric/GSL/Root.hs | |||
@@ -53,8 +53,8 @@ import Data.Packed.Internal | |||
53 | import Data.Packed.Matrix | 53 | import Data.Packed.Matrix |
54 | import Numeric.GSL.Internal | 54 | import Numeric.GSL.Internal |
55 | 55 | ||
56 | import Foreign.Ptr(FunPtr, freeHaskellFunPtr) | 56 | import Foreign.Ptr(FunPtr, freeHaskellFunPtr) |
57 | import Foreign.C.Types(CInt) | 57 | import Foreign.C.Types |
58 | import System.IO.Unsafe(unsafePerformIO) | 58 | import System.IO.Unsafe(unsafePerformIO) |
59 | 59 | ||
60 | ------------------------------------------------------------------------- | 60 | ------------------------------------------------------------------------- |
diff --git a/lib/Numeric/GSL/Vector.hs b/lib/Numeric/GSL/Vector.hs index e912953..b8c6d04 100644 --- a/lib/Numeric/GSL/Vector.hs +++ b/lib/Numeric/GSL/Vector.hs | |||
@@ -31,7 +31,7 @@ import Data.Complex | |||
31 | import Foreign.Marshal.Alloc(free) | 31 | import Foreign.Marshal.Alloc(free) |
32 | import Foreign.Marshal.Array(newArray) | 32 | import Foreign.Marshal.Array(newArray) |
33 | import Foreign.Ptr(Ptr) | 33 | import Foreign.Ptr(Ptr) |
34 | import Foreign.C.Types(CInt) | 34 | import Foreign.C.Types |
35 | import System.IO.Unsafe(unsafePerformIO) | 35 | import System.IO.Unsafe(unsafePerformIO) |
36 | 36 | ||
37 | fromei x = fromIntegral (fromEnum x) :: CInt | 37 | fromei x = fromIntegral (fromEnum x) :: CInt |
diff --git a/lib/Numeric/LinearAlgebra/Algorithms.hs b/lib/Numeric/LinearAlgebra/Algorithms.hs index bea33ea..a6b4dae 100644 --- a/lib/Numeric/LinearAlgebra/Algorithms.hs +++ b/lib/Numeric/LinearAlgebra/Algorithms.hs | |||
@@ -567,6 +567,11 @@ epslist = [ (fromIntegral k, golubeps k k) | k <- [1..]] | |||
567 | 567 | ||
568 | geps delta = head [ k | (k,g) <- epslist, g<delta] | 568 | geps delta = head [ k | (k,g) <- epslist, g<delta] |
569 | 569 | ||
570 | expGolub :: ( Fractional t, Element t, Field t | ||
571 | , Normed Matrix t | ||
572 | , RealFrac (RealOf t) | ||
573 | , Floating (RealOf t) | ||
574 | ) => Matrix t -> Matrix t | ||
570 | expGolub m = iterate msq f !! j | 575 | expGolub m = iterate msq f !! j |
571 | where j = max 0 $ floor $ logBase 2 $ pnorm Infinity m | 576 | where j = max 0 $ floor $ logBase 2 $ pnorm Infinity m |
572 | a = m */ fromIntegral ((2::Int)^j) | 577 | a = m */ fromIntegral ((2::Int)^j) |
diff --git a/lib/Numeric/LinearAlgebra/LAPACK.hs b/lib/Numeric/LinearAlgebra/LAPACK.hs index 2fac1ee..d1aa564 100644 --- a/lib/Numeric/LinearAlgebra/LAPACK.hs +++ b/lib/Numeric/LinearAlgebra/LAPACK.hs | |||
@@ -47,7 +47,7 @@ import Numeric.Conversion | |||
47 | import Numeric.GSL.Vector(vectorMapValR, FunCodeSV(Scale)) | 47 | import Numeric.GSL.Vector(vectorMapValR, FunCodeSV(Scale)) |
48 | 48 | ||
49 | import Foreign.Ptr(nullPtr) | 49 | import Foreign.Ptr(nullPtr) |
50 | import Foreign.C.Types(CInt) | 50 | import Foreign.C.Types |
51 | import Control.Monad(when) | 51 | import Control.Monad(when) |
52 | import System.IO.Unsafe(unsafePerformIO) | 52 | import System.IO.Unsafe(unsafePerformIO) |
53 | 53 | ||