summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--INSTALL28
-rw-r--r--hmatrix.cabal11
-rw-r--r--hmatrix.cabal-windows154
-rw-r--r--lib/Data/Packed/Random.hs5
-rw-r--r--lib/Graphics/Plot.hs18
-rw-r--r--lib/Numeric/GSL.hs4
-rw-r--r--lib/Numeric/GSL/ODE.hs1
-rw-r--r--lib/Numeric/LinearAlgebra.hs6
-rw-r--r--lib/Numeric/LinearAlgebra/Algorithms.hs1
-rw-r--r--lib/Numeric/LinearAlgebra/Interface.hs29
-rw-r--r--lib/Numeric/LinearAlgebra/Linear.hs2
11 files changed, 76 insertions, 183 deletions
diff --git a/INSTALL b/INSTALL
index 98efbb8..f0426b0 100644
--- a/INSTALL
+++ b/INSTALL
@@ -7,7 +7,31 @@ Recommended method (ok in Ubuntu/Debian systems):
7Detailed installation instructions: 7Detailed installation instructions:
8 http://code.haskell.org/hmatrix/install.html 8 http://code.haskell.org/hmatrix/install.html
9 9
10INSTALLATION ON WINDOWS ---------------------------------------- 10INSTALLATION ON WINDOWS (hmatrix-0.9.x.x)
11
121) Install the Haskell Platform (tested with 2009.2.0.2).
13
142) Download and unzip the following file into a stable folder %GSL%
15
16 http://code.haskell.org/hmatrix/gsl-lapack-windows.zip
17
183.a) In a msys shell
19
20 $ cabal install hmatrix --extra-lib-dir=${GSL} --extra-include-dir=${GSL}
21
223.b) In a windows cmd
23
24 > cabal unpack hmatrix
25
26 Change build-type to "Simple" in hmatrix.cabal, line 18
27
28 > cabal install --extra-lib-dir=%GSL% --extra-include-dir=%GSL%
29
304) If everything is ok we can run the tests:
31
32 > runhaskell examples\tests.hs
33
34INSTALLATION ON WINDOWS (hmatrix-0.8.3.1)
11 35
121) Install the Haskell Platform (tested with 2009.2.0.2). 361) Install the Haskell Platform (tested with 2009.2.0.2).
13 37
@@ -24,7 +48,7 @@ INSTALLATION ON WINDOWS ----------------------------------------
244) Replace hmatrix.cabal by 484) Replace hmatrix.cabal by
25 49
26 http://code.haskell.org/hmatrix/hmatrix-0.8.3.1-windows.cabal 50 http://code.haskell.org/hmatrix/hmatrix-0.8.3.1-windows.cabal
27 51
285) In the hmatrix folder run 525) In the hmatrix folder run
29 53
30 > cabal install 54 > cabal install
diff --git a/hmatrix.cabal b/hmatrix.cabal
index 892b846..e684acc 100644
--- a/hmatrix.cabal
+++ b/hmatrix.cabal
@@ -1,5 +1,5 @@
1Name: hmatrix 1Name: hmatrix
2Version: 0.9.2.0 2Version: 0.9.3.0
3License: GPL 3License: GPL
4License-file: LICENSE 4License-file: LICENSE
5Author: Alberto Ruiz 5Author: Alberto Ruiz
@@ -10,6 +10,8 @@ Synopsis: Linear algebra and numerical computation
10Description: Purely functional interface to basic linear algebra 10Description: Purely functional interface to basic linear algebra
11 and other numerical computations, internally implemented using 11 and other numerical computations, internally implemented using
12 GSL, BLAS and LAPACK. 12 GSL, BLAS and LAPACK.
13 .
14 See also hmatrix-special and hmatrix-glpk.
13Category: Math 15Category: Math
14tested-with: GHC ==6.10.4, GHC ==6.12.1 16tested-with: GHC ==6.10.4, GHC ==6.12.1
15 17
@@ -89,8 +91,6 @@ library
89 Numeric.GSL, 91 Numeric.GSL,
90 Numeric.LinearAlgebra, 92 Numeric.LinearAlgebra,
91 Numeric.LinearAlgebra.LAPACK, 93 Numeric.LinearAlgebra.LAPACK,
92 Numeric.LinearAlgebra.Linear,
93 Numeric.LinearAlgebra.Instances,
94 Numeric.LinearAlgebra.Interface, 94 Numeric.LinearAlgebra.Interface,
95 Numeric.LinearAlgebra.Algorithms, 95 Numeric.LinearAlgebra.Algorithms,
96 Graphics.Plot, 96 Graphics.Plot,
@@ -103,6 +103,8 @@ library
103 Data.Packed.Internal.Signatures, 103 Data.Packed.Internal.Signatures,
104 Data.Packed.Internal.Vector, 104 Data.Packed.Internal.Vector,
105 Data.Packed.Internal.Matrix, 105 Data.Packed.Internal.Matrix,
106 Numeric.LinearAlgebra.Linear,
107 Numeric.LinearAlgebra.Instances,
106 Numeric.GSL.Internal 108 Numeric.GSL.Internal
107 109
108 C-sources: lib/Numeric/LinearAlgebra/LAPACK/lapack-aux.c, 110 C-sources: lib/Numeric/LinearAlgebra/LAPACK/lapack-aux.c,
@@ -141,6 +143,9 @@ library
141 extra-libraries: gsl 143 extra-libraries: gsl
142 frameworks: Accelerate 144 frameworks: Accelerate
143 145
146 if os(windows)
147 extra-libraries: gsl-0 blas lapack
148
144-- The extra-libraries required for GSL and LAPACK 149-- The extra-libraries required for GSL and LAPACK
145-- should now be automatically detected by configure(.hs) 150-- should now be automatically detected by configure(.hs)
146 151
diff --git a/hmatrix.cabal-windows b/hmatrix.cabal-windows
deleted file mode 100644
index 4dfaede..0000000
--- a/hmatrix.cabal-windows
+++ /dev/null
@@ -1,154 +0,0 @@
1Name: hmatrix
2Version: 0.9.2.0
3License: GPL
4License-file: LICENSE
5Author: Alberto Ruiz
6Maintainer: Alberto Ruiz <aruiz@um.es>
7Stability: provisional
8Homepage: http://code.haskell.org/hmatrix
9Synopsis: Linear algebra and numerical computation
10Description: Purely functional interface to basic linear algebra
11 and other numerical computations, internally implemented using
12 GSL, BLAS and LAPACK.
13Category: Math
14tested-with: GHC ==6.10.4, GHC ==6.12.1
15
16cabal-version: >=1.2
17
18build-type: Simple
19
20extra-source-files: lib/Numeric/LinearAlgebra/Tests/quickCheckCompat.h
21 configure configure.hs THANKS INSTALL CHANGES
22extra-tmp-files: hmatrix.buildinfo
23
24extra-source-files: examples/tests.hs
25 examples/deriv.hs
26 examples/integrate.hs
27 examples/minimize.hs
28 examples/root.hs
29 examples/ode.hs
30 examples/pca1.hs
31 examples/pca2.hs
32 examples/pinv.hs
33 examples/data.txt
34 examples/lie.hs
35 examples/kalman.hs
36 examples/parallel.hs
37 examples/plot.hs
38 examples/inplace.hs
39 examples/error.hs
40 examples/devel/ej1/wrappers.hs
41 examples/devel/ej1/functions.c
42 examples/devel/ej2/wrappers.hs
43 examples/devel/ej2/functions.c
44 examples/Real.hs
45 examples/vector.hs
46
47extra-source-files: lib/Numeric/LinearAlgebra/LAPACK/lapack-aux.h,
48 lib/Numeric/LinearAlgebra/LAPACK/clapack.h
49
50flag tests
51 description: Build tests
52 default: True
53
54flag dd
55 description: svd = zgesdd
56 default: True
57
58flag mkl
59 description: Link with Intel's MKL optimized libraries.
60 default: False
61
62flag unsafe
63 description: Compile the library with bound checking disabled.
64 default: False
65
66library
67
68 Build-Depends: base >= 4 && < 5,
69 array,
70 storable-complex,
71 process
72
73 Extensions: ForeignFunctionInterface,
74 CPP
75
76 hs-source-dirs: lib
77 Exposed-modules: Data.Packed,
78 Data.Packed.Vector,
79 Data.Packed.Matrix,
80 Numeric.GSL.Differentiation,
81 Numeric.GSL.Integration,
82 Numeric.GSL.Fourier,
83 Numeric.GSL.Polynomials,
84 Numeric.GSL.Minimization,
85 Numeric.GSL.Root,
86 Numeric.GSL.Fitting,
87 Numeric.GSL.ODE,
88 Numeric.GSL.Vector,
89 Numeric.GSL,
90 Numeric.LinearAlgebra,
91 Numeric.LinearAlgebra.LAPACK,
92 Numeric.LinearAlgebra.Linear,
93 Numeric.LinearAlgebra.Instances,
94 Numeric.LinearAlgebra.Interface,
95 Numeric.LinearAlgebra.Algorithms,
96 Graphics.Plot,
97 -- Data.Packed.Convert,
98 Data.Packed.ST,
99 Data.Packed.Development,
100 Data.Packed.Random
101 other-modules: Data.Packed.Internal,
102 Data.Packed.Internal.Common,
103 Data.Packed.Internal.Signatures,
104 Data.Packed.Internal.Vector,
105 Data.Packed.Internal.Matrix,
106 Numeric.GSL.Internal
107
108 C-sources: lib/Numeric/LinearAlgebra/LAPACK/lapack-aux.c,
109 lib/Numeric/GSL/gsl-aux.c
110
111 if flag(tests)
112 Build-Depends: QuickCheck, HUnit
113 exposed-modules: Numeric.LinearAlgebra.Tests
114 other-modules: Numeric.LinearAlgebra.Tests.Instances,
115 Numeric.LinearAlgebra.Tests.Properties
116
117 -- ghc-prof-options: -auto
118
119 ghc-options: -Wall -fno-warn-missing-signatures
120 -fno-warn-orphans
121 -fno-warn-unused-binds
122
123 if flag(unsafe)
124 cpp-options: -DUNSAFE
125
126 if !flag(dd)
127 cpp-options: -DNOZGESDD
128
129 if impl(ghc < 6.10.2)
130 cpp-options: -DFINIT
131
132 if flag(mkl)
133 if arch(x86_64)
134 extra-libraries: gsl mkl_lapack mkl_intel_lp64 mkl_sequential mkl_core
135 else
136 extra-libraries: gsl mkl_lapack mkl_intel mkl_sequential mkl_core
137
138 if os(OSX)
139 extra-lib-dirs: /opt/local/lib/
140 include-dirs: /opt/local/include
141 extra-libraries: gsl
142 frameworks: Accelerate
143
144-- The extra-libraries required for GSL and LAPACK
145-- should now be automatically detected by configure(.hs)
146
147 extra-libraries: gsl-0 blas lapack
148 extra-lib-dirs: c:\haskell\hmatrix-0.8.3.1\gsl-lapack-windows
149 extra-include-dirs: c:\haskell\hmatrix-0.8.3.1\gsl-lapack-windows
150
151 source-repository head
152 type: darcs
153 location: http://code.haskell.org/hmatrix
154
diff --git a/lib/Data/Packed/Random.hs b/lib/Data/Packed/Random.hs
index 260e4dc..e57ba6e 100644
--- a/lib/Data/Packed/Random.hs
+++ b/lib/Data/Packed/Random.hs
@@ -20,10 +20,9 @@ module Data.Packed.Random (
20) where 20) where
21 21
22import Numeric.GSL.Vector 22import Numeric.GSL.Vector
23import Data.Packed 23import Data.Packed.Matrix
24import Numeric.LinearAlgebra.Linear 24import Data.Packed.Vector
25import Numeric.LinearAlgebra.Algorithms 25import Numeric.LinearAlgebra.Algorithms
26import Numeric.LinearAlgebra.Instances()
27import Numeric.LinearAlgebra.Interface 26import Numeric.LinearAlgebra.Interface
28 27
29-- | Obtains a matrix whose rows are pseudorandom samples from a multivariate 28-- | Obtains a matrix whose rows are pseudorandom samples from a multivariate
diff --git a/lib/Graphics/Plot.hs b/lib/Graphics/Plot.hs
index 3f66d98..b4e8a11 100644
--- a/lib/Graphics/Plot.hs
+++ b/lib/Graphics/Plot.hs
@@ -24,7 +24,7 @@ module Graphics.Plot(
24 24
25 matrixToPGM, imshow, 25 matrixToPGM, imshow,
26 26
27 gnuplotX, gnuplotpdf 27 gnuplotX, gnuplotpdf, gnuplotWin
28 28
29) where 29) where
30 30
@@ -204,3 +204,19 @@ gnuplotpdf title command ds = gnuplot (prelude ++ command ++" "++ draw) >> postp
204 _ <- system "gnuplot gnuplotcommand" 204 _ <- system "gnuplot gnuplotcommand"
205 _ <- system "rm gnuplotcommand" 205 _ <- system "rm gnuplotcommand"
206 return () 206 return ()
207
208gnuplotWin :: String -> String -> [([[Double]], String)] -> IO ()
209gnuplotWin title command ds = gnuplot (prelude ++ command ++" "++ draw) where
210 (dats,defs) = unzip ds
211 draw = concat (intersperse ", " (map ("\"-\" "++) defs)) ++ "\n" ++
212 concatMap pr dats
213
214 pr = (++"e\n") . unlines . map (unwords . (map show))
215
216 prelude = "set title \""++title++"\";"
217
218 gnuplot cmd = do
219 writeFile "gnuplotcommand" cmd
220 _ <- system "gnuplot -persist gnuplotcommand"
221 _ <- system "rm gnuplotcommand"
222 return ()
diff --git a/lib/Numeric/GSL.hs b/lib/Numeric/GSL.hs
index ae4c81e..e53022e 100644
--- a/lib/Numeric/GSL.hs
+++ b/lib/Numeric/GSL.hs
@@ -8,7 +8,9 @@ Maintainer : Alberto Ruiz (aruiz at um dot es)
8Stability : provisional 8Stability : provisional
9Portability : uses -fffi and -fglasgow-exts 9Portability : uses -fffi and -fglasgow-exts
10 10
11This module reexports all the available GSL functions (except those in "Numeric.LinearAlgebra"). 11This module reexports all available GSL functions.
12
13The GSL special functions are in the separate package hmatrix-special.
12 14
13-} 15-}
14 16
diff --git a/lib/Numeric/GSL/ODE.hs b/lib/Numeric/GSL/ODE.hs
index eca06f8..912e8a8 100644
--- a/lib/Numeric/GSL/ODE.hs
+++ b/lib/Numeric/GSL/ODE.hs
@@ -33,7 +33,6 @@ module Numeric.GSL.ODE (
33) where 33) where
34 34
35import Data.Packed.Internal 35import Data.Packed.Internal
36import Data.Packed.Matrix
37import Foreign 36import Foreign
38import Foreign.C.Types(CInt) 37import Foreign.C.Types(CInt)
39import Numeric.GSL.Internal 38import Numeric.GSL.Internal
diff --git a/lib/Numeric/LinearAlgebra.hs b/lib/Numeric/LinearAlgebra.hs
index 337c007..2652f2d 100644
--- a/lib/Numeric/LinearAlgebra.hs
+++ b/lib/Numeric/LinearAlgebra.hs
@@ -8,23 +8,19 @@ Maintainer : Alberto Ruiz (aruiz at um dot es)
8Stability : provisional 8Stability : provisional
9Portability : uses ffi 9Portability : uses ffi
10 10
11Basic matrix computations implemented by BLAS, LAPACK and GSL. 11This module reexports all normally required functions for Linear Algebra applications.
12
13This module reexports the most comon functions (including "Numeric.LinearAlgebra.Instances").
14 12
15-} 13-}
16----------------------------------------------------------------------------- 14-----------------------------------------------------------------------------
17module Numeric.LinearAlgebra ( 15module Numeric.LinearAlgebra (
18 module Data.Packed, 16 module Data.Packed,
19 module Data.Packed.Random, 17 module Data.Packed.Random,
20 module Numeric.LinearAlgebra.Linear,
21 module Numeric.LinearAlgebra.Algorithms, 18 module Numeric.LinearAlgebra.Algorithms,
22 module Numeric.LinearAlgebra.Interface 19 module Numeric.LinearAlgebra.Interface
23) where 20) where
24 21
25import Data.Packed 22import Data.Packed
26import Data.Packed.Random 23import Data.Packed.Random
27import Numeric.LinearAlgebra.Linear
28import Numeric.LinearAlgebra.Algorithms 24import Numeric.LinearAlgebra.Algorithms
29import Numeric.LinearAlgebra.Instances() 25import Numeric.LinearAlgebra.Instances()
30import Numeric.LinearAlgebra.Interface 26import Numeric.LinearAlgebra.Interface
diff --git a/lib/Numeric/LinearAlgebra/Algorithms.hs b/lib/Numeric/LinearAlgebra/Algorithms.hs
index fc2fcb2..7de9587 100644
--- a/lib/Numeric/LinearAlgebra/Algorithms.hs
+++ b/lib/Numeric/LinearAlgebra/Algorithms.hs
@@ -66,6 +66,7 @@ module Numeric.LinearAlgebra.Algorithms (
66-- * Misc 66-- * Misc
67 ctrans, 67 ctrans,
68 eps, i, 68 eps, i,
69 Linear(..),
69-- * Util 70-- * Util
70 haussholder, 71 haussholder,
71 unpackQR, unpackHess, 72 unpackQR, unpackHess,
diff --git a/lib/Numeric/LinearAlgebra/Interface.hs b/lib/Numeric/LinearAlgebra/Interface.hs
index b74180f..750670b 100644
--- a/lib/Numeric/LinearAlgebra/Interface.hs
+++ b/lib/Numeric/LinearAlgebra/Interface.hs
@@ -9,7 +9,12 @@ Maintainer : Alberto Ruiz (aruiz at um dot es)
9Stability : provisional 9Stability : provisional
10Portability : portable 10Portability : portable
11 11
12(Very provisional) operators for frequent operations. 12Operators for frequent operations.
13
14This module exports Show, Read, Eq, Num, Fractional, and Floating instances for Vector and Matrix.
15
16In the context of the standard numeric operators, one-component vectors and matrices automatically expand to match the dimensions of the other operand.
17
13 18
14-} 19-}
15----------------------------------------------------------------------------- 20-----------------------------------------------------------------------------
@@ -21,14 +26,14 @@ module Numeric.LinearAlgebra.Interface(
21 (<|>),(<->), 26 (<|>),(<->),
22) where 27) where
23 28
24import Numeric.LinearAlgebra.Linear 29import Numeric.LinearAlgebra.Instances()
25import Data.Packed.Vector 30import Data.Packed.Vector
26import Data.Packed.Matrix 31import Data.Packed.Matrix
27import Numeric.LinearAlgebra.Algorithms 32import Numeric.LinearAlgebra.Algorithms
28 33
29class Mul a b c | a b -> c where 34class Mul a b c | a b -> c where
30 infixl 7 <> 35 infixl 7 <>
31 -- | matrix product 36 -- | Matrix-matrix, matrix-vector, and vector-matrix products.
32 (<>) :: Field t => a t -> b t -> c t 37 (<>) :: Field t => a t -> b t -> c t
33 38
34instance Mul Matrix Matrix Matrix where 39instance Mul Matrix Matrix Matrix where
@@ -42,7 +47,7 @@ instance Mul Vector Matrix Vector where
42 47
43--------------------------------------------------- 48---------------------------------------------------
44 49
45-- | @u \<.\> v = dot u v@ 50-- | Dot product: @u \<.\> v = dot u v@
46(<.>) :: (Field t) => Vector t -> Vector t -> t 51(<.>) :: (Field t) => Vector t -> Vector t -> t
47infixl 7 <.> 52infixl 7 <.>
48(<.>) = dot 53(<.>) = dot
@@ -51,8 +56,8 @@ infixl 7 <.>
51 56
52{-# DEPRECATED (.*) "use scale a x or scalar a * x" #-} 57{-# DEPRECATED (.*) "use scale a x or scalar a * x" #-}
53 58
54-- | @x .* a = scale x a@ 59-- -- | @x .* a = scale x a@
55(.*) :: (Linear c a) => a -> c a -> c a 60-- (.*) :: (Linear c a) => a -> c a -> c a
56infixl 7 .* 61infixl 7 .*
57a .* x = scale a x 62a .* x = scale a x
58 63
@@ -60,8 +65,8 @@ a .* x = scale a x
60 65
61{-# DEPRECATED (*/) "use scale (recip a) x or x / scalar a" #-} 66{-# DEPRECATED (*/) "use scale (recip a) x or x / scalar a" #-}
62 67
63-- | @a *\/ x = scale (recip x) a@ 68-- -- | @a *\/ x = scale (recip x) a@
64(*/) :: (Linear c a) => c a -> a -> c a 69-- (*/) :: (Linear c a) => c a -> a -> c a
65infixl 7 */ 70infixl 7 */
66v */ x = scale (recip x) v 71v */ x = scale (recip x) v
67 72
@@ -94,7 +99,7 @@ instance Joinable Vector Matrix where
94infixl 4 <|> 99infixl 4 <|>
95infixl 3 <-> 100infixl 3 <->
96 101
97{- | Horizontal concatenation of matrices and vectors: 102{-- - | Horizontal concatenation of matrices and vectors:
98 103
99@> (ident 3 \<-\> 3 * ident 3) \<|\> fromList [1..6.0] 104@> (ident 3 \<-\> 3 * ident 3) \<|\> fromList [1..6.0]
100(6><4) 105(6><4)
@@ -105,10 +110,10 @@ infixl 3 <->
105 , 0.0, 3.0, 0.0, 5.0 110 , 0.0, 3.0, 0.0, 5.0
106 , 0.0, 0.0, 3.0, 6.0 ]@ 111 , 0.0, 0.0, 3.0, 6.0 ]@
107-} 112-}
108(<|>) :: (Element t, Joinable a b) => a t -> b t -> Matrix t 113-- (<|>) :: (Element t, Joinable a b) => a t -> b t -> Matrix t
109a <|> b = joinH a b 114a <|> b = joinH a b
110 115
111-- | Vertical concatenation of matrices and vectors. 116-- -- | Vertical concatenation of matrices and vectors.
112(<->) :: (Element t, Joinable a b) => a t -> b t -> Matrix t 117-- (<->) :: (Element t, Joinable a b) => a t -> b t -> Matrix t
113a <-> b = joinV a b 118a <-> b = joinV a b
114 119
diff --git a/lib/Numeric/LinearAlgebra/Linear.hs b/lib/Numeric/LinearAlgebra/Linear.hs
index 7e23745..2568410 100644
--- a/lib/Numeric/LinearAlgebra/Linear.hs
+++ b/lib/Numeric/LinearAlgebra/Linear.hs
@@ -21,7 +21,7 @@ module Numeric.LinearAlgebra.Linear (
21import Data.Packed 21import Data.Packed
22import Numeric.GSL.Vector 22import Numeric.GSL.Vector
23 23
24-- | A generic interface for vectors and matrices to a few element-by-element functions in Numeric.GSL.Vector. 24-- | Basic element-by-element functions.
25class (Container c e) => Linear c e where 25class (Container c e) => Linear c e where
26 -- | create a structure with a single element 26 -- | create a structure with a single element
27 scalar :: e -> c e 27 scalar :: e -> c e