Armadillo (C++ library)


Armadillo is a linear algebra software library for the C++ programming language. It aims to provide efficient and streamlined base calculations, while at the same time having a straightforward and easy-to-use interface. Its intended target users are scientists and engineers.
It supports integer, floating point, complex numbers, and a subset of trigonometric and statistics functions. Dense and sparse matrices are supported. Various matrix decompositions are provided through optional integration with Linear Algebra PACKage, Automatically Tuned Linear Algebra Software, and ARPACK. High-performance BLAS/LAPACK replacement libraries such as OpenBLAS and Intel MKL can also be used.
The library employs a delayed-evaluation approach to combine several operations into one and reduce the need for temporaries. Where applicable, the order of operations is optimised. Delayed evaluation and optimisation are achieved through template metaprogramming.
Armadillo is related to the Boost Basic Linear Algebra Subprograms library, which also uses template metaprogramming. However, Armadillo builds upon ATLAS and LAPACK libraries, thereby providing machine-dependent optimisations and functions not present in uBLAS.
It is open-source software distributed under the permissive Apache License, making it applicable for the development of both open source and proprietary software. The project is supported by the NICTA research centre in Australia.

Example in C++ 11

Here is a trivial example demonstrating Armadillo functionality:

// Compile with:
// $ g++ -std=c++11 main.cpp -o file_name -O2 -larmadillo
  1. include
  2. include
  3. include
int main

Example in C++ 98

Here is another trivial example in C++ 98:

  1. include
  2. include
int main