What is Eigen C++ Library?

Reading time: 10 minutes

Eigen is an efficient open-source C++ library for linear algebra, matrix and vector operations, geometrical transformations, numerical solvers and related algorithms. It has been developed by two great developers namely Benoit Jacob and Gael Guennebaud.

It licensed under MPL2 starting from version 3.1.1. Earlier versions were licensed under LGPL3+

eigen

Design

Key points of Eigen library's design are as follows:

  • Eigen is implemented using the expression templates metaprogramming technique which means it builds expression trees at compile time and generates custom code to evaluate these.

  • Using expression templates and a cost model of floating point operations, the library performs its own loop unrolling and vectorization.

  • You need not install or build the Eigen library as the code is present in header files

  • Eigen does not have any dependencies other than the C++ standard library.

Compiler support

Eigen being a library needs to be compiled by a compiler. It is successfully supported by major compilers such as:

  • GCC
  • LLVM
  • Intel C++ Compiler
  • MinGW
  • MSVC

Real life use

Eigen is used in production level code and is being used by the following great softwares:

  • Tensorflow: one of the most popular machine learning framework
  • Madplotlib: for plotting 2D charts
  • Koffice2: KDE's office suite

and may others