Armadillo C++
A high quality linear algebra library (matrix maths) for the C++ language, aiming towards a good balance between speed and ease of use
Armadillo C++ requires an environment module
In order to use Armadillo C++, you must first load the appropriate environment module:
module load gnu
Armadillo provides high-level syntax and functionality deliberately similar to Matlab. It is useful for algorithm development directly in C++, or quick conversion of research code into production environments (eg. software & hardware products). Some of its other features includes
- Efficient classes for vectors, matrices and cubes (1st, 2nd and 3rd order tensors); dense and sparse matrices are supported
- LAPACK, or one of its high performance drop-in replacements (eg. multi-threaded Intel MKL, or OpenBLAS), which is provided for various matrix decompositions
- A sophisticated expression evaluator (based on template meta-programming) automatically combines several operations to increase speed and efficiency
- Can automatically use OpenMP multi-threading (parallelisation) to speed up computationally expensive operations
- Available under a permissive license, useful for both open-source and proprietary (closed-source) software
- Can be used for machine learning, pattern recognition, computer vision, signal processing, bioinformatics, statistics, finance, etc.
Using Armadillo C++ on RCC Resources#
In order to use Armadillo, you'll need to link your code against the armadillo library. The best way to do this is to use the following syntax:
Here, MYCODE.cpp
can be renamed to whatever the name of your code is. As an example, we can compile the example code given
on the Armadillo Documentation. Type the following code into a
text editor and save it as example.cpp
:
Then compile it by using the command listed above. For this example, that command will be:
This should produce an executable file called example
which can be run by typing ./example
into the terminal.