Installing Armadillo 0.4.0

I found a nice C++ linear algebra library called Armadillo by Conrad. I will write short posts to describe how to use it, and I will begin on how to install it.

First, download the source tarball from this link

untar the tar.gz file, and enter the directory.

The installation uses CMake, so if you don’t have, you can install it (in Ubuntu)
sudo apt-get install cmake

and then to install Armadillo, simply type:
cmake .
make
make install DESTDIR=$HOME/local

where I chose to install it in $HOME/local/usr/local. (NOTE: Somehow the installation folder will add “/usr/local”)

To compile a C++ code with armadillo, you need to include the header file
#include “armadillo”

and specify in the compiler option:
-I$HOME/local/usr/local/include -L$HOME/local/usr/local/lib -larmadillo

you can find an example in the “example” folder shipped with the source.