Skip to content

Eigen

Eigen is a C++ template library for linear algebra.

Availability

Cluster Module/Version
BOSE eigen/5.0.1
BGSC Not Available

Note: You can simply use module load eigen to activate the most recently installed version of this software.

Environment Variables

If your program requires access to Eigen and it isn't automatically detected, then you can pass in the $EIGEN_ROOT environment variable. This points directly to the root directory of the Eigen files on the cluster.

Variable Value
$EIGEN_ROOT /data/software/default/eigen/5.0.1

Example:

cmake -DEIGEN3_INCLUDE_DIR=$EIGEN_ROOT ..

Example Usage

This example is taken from the official Eigen website.

example.cpp
#include <iostream>
#include <Eigen/Dense>

using Eigen::MatrixXd;

int main() {
  MatrixXd m(2, 2);
  m(0, 0) = 3;
  m(1, 0) = 2.5;
  m(0, 1) = -1;
  m(1, 1) = m(1, 0) + m(0, 1);
  std::cout << m << std::endl;
}

Compiling:

module load gcc/11.1.0
module load eigen/5.0.1

g++ -o example example.cpp

Running:

./example

Results:

m =
94.8117 76.7105 82.2532
70.2594 36.5235  28.375
39.2602 106.383 61.2056
m * v =
494.992
228.431
435.642

Real Example

Has your research group used Eigen in a project? Contact the HPC Team and we'd be glad to feature your work.

Resources