diff options
Diffstat (limited to 'packages/base/INSTALL.md')
-rw-r--r-- | packages/base/INSTALL.md | 117 |
1 files changed, 117 insertions, 0 deletions
diff --git a/packages/base/INSTALL.md b/packages/base/INSTALL.md new file mode 100644 index 0000000..ef51167 --- /dev/null +++ b/packages/base/INSTALL.md | |||
@@ -0,0 +1,117 @@ | |||
1 | # [hmatrix][hmatrix2] installation | ||
2 | |||
3 | This package requires the [Glasgow Haskell Compiler](http://www.haskell.org/ghc/index.html) ghc >= 6.10, and [cabal-install](http://www.haskell.org/haskellwiki/Cabal-Install), conveniently available in the [Haskell Platform](http://hackage.haskell.org/platform), and the development packages for [GSL](http://www.gnu.org/software/gsl) and BLAS/[LAPACK](http://www.netlib.org/lapack). (The graphical functions also require **gnuplot** and **imagemagick**.) | ||
4 | |||
5 | [hmatrix]: http://code.haskell.org/hmatrix | ||
6 | [hmatrix2]: http://perception.inf.um.es/hmatrix | ||
7 | |||
8 | |||
9 | ## Linux ################################################## | ||
10 | |||
11 | |||
12 | Ubuntu/Debian: | ||
13 | |||
14 | $ sudo apt-get install libgsl0-dev liblapack-dev | ||
15 | $ cabal install hmatrix | ||
16 | |||
17 | Arch Linux: If the automatic installation from Hackage fails, install atlas-lapack and gsl, unpack the source, change the build-type to Simple in hmatrix.cabal (line 28) and add extra-libraries: gsl lapack (line 194). | ||
18 | |||
19 | Other distributions may require additional libraries. They can be given in a **--configure-option**. | ||
20 | |||
21 | ## Mac OS/X ############################################### | ||
22 | |||
23 | |||
24 | GSL must be installed via Homebrew or MacPorts. | ||
25 | |||
26 | Via Homebrew: | ||
27 | |||
28 | $ brew install gsl | ||
29 | $ cabal install hmatrix | ||
30 | |||
31 | Via MacPorts: | ||
32 | |||
33 | $ sudo port install gsl +universal | ||
34 | $ cabal install hmatrix | ||
35 | |||
36 | (Contributed by Heinrich Apfelmus, Torsten Kemps-Benedix and Ted Fujimoto). | ||
37 | |||
38 | ## Windows ############################################### | ||
39 | |||
40 | We use this [GSL binary](http://www.miscdebris.net/blog/2009/04/20/mingw-345-binaries-of-gnu-scientific-library-112-for-use-with-mingw-and-visual-c/), and blas/lapack dlls built with g77 (contributed by Gilberto Camara). All required files are in [gsl-lapack-windows.zip][winpack]. | ||
41 | |||
42 | (Due to [issue 21](https://github.com/albertoruiz/hmatrix/issues/21) we need hmatrix-0.13.1.0.) | ||
43 | |||
44 | 1) Install the Haskell Platform (tested on 2011.2.0.1) | ||
45 | |||
46 | > cabal update | ||
47 | |||
48 | 2) Download and unzip the following file into a stable folder %GSL% | ||
49 | |||
50 | http://perception.inf.um.es/hmatrix/gsl-lapack-windows.zip | ||
51 | |||
52 | 3.a) In a msys shell the installation should be fully automatic: | ||
53 | |||
54 | $ cabal install hmatrix-0.13.1.0 --extra-lib-dir=${GSL} --extra-include-dir=${GSL} | ||
55 | |||
56 | 3.b) Alternatively, in a normal windows cmd: | ||
57 | |||
58 | > cabal unpack hmatrix-0.13.1.0 | ||
59 | |||
60 | Edit hmatrix.cabal, in line 28 change build-type to "Simple", and then | ||
61 | |||
62 | > cabal install --extra-lib-dir=%GSL% --extra-include-dir=%GSL% | ||
63 | |||
64 | It may be necessary to put the dlls in the search path. | ||
65 | |||
66 | |||
67 | NOTE: The examples using graphics do not yet work in windows. | ||
68 | |||
69 | [install]: http://code.haskell.org/hmatrix/INSTALL | ||
70 | [install2]: http://patch-tag.com/r/aruiz/hmatrix/snapshot/current/content/pretty/INSTALL | ||
71 | [winpack2]: http://perception.inf.um.es/hmatrix/gsl-lapack-windows.zip | ||
72 | [winpack]: https://github.com/downloads/AlbertoRuiz/hmatrix/gsl-lapack-windows.zip | ||
73 | |||
74 | ## Tests ############################################### | ||
75 | |||
76 | After installation we must verify that the library works as expected: | ||
77 | |||
78 | $ cabal install hmatrix-tests --enable-tests | ||
79 | $ ghci | ||
80 | > Numeric.LinearAlgebra.Tests.runTests 20 | ||
81 | OK, passed 100 tests. | ||
82 | OK, passed 100 tests. | ||
83 | ... etc... | ||
84 | |||
85 | If you get any failure please run lapack's own tests to confirm that your version is not broken. For instance, in ubuntu 9.04, **libatlas-sse2** does not work (see this [bug report](https://bugs.launchpad.net/ubuntu/+source/atlas/+bug/368478)). If your lapack library is ok but hmatrix's tests fail please send a bug report! | ||
86 | |||
87 | |||
88 | ## Optimized BLAS/LAPACK ########################################## | ||
89 | |||
90 | I have successfully tested ATLAS and MKL on Linux. | ||
91 | |||
92 | ### [ATLAS](http://math-atlas.sourceforge.net/) #################### | ||
93 | |||
94 | In Ubuntu >= 9.04 we need: | ||
95 | |||
96 | $ sudo apt-get install libatlas-base-dev | ||
97 | |||
98 | In older Ubuntu/Debian versions we needed: | ||
99 | |||
100 | $ sudo apt-get install refblas3-dev lapack3-dev atlas3-base-dev | ||
101 | |||
102 | We may use a version (sse2, 3dnow, etc.) optimized for the machine. | ||
103 | |||
104 | ### Intel's MKL ############################################### | ||
105 | |||
106 | There is a free noncommercial download available from Intel's website. To use it I have added the following lines in my .bashrc configuration file: | ||
107 | |||
108 | export LD_LIBRARY_PATH=/path/to/mkl/lib/arch | ||
109 | export LIBRARY_PATH=/path/to/mkl/lib/arch | ||
110 | |||
111 | where arch = 32 or em64t. | ||
112 | |||
113 | The library must be installed with the -fmkl flag: | ||
114 | |||
115 | $ cabal install hmatrix -fmkl | ||
116 | |||
117 | |||