How to install Eigen C++ library on Ubuntu 22.04 or 20.04

Eigen is a valuable library for those who code in C++ for linear algebra computations. The key task of Eigen is to provide a wide range of mathematical functionalities for matrix and vector operating, numerical solvers, and moreā€¦ It is popular among developers because it is designed to be reliable, efficient, and fast.

It provides a simple and intuitive interface for performing basic matrix and vector operations. Eigen utilizes expression templates, a technique that optimizes the evaluation of mathematical expressions. Further, it offers a range of solvers for linear systems, including direct solvers like LU and QR decomposition. Developers can be seamlessly integrated it with other popular libraries and frameworks in the C++ ecosystem.

Here we learn how to install Eigen3 on Ubuntu 22.04 or 20.04

1. Open command Terminal

Start the terminal application on your Ubuntu Linux, for that we can use the keyboard shortcut that is Ctlr+Alt+T. Using the command line is much easier to install packages than using GUI.

2. Update the Package List

After having the Terminal screen, once run the system update command to refresh the package list cache of APT and install the available updates for the system.

sudo apt update -y

3. Install Eigen 3 on Ubuntu 22.04 or 20.04

While doing this tutorial the latest version of Eigen i.e. 3.4.0 was available to install using the default system repository. Therefore, we just need to run the APT along with the package name, here is that:

sudo apt install libeigen3-dev
Install Eigen 3 on Ubuntu 22.04 or 20.04

4. Check Eigen is on our Linux system

Although by executing the previous command you will have the Eigen C++ library on your Ubuntu system. However, if you want to confirm the same then you can search for its installed package location using the given command:

Syntax to search installed packages on Ubuntu :

dpkg -S package-name

Here it will be:

dpkg -S libeigen3-dev
check eigen is installed on Ubuntu

5. Updating and Uninstallation

If some new update will be available to install for the Eigen package version via the Ubuntu system repository then that can be obtained using the system update and upgrade command:

sudo apt update && sudo upgrade

Whereas, those who want to remove the Eigen C++ library from their Ubuntu Linux system, can use:

sudo apt remove libeigen3-dev

Other Articles:

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.