summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README41
-rw-r--r--hmatrix.cabal25
-rw-r--r--lib/Numeric/LinearAlgebra/Tests/Properties.hs6
3 files changed, 50 insertions, 22 deletions
diff --git a/README b/README
index b6f3c28..9fb478b 100644
--- a/README
+++ b/README
@@ -4,20 +4,21 @@
4 4
5REQUIREMENTS ---------------------------- 5REQUIREMENTS ----------------------------
6 6
7Development packages of: 71) GNU Scientific Library (http://www.gnu.org/software/gsl).
8 In Ubuntu we need the package "libgsl0-dev".
8 9
91) GNU Scientific Library (http://www.gnu.org/software/gsl) 102) BLAS/LAPACK (http://www.netlib.org/lapack).
11 An optimized implementation is recommended. I have tested:
10 12
112) BLAS and LAPACK (http://www.netlib.org/lapack) 13 - Intel's MKL (http://www.intel.com/cd/software/products).
14 There is a free noncommercial download of MKL for Linux.
12 15
133) ATLAS (recommended) (http://math-atlas.sourceforge.net/) 16 - ATLAS (http://math-atlas.sourceforge.net).
14 17 In Ubuntu the required packages are "refblas3-dev", "lapack3-dev",
15For example, in Ubuntu Linux we need: 18 and "atlas3-base-dev" (or a version tuned for your machine).
16 19 Please note that ATLAS currently requires compilation -fviaC in 32bit
17- libgsl0-dev 20 machines. Otherwise many functions fail, producing strange NaN's.
18- refblas3-dev 21 Even with -fvia-C we may get wrong behavior in some cases.
19- lapack3-dev
20- atlas3-base-dev (or a version specifically tuned for your machine)
21 22
22For ghc-6.8.x you may also need: 23For ghc-6.8.x you may also need:
23 24
@@ -46,6 +47,19 @@ Manual:
46 $ runhaskell Setup.lhs haddock 47 $ runhaskell Setup.lhs haddock
47 $ runhaskell Setup.lhs install 48 $ runhaskell Setup.lhs install
48 49
50Using Intel's MKL:
51
52 - add/modify environment variables (e.g. in your .bashrc):
53 export LD_LIBRARY_PATH=/path/to/mkl/lib/arch
54 export LIBRARY_PATH=/path/to/mkl/lib/arch
55 where arch = "32" or "em64t"
56
57 - add the "-fmkl" flag in the cabal configuration command:
58 $ runhaskell Setup.lhs configure --prefix=$HOME --user -fmkl
59 $ runhaskell Setup.lhs build
60 $ runhaskell Setup.lhs install
61
62
49See below for installation on Windows. 63See below for installation on Windows.
50 64
51TESTS --------------------------------------------- 65TESTS ---------------------------------------------
@@ -88,7 +102,7 @@ KNOWN PROBLEMS / BUGS -------------------------------
88 NaN's results on certain blas/lapack calls. In these machines 102 NaN's results on certain blas/lapack calls. In these machines
89 the library is automatically compiled -fvia-C, which apparently 103 the library is automatically compiled -fvia-C, which apparently
90 solves the problem. 104 solves the problem.
91 On 64-bit the default and faster -fasm seems to work well. 105 On 64-bit, or using MKL, the default and faster -fasm seems to work well.
92 106
93- On 64-bit machines the example "minimize.hs", when run from ghci, 107- On 64-bit machines the example "minimize.hs", when run from ghci,
94 produces a segmentation fault. It happens in the call to 108 produces a segmentation fault. It happens in the call to
@@ -110,6 +124,9 @@ KNOWN PROBLEMS / BUGS -------------------------------
110 A similar problem was reported at: 124 A similar problem was reported at:
111 http://article.gmane.org/gmane.linux.debian.devel.bugs.general/323065 125 http://article.gmane.org/gmane.linux.debian.devel.bugs.general/323065
112 126
127- On distributions with old GSL versions you should comment out a couple of functions
128 in the export lists of Ellint.hs and Debye.hs
129
113CHANGES --------------------------------------------------------- 130CHANGES ---------------------------------------------------------
114 131
115This is a new version of the library previously known as GSLHaskell. 132This is a new version of the library previously known as GSLHaskell.
diff --git a/hmatrix.cabal b/hmatrix.cabal
index 89ddb8a..263064e 100644
--- a/hmatrix.cabal
+++ b/hmatrix.cabal
@@ -1,5 +1,5 @@
1Name: hmatrix 1Name: hmatrix
2Version: 0.2.1.0 2Version: 0.2.1.1
3License: GPL 3License: GPL
4License-file: LICENSE 4License-file: LICENSE
5Author: Alberto Ruiz 5Author: Alberto Ruiz
@@ -21,19 +21,19 @@ build-type: Simple
21flag splitBase 21flag splitBase
22 description: Choose the new smaller, split-up base package. 22 description: Choose the new smaller, split-up base package.
23 23
24flag mkl
25 description: Link with Intel's MKL optimized libraries.
26 default: False
27
24library 28library
25 if flag(splitBase) 29 if flag(splitBase)
26 build-depends: base >= 3, array, QuickCheck, HUnit, storable-complex 30 build-depends: base >= 3, array, QuickCheck, HUnit, storable-complex
27 else 31 else
28 build-depends: base < 3, QuickCheck, HUnit, storable-complex 32 build-depends: base < 3, QuickCheck, HUnit, storable-complex
29 33
30 if os(windows) 34 if !flag(mkl)
31 ghc-options: 35 if !os(x86_64)
32 else 36 ghc-options: -fvia-C
33 if arch(x86_64)
34 ghc-options:
35 else
36 ghc-options: -fvia-C
37 37
38 Build-Depends: haskell98 38 Build-Depends: haskell98
39 Extensions: ForeignFunctionInterface 39 Extensions: ForeignFunctionInterface
@@ -95,6 +95,13 @@ library
95 C-sources: lib/Data/Packed/Internal/auxi.c, 95 C-sources: lib/Data/Packed/Internal/auxi.c,
96 lib/Numeric/LinearAlgebra/LAPACK/lapack-aux.c, 96 lib/Numeric/LinearAlgebra/LAPACK/lapack-aux.c,
97 lib/Numeric/GSL/gsl-aux.c 97 lib/Numeric/GSL/gsl-aux.c
98 extra-libraries: gsl blas lapack 98 if flag(mkl)
99 if arch(x86_64)
100 extra-libraries: gsl mkl_lapack mkl_intel_lp64 mkl_sequential mkl_core
101 else
102 extra-libraries: gsl mkl_lapack mkl_intel mkl_sequential mkl_core
103 else
104 extra-libraries: gsl blas lapack
105
99 cc-options: -O4 106 cc-options: -O4
100 ghc-prof-options: -auto-all 107 ghc-prof-options: -auto-all
diff --git a/lib/Numeric/LinearAlgebra/Tests/Properties.hs b/lib/Numeric/LinearAlgebra/Tests/Properties.hs
index 566d038..55e9a1b 100644
--- a/lib/Numeric/LinearAlgebra/Tests/Properties.hs
+++ b/lib/Numeric/LinearAlgebra/Tests/Properties.hs
@@ -40,6 +40,9 @@ module Numeric.LinearAlgebra.Tests.Properties (
40import Numeric.LinearAlgebra 40import Numeric.LinearAlgebra
41import Numeric.LinearAlgebra.Tests.Instances(Sq(..),Her(..),Rot(..)) 41import Numeric.LinearAlgebra.Tests.Instances(Sq(..),Her(..),Rot(..))
42import Test.QuickCheck 42import Test.QuickCheck
43import Debug.Trace
44
45debug x = trace (show x) x
43 46
44-- relative error 47-- relative error
45dist :: (Normed t, Num t) => t -> t -> Double 48dist :: (Normed t, Num t) => t -> t -> Double
@@ -89,8 +92,9 @@ ones (r,c) = zeros (r,c) + 1
89 92
90----------------------------------------------------- 93-----------------------------------------------------
91 94
92luProp m = m |~| p <> l <> u && det p == s 95luProp m = m |~| p <> l <> u && f (det p) |~| f s
93 where (l,u,p,s) = lu m 96 where (l,u,p,s) = lu m
97 f x = fromList [x]
94 98
95invProp m = m <> inv m |~| ident (rows m) 99invProp m = m <> inv m |~| ident (rows m)
96 100