diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Data/Packed/Internal/Matrix.hs | 2 | ||||
-rw-r--r-- | lib/Data/Packed/Internal/Signatures.hs | 6 | ||||
-rw-r--r-- | lib/Data/Packed/Internal/Vector.hs | 2 | ||||
-rw-r--r-- | lib/Numeric/ContainerBoot.hs | 8 | ||||
-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 | 9 | ||||
-rw-r--r-- | lib/Numeric/GSL/Root.hs | 5 | ||||
-rw-r--r-- | lib/Numeric/GSL/Vector.hs | 2 | ||||
-rw-r--r-- | lib/Numeric/LinearAlgebra/Algorithms.hs | 10 | ||||
-rw-r--r-- | lib/Numeric/LinearAlgebra/LAPACK.hs | 2 |
16 files changed, 33 insertions, 27 deletions
diff --git a/lib/Data/Packed/Internal/Matrix.hs b/lib/Data/Packed/Internal/Matrix.hs index 9fbaf6d..5d05e50 100644 --- a/lib/Data/Packed/Internal/Matrix.hs +++ b/lib/Data/Packed/Internal/Matrix.hs | |||
@@ -44,7 +44,7 @@ import Foreign.Marshal.Array(newArray) | |||
44 | import Foreign.Ptr(Ptr, castPtr) | 44 | import Foreign.Ptr(Ptr, castPtr) |
45 | import Foreign.Storable(Storable, peekElemOff, pokeElemOff, poke, sizeOf) | 45 | import Foreign.Storable(Storable, peekElemOff, pokeElemOff, poke, sizeOf) |
46 | import Data.Complex(Complex) | 46 | import Data.Complex(Complex) |
47 | import Foreign.C.Types(CInt(..), CChar) | 47 | import Foreign.C.Types |
48 | import Foreign.C.String(newCString) | 48 | import Foreign.C.String(newCString) |
49 | import System.IO.Unsafe(unsafePerformIO) | 49 | import System.IO.Unsafe(unsafePerformIO) |
50 | 50 | ||
diff --git a/lib/Data/Packed/Internal/Signatures.hs b/lib/Data/Packed/Internal/Signatures.hs index b81efa4..2835720 100644 --- a/lib/Data/Packed/Internal/Signatures.hs +++ b/lib/Data/Packed/Internal/Signatures.hs | |||
@@ -14,9 +14,9 @@ | |||
14 | 14 | ||
15 | module Data.Packed.Internal.Signatures where | 15 | module Data.Packed.Internal.Signatures where |
16 | 16 | ||
17 | import Foreign | 17 | import Foreign.Ptr(Ptr) |
18 | import Data.Complex | 18 | import Data.Complex(Complex) |
19 | import Foreign.C.Types | 19 | import Foreign.C.Types(CInt) |
20 | 20 | ||
21 | type PF = Ptr Float -- | 21 | type PF = Ptr Float -- |
22 | type PD = Ptr Double -- | 22 | type PD = Ptr Double -- |
diff --git a/lib/Data/Packed/Internal/Vector.hs b/lib/Data/Packed/Internal/Vector.hs index e85ba6e..936479d 100644 --- a/lib/Data/Packed/Internal/Vector.hs +++ b/lib/Data/Packed/Internal/Vector.hs | |||
@@ -39,7 +39,7 @@ import Foreign.ForeignPtr(ForeignPtr, castForeignPtr) | |||
39 | import Foreign.Ptr(Ptr) | 39 | import Foreign.Ptr(Ptr) |
40 | import Foreign.Storable(Storable, peekElemOff, pokeElemOff, sizeOf) | 40 | import Foreign.Storable(Storable, peekElemOff, pokeElemOff, sizeOf) |
41 | import Foreign.C.String | 41 | import Foreign.C.String |
42 | import Foreign.C.Types(CInt(..),CChar) | 42 | import Foreign.C.Types |
43 | import Data.Complex | 43 | import Data.Complex |
44 | import Control.Monad(when) | 44 | import Control.Monad(when) |
45 | import System.IO.Unsafe(unsafePerformIO) | 45 | import System.IO.Unsafe(unsafePerformIO) |
diff --git a/lib/Numeric/ContainerBoot.hs b/lib/Numeric/ContainerBoot.hs index 6ce4760..d50dd36 100644 --- a/lib/Numeric/ContainerBoot.hs +++ b/lib/Numeric/ContainerBoot.hs | |||
@@ -1,11 +1,9 @@ | |||
1 | {-# LANGUAGE CPP #-} | ||
1 | {-# LANGUAGE TypeFamilies #-} | 2 | {-# LANGUAGE TypeFamilies #-} |
2 | {-# LANGUAGE FlexibleContexts #-} | 3 | {-# LANGUAGE FlexibleContexts #-} |
3 | {-# LANGUAGE FlexibleInstances #-} | 4 | {-# LANGUAGE FlexibleInstances #-} |
4 | {-# LANGUAGE MultiParamTypeClasses #-} | 5 | {-# LANGUAGE MultiParamTypeClasses #-} |
5 | {-# LANGUAGE UndecidableInstances #-} | 6 | {-# LANGUAGE UndecidableInstances #-} |
6 | #ifndef NOPOLYKINDS | ||
7 | {-# LANGUAGE PolyKinds #-} | ||
8 | #endif | ||
9 | 7 | ||
10 | ----------------------------------------------------------------------------- | 8 | ----------------------------------------------------------------------------- |
11 | -- | | 9 | -- | |
@@ -55,12 +53,12 @@ import Numeric.LinearAlgebra.LAPACK(multiplyR,multiplyC,multiplyF,multiplyQ) | |||
55 | 53 | ||
56 | ------------------------------------------------------------------- | 54 | ------------------------------------------------------------------- |
57 | 55 | ||
58 | type family IndexOf c | 56 | type family IndexOf (c :: * -> *) |
59 | 57 | ||
60 | type instance IndexOf Vector = Int | 58 | type instance IndexOf Vector = Int |
61 | type instance IndexOf Matrix = (Int,Int) | 59 | type instance IndexOf Matrix = (Int,Int) |
62 | 60 | ||
63 | type family ArgOf c a | 61 | type family ArgOf (c :: * -> *) a |
64 | 62 | ||
65 | type instance ArgOf Vector a = a -> a | 63 | type instance ArgOf Vector a = a -> a |
66 | type instance ArgOf Matrix a = a -> a -> a | 64 | type instance ArgOf Matrix a = a -> a -> a |
diff --git a/lib/Numeric/GSL/Differentiation.hs b/lib/Numeric/GSL/Differentiation.hs index 1df58a1..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 da5c0fc..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 5cc50dc..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 a59862a..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 a6c81ee..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 6fac640..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 86c8bab..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 c0318d7..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 |
@@ -19,13 +19,14 @@ module Numeric.GSL.Polynomials ( | |||
19 | polySolve | 19 | polySolve |
20 | ) where | 20 | ) where |
21 | 21 | ||
22 | #ifndef ABSTRACTCINT | ||
23 | import Foreign.C.Types(CInt(..)) | ||
24 | #endif | ||
25 | import Data.Packed.Internal | 22 | import Data.Packed.Internal |
26 | import Data.Complex | 23 | import Data.Complex |
27 | import System.IO.Unsafe (unsafePerformIO) | 24 | import System.IO.Unsafe (unsafePerformIO) |
28 | 25 | ||
26 | #if __GLASGOW_HASKELL__ >= 704 | ||
27 | import Foreign.C.Types (CInt(..)) | ||
28 | #endif | ||
29 | |||
29 | {- | 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, |
30 | the three solutions of x^3 + 8 = 0 | 31 | the three solutions of x^3 + 8 = 0 |
31 | 32 | ||
diff --git a/lib/Numeric/GSL/Root.hs b/lib/Numeric/GSL/Root.hs index 9969e8a..41f7fb3 100644 --- a/lib/Numeric/GSL/Root.hs +++ b/lib/Numeric/GSL/Root.hs | |||
@@ -52,9 +52,8 @@ module Numeric.GSL.Root ( | |||
52 | import Data.Packed.Internal | 52 | 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 | import Foreign.Ptr(FunPtr, freeHaskellFunPtr) | |
56 | import Foreign.Ptr(FunPtr, freeHaskellFunPtr) | 56 | import Foreign.C.Types |
57 | import Foreign.C.Types(CInt(..)) | ||
58 | import System.IO.Unsafe(unsafePerformIO) | 57 | import System.IO.Unsafe(unsafePerformIO) |
59 | 58 | ||
60 | ------------------------------------------------------------------------- | 59 | ------------------------------------------------------------------------- |
diff --git a/lib/Numeric/GSL/Vector.hs b/lib/Numeric/GSL/Vector.hs index d0f419b..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 9806d6f..e2ecd4d 100644 --- a/lib/Numeric/LinearAlgebra/Algorithms.hs +++ b/lib/Numeric/LinearAlgebra/Algorithms.hs | |||
@@ -568,11 +568,19 @@ epslist = [ (fromIntegral k, golubeps k k) | k <- [1..]] | |||
568 | 568 | ||
569 | geps delta = head [ k | (k,g) <- epslist, g<delta] | 569 | geps delta = head [ k | (k,g) <- epslist, g<delta] |
570 | 570 | ||
571 | |||
571 | {- | Matrix exponential. It uses a direct translation of Algorithm 11.3.1 in Golub & Van Loan, | 572 | {- | Matrix exponential. It uses a direct translation of Algorithm 11.3.1 in Golub & Van Loan, |
572 | based on a scaled Pade approximation. | 573 | based on a scaled Pade approximation. |
573 | -} | 574 | -} |
574 | expm :: Field t => Matrix t -> Matrix t | 575 | expm :: Field t => Matrix t -> Matrix t |
575 | expm m = iterate msq f !! j | 576 | expm = expGolub |
577 | |||
578 | expGolub :: ( Fractional t, Element t, Field t | ||
579 | , Normed Matrix t | ||
580 | , RealFrac (RealOf t) | ||
581 | , Floating (RealOf t) | ||
582 | ) => Matrix t -> Matrix t | ||
583 | expGolub m = iterate msq f !! j | ||
576 | where j = max 0 $ floor $ logBase 2 $ pnorm Infinity m | 584 | where j = max 0 $ floor $ logBase 2 $ pnorm Infinity m |
577 | a = m */ fromIntegral ((2::Int)^j) | 585 | a = m */ fromIntegral ((2::Int)^j) |
578 | q = geps eps -- 7 steps | 586 | q = geps eps -- 7 steps |
diff --git a/lib/Numeric/LinearAlgebra/LAPACK.hs b/lib/Numeric/LinearAlgebra/LAPACK.hs index 14e121b..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 | ||