summaryrefslogtreecommitdiff
path: root/install.txt
blob: fbcc051b7cb9a14ab1dba886d12a9b7620a231ee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<HEAD>
    <TITLE>hmatrix installation</TITLE>
    <STYLE> <!-- body{width: 600px; margin:50px auto;font-family:arial} --> </STYLE>
</HEAD>


[hmatrix]: http://code.haskell.org/hmatrix
[hmatrix2]: http://perception.inf.um.es/hmatrix


[hmatrix][hmatrix2] installation
-------------------------------------------------------

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).

We also need 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**.)


### Linux ##################################################


Ubuntu/Debian:

    $ sudo apt-get install libgsl0-dev liblapack-dev
    $ cabal install hmatrix

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). 

Other distributions may require additional libraries. They can be given in a **--configure-option**.

### Mac OS/X ###############################################


GSL must be installed via MacPorts:

    $ sudo port install gsl-devel +universal
    $ cabal install hmatrix

(Contributed by Heinrich Apfelmus and Torsten Kemps-Benedix).

### Windows ###############################################


See the [INSTALL file][install2] included in the distribution. 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].

[install]: http://code.haskell.org/hmatrix/INSTALL
[install2]: http://patch-tag.com/r/aruiz/hmatrix/snapshot/current/content/pretty/INSTALL
[winpack]: http://perception.inf.um.es/hmatrix/gsl-lapack-windows.zip

- - -

### Tests ###############################################

After installation we must verify that the library works as expected:

    $ ghci
    > Numeric.LinearAlgebra.Tests.runTests 20
    OK, passed 100 tests. 
    OK, passed 100 tests.
    ... etc...

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!

If everything is ok you can reinstall the library with minimal dependencies:

    $ cabal install --reinstall hmatrix -f-tests [-f-vector] [-f-binary]

- - -

### Optimized BLAS/LAPACK ##########################################

I have successfully tested ATLAS and MKL on Linux.

### [ATLAS](http://math-atlas.sourceforge.net/)  ####################

In Ubuntu >= 9.04 we need:

    $ sudo apt-get install libatlas-base-dev

In older Ubuntu/Debian versions we needed:

    $ sudo apt-get install refblas3-dev lapack3-dev atlas3-base-dev

We may use a version (sse2, 3dnow, etc.) optimized for the machine.

### Intel's MKL  ###############################################

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:

    export LD_LIBRARY_PATH=/path/to/mkl/lib/arch
    export LIBRARY_PATH=/path/to/mkl/lib/arch

where arch = 32 or em64t.

The library must be installed with the -fmkl flag:

    $ cabal install hmatrix -fmkl

- - -

### Known problems  ###############################################

- libatlas-sse2-dev in Ubuntu 9.04 is broken (see this 
[bug report](https://bugs.launchpad.net/ubuntu/+source/atlas/+bug/368478)). Alternatively we can use libatlas-base-dev.

- On **64-bit** machines the example "minimize.hs", when run from ghci, produces a segmentation fault. It happens in the call to gsl\_multimin\_fdfminimizer_alloc, inside the C wrapper. If the program is called by runhaskell, it just terminates prematurely, producing no results. Curiously, in compiled mode the program seems to work perfectly well.

- **catch** does not work if the error is produced by a Haskell function when it is called from inside C function.

- - -

[Alberto Ruiz](http://dis.um.es/profesores/alberto)