Build / Install Eigen Library from source

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 and is used within TensorFlow.

In this guide, we will walk you through the process of building and installing Eigen from source.

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

eigen

Build/ Install Eigen

Step 1: Clone the Eigen source code


git clone https://github.com/eigenteam/eigen-git-mirror.git
cd eigen-git-mirror

Step 2: Build Eigen


cd build_dir
cmake source_dir
make install

You can adjust the installation destination (the "prefix") by passing the -DCMAKE_INSTALL_PREFIX=myprefix option to cmake.

Optional: Use header file directly

You can skip Step 2 and use the header files of Eigen directly.

All header files are within the Eigen directory.

You can browse through the header files here

Enjoy your newly installed Eigen