summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Setup.lhs5
-rw-r--r--hmatrix.cabal15
-rw-r--r--lib/Data/Packed/Internal/Matrix.hs2
-rw-r--r--lib/Data/Packed/Internal/Signatures.hs6
-rw-r--r--lib/Data/Packed/Internal/Vector.hs2
-rw-r--r--lib/Numeric/ContainerBoot.hs9
-rw-r--r--lib/Numeric/GSL/Differentiation.hs2
-rw-r--r--lib/Numeric/GSL/Fitting.hs2
-rw-r--r--lib/Numeric/GSL/Fourier.hs2
-rw-r--r--lib/Numeric/GSL/Integration.hs2
-rw-r--r--lib/Numeric/GSL/Internal.hs2
-rw-r--r--lib/Numeric/GSL/Minimization.hs2
-rw-r--r--lib/Numeric/GSL/ODE.hs2
-rw-r--r--lib/Numeric/GSL/Polynomials.hs6
-rw-r--r--lib/Numeric/GSL/Root.hs4
-rw-r--r--lib/Numeric/GSL/Vector.hs2
-rw-r--r--lib/Numeric/LinearAlgebra/Algorithms.hs5
-rw-r--r--lib/Numeric/LinearAlgebra/LAPACK.hs2
18 files changed, 48 insertions, 24 deletions
diff --git a/Setup.lhs b/Setup.lhs
index ba435f0..0d80d1b 100644
--- a/Setup.lhs
+++ b/Setup.lhs
@@ -8,13 +8,10 @@
8> import System.Process(system) 8> import System.Process(system)
9> import Config(config) 9> import Config(config)
10 10
11> main = defaultMainWithHooks simpleUserHooks { confHook = c, runTests = t } 11> main = defaultMainWithHooks simpleUserHooks { confHook = c }
12 12
13> c x y = do 13> c x y = do
14> binfo <- confHook simpleUserHooks x y 14> binfo <- confHook simpleUserHooks x y
15> pbi <- config binfo 15> pbi <- config binfo
16> let pkg_descr = localPkgDescr binfo 16> let pkg_descr = localPkgDescr binfo
17> return $ binfo { localPkgDescr = updatePackageDescription pbi pkg_descr } 17> return $ binfo { localPkgDescr = updatePackageDescription pbi pkg_descr }
18
19> t _ _ _ _ = system ( "runhaskell examples/tests.hs") >> return()
20
diff --git a/hmatrix.cabal b/hmatrix.cabal
index bfe875d..63da6fb 100644
--- a/hmatrix.cabal
+++ b/hmatrix.cabal
@@ -23,7 +23,7 @@ Description: Purely functional interface to basic linear algebra
23Category: Math 23Category: Math
24tested-with: GHC ==6.10.4, GHC ==6.12.1, GHC ==6.12.3, GHC ==7.0.1, GHC==7.0.2, GHC==7.2.1 24tested-with: GHC ==6.10.4, GHC ==6.12.1, GHC ==6.12.3, GHC ==7.0.1, GHC==7.0.2, GHC==7.2.1
25 25
26cabal-version: >=1.6 26cabal-version: >=1.8
27 27
28build-type: Custom 28build-type: Custom
29 29
@@ -224,3 +224,16 @@ source-repository head
224-- type: exitcode-stdio-1.0 224-- type: exitcode-stdio-1.0
225-- main-is: examples/tests.hs 225-- main-is: examples/tests.hs
226 226
227test-suite test-hmatrix
228 type: exitcode-stdio-1.0
229 main-is: tests.hs
230 build-depends: hmatrix
231 , base
232 , QuickCheck
233 , storable-complex
234 , array
235 , process
236 , HUnit
237 , random
238 hs-source-dirs: lib, examples
239 Extensions: ForeignFunctionInterface, CPP
diff --git a/lib/Data/Packed/Internal/Matrix.hs b/lib/Data/Packed/Internal/Matrix.hs
index d5fa5a0..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)
44import Foreign.Ptr(Ptr, castPtr) 44import Foreign.Ptr(Ptr, castPtr)
45import Foreign.Storable(Storable, peekElemOff, pokeElemOff, poke, sizeOf) 45import Foreign.Storable(Storable, peekElemOff, pokeElemOff, poke, sizeOf)
46import Data.Complex(Complex) 46import Data.Complex(Complex)
47import Foreign.C.Types(CInt, CChar) 47import Foreign.C.Types
48import Foreign.C.String(newCString) 48import Foreign.C.String(newCString)
49import System.IO.Unsafe(unsafePerformIO) 49import 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
15module Data.Packed.Internal.Signatures where 15module Data.Packed.Internal.Signatures where
16 16
17import Foreign 17import Foreign.Ptr(Ptr)
18import Data.Complex 18import Data.Complex(Complex)
19import Foreign.C.Types 19import Foreign.C.Types(CInt)
20 20
21type PF = Ptr Float -- 21type PF = Ptr Float --
22type PD = Ptr Double -- 22type PD = Ptr Double --
diff --git a/lib/Data/Packed/Internal/Vector.hs b/lib/Data/Packed/Internal/Vector.hs
index 43b3fd8..b9dba8e 100644
--- a/lib/Data/Packed/Internal/Vector.hs
+++ b/lib/Data/Packed/Internal/Vector.hs
@@ -38,7 +38,7 @@ import Foreign.ForeignPtr(ForeignPtr, castForeignPtr)
38import Foreign.Ptr(Ptr) 38import Foreign.Ptr(Ptr)
39import Foreign.Storable(Storable, peekElemOff, pokeElemOff, sizeOf) 39import Foreign.Storable(Storable, peekElemOff, pokeElemOff, sizeOf)
40import Foreign.C.String 40import Foreign.C.String
41import Foreign.C.Types(CInt,CChar) 41import Foreign.C.Types
42import Data.Complex 42import Data.Complex
43import Control.Monad(when) 43import Control.Monad(when)
44import System.IO.Unsafe(unsafePerformIO) 44import System.IO.Unsafe(unsafePerformIO)
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
50import Data.Packed.Internal 51import Data.Packed.Internal
51import Numeric.GSL.Vector 52import Numeric.GSL.Vector
52 53
54#if __GLASGOW_HASKELL__ >= 704
55import Foreign.C.Types(CInt(..))
56#endif
57
53import Data.Complex 58import Data.Complex
54import Control.Monad(ap) 59import Control.Monad(ap)
55 60
@@ -59,12 +64,12 @@ import System.IO.Unsafe
59 64
60------------------------------------------------------------------- 65-------------------------------------------------------------------
61 66
62type family IndexOf c 67type family IndexOf (c :: * -> *)
63 68
64type instance IndexOf Vector = Int 69type instance IndexOf Vector = Int
65type instance IndexOf Matrix = (Int,Int) 70type instance IndexOf Matrix = (Int,Int)
66 71
67type family ArgOf c a 72type family ArgOf (c :: * -> *) a
68 73
69type instance ArgOf Vector a = a -> a 74type instance ArgOf Vector a = a -> a
70type instance ArgOf Matrix a = a -> a -> a 75type 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
25import Foreign.C.Types(CInt) 25import Foreign.C.Types
26import Foreign.Marshal.Alloc(malloc, free) 26import Foreign.Marshal.Alloc(malloc, free)
27import Foreign.Ptr(Ptr, FunPtr, freeHaskellFunPtr) 27import Foreign.Ptr(Ptr, FunPtr, freeHaskellFunPtr)
28import Foreign.Storable(peek) 28import 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
54import Numeric.GSL.Internal 54import Numeric.GSL.Internal
55 55
56import Foreign.Ptr(FunPtr, freeHaskellFunPtr) 56import Foreign.Ptr(FunPtr, freeHaskellFunPtr)
57import Foreign.C.Types(CInt) 57import Foreign.C.Types
58import System.IO.Unsafe(unsafePerformIO) 58import 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
23import Data.Packed.Internal 23import Data.Packed.Internal
24import Data.Complex 24import Data.Complex
25import Foreign.C.Types(CInt) 25import Foreign.C.Types
26import System.IO.Unsafe (unsafePerformIO) 26import System.IO.Unsafe (unsafePerformIO)
27 27
28genfft code v = unsafePerformIO $ do 28genfft 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
23import Foreign.C.Types(CInt) 23import Foreign.C.Types
24import Foreign.Marshal.Alloc(malloc, free) 24import Foreign.Marshal.Alloc(malloc, free)
25import Foreign.Ptr(Ptr, FunPtr, freeHaskellFunPtr) 25import Foreign.Ptr(Ptr, FunPtr, freeHaskellFunPtr)
26import Foreign.Storable(peek) 26import 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
17import Foreign.Marshal.Array(copyArray) 17import Foreign.Marshal.Array(copyArray)
18import Foreign.Ptr(Ptr, FunPtr) 18import Foreign.Ptr(Ptr, FunPtr)
19import Foreign.C.Types(CInt) 19import Foreign.C.Types
20import System.IO.Unsafe(unsafePerformIO) 20import System.IO.Unsafe(unsafePerformIO)
21 21
22iv :: (Vector Double -> Double) -> (CInt -> Ptr Double -> Double) 22iv :: (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
65import Numeric.GSL.Internal 65import Numeric.GSL.Internal
66 66
67import Foreign.Ptr(Ptr, FunPtr, freeHaskellFunPtr) 67import Foreign.Ptr(Ptr, FunPtr, freeHaskellFunPtr)
68import Foreign.C.Types(CInt) 68import Foreign.C.Types
69import System.IO.Unsafe(unsafePerformIO) 69import 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
36import Numeric.GSL.Internal 36import Numeric.GSL.Internal
37 37
38import Foreign.Ptr(FunPtr, nullFunPtr, freeHaskellFunPtr) 38import Foreign.Ptr(FunPtr, nullFunPtr, freeHaskellFunPtr)
39import Foreign.C.Types(CInt) 39import Foreign.C.Types
40import System.IO.Unsafe(unsafePerformIO) 40import 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{- |
4Module : Numeric.GSL.Polynomials 4Module : Numeric.GSL.Polynomials
@@ -23,6 +23,10 @@ import Data.Packed.Internal
23import Data.Complex 23import Data.Complex
24import System.IO.Unsafe (unsafePerformIO) 24import System.IO.Unsafe (unsafePerformIO)
25 25
26#if __GLASGOW_HASKELL__ >= 704
27import 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
53import Data.Packed.Matrix 53import Data.Packed.Matrix
54import Numeric.GSL.Internal 54import Numeric.GSL.Internal
55 55
56import Foreign.Ptr(FunPtr, freeHaskellFunPtr) 56import Foreign.Ptr(FunPtr, freeHaskellFunPtr)
57import Foreign.C.Types(CInt) 57import Foreign.C.Types
58import System.IO.Unsafe(unsafePerformIO) 58import 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
31import Foreign.Marshal.Alloc(free) 31import Foreign.Marshal.Alloc(free)
32import Foreign.Marshal.Array(newArray) 32import Foreign.Marshal.Array(newArray)
33import Foreign.Ptr(Ptr) 33import Foreign.Ptr(Ptr)
34import Foreign.C.Types(CInt) 34import Foreign.C.Types
35import System.IO.Unsafe(unsafePerformIO) 35import System.IO.Unsafe(unsafePerformIO)
36 36
37fromei x = fromIntegral (fromEnum x) :: CInt 37fromei 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
568geps delta = head [ k | (k,g) <- epslist, g<delta] 568geps delta = head [ k | (k,g) <- epslist, g<delta]
569 569
570expGolub :: ( Fractional t, Element t, Field t
571 , Normed Matrix t
572 , RealFrac (RealOf t)
573 , Floating (RealOf t)
574 ) => Matrix t -> Matrix t
570expGolub m = iterate msq f !! j 575expGolub 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
47import Numeric.GSL.Vector(vectorMapValR, FunCodeSV(Scale)) 47import Numeric.GSL.Vector(vectorMapValR, FunCodeSV(Scale))
48 48
49import Foreign.Ptr(nullPtr) 49import Foreign.Ptr(nullPtr)
50import Foreign.C.Types(CInt) 50import Foreign.C.Types
51import Control.Monad(when) 51import Control.Monad(when)
52import System.IO.Unsafe(unsafePerformIO) 52import System.IO.Unsafe(unsafePerformIO)
53 53