See *Linear Algebra software* for more references.

First see if these are already installed. You could do this by going to the directory $CLASSHG/codes/lapack/random and typing:

`$ make randomsys3.exe`

if you get a message like:

`ld: library not found for -lblas`

then you’ll need to install these.

This was discussed in Lecture 17.

To install BLAS and LAPACK, see the links below and also:

On some linux systems, including the VM for the class, you can install both BLAS and LAPACK via:

`$ sudo apt-get install liblapack-dev`

The BLAS can be installed by downloading from http://www.netlib.org/blas/blas.tgz

Put this in desired location, e.g. $CLASSHG/codes/lapack/blas.tgz and then:

```
$ cd $CLASSHG/codes/lapack
$ tar -zxf blas.tgz # creates BLAS subdirectory
$ cd BLAS
$ gfortran -O3 -c *.f
$ ar cr libblas.a *.o # creates libblas.a
```

To use this library:

```
$ gfortran -lblas -L$CLASSHG/codes/lapack/BLAS \
program.f90
```

A small subset of LAPACK routines are in $CLASSHG/codes/lapack/lapack-subset. In this directory do:

`$ make lib`

which should create liblapack.a.

To use this library:

```
$ gfortran -lblas -L$CLASSHG/codes/lapack/BLAS \
-llapack -L$CLASSHG/codes/lapack/lapack-subset \
program.f90
```

With these you should be able to run the codes in $CLASSHG/codes/lapack/random, though you may need to add -L flags in the Makefile if you’ve put libraries in nonstandard places as in the above examples.

To get additional LAPACK routines separately, see http://www.netlib.org/lapack/double/ and click on some routine name plus dependencies to get a zip or tar file of the routine and any other routines it calls.

Some references: