c++ matrix library for computing eigenvalues/eigenvectors

Does anyone have recommendations for a good matrix library for C++ for computing eigenvectors and eigenvalues? I’m more interested in ease of programming than speed.

There are a number of competing libraries, and I’m wondering which may be better for my uses.

I’ve used both the standard netlib lapack and blas, as well as the Intel Math Kernel Library. The Intel one is faster, but might not be free. You may be able to get a free version for educational use, but I don’t recall for sure.

The netlib lapack and blas can just be installed via yast, and works fine, if a bit slower. I think this is basically the standard that everyone uses, so there is probably way more info online on how to use it then others.

I think you can also use the gsl (GNU Scientific Library), but I have not tried this.

Note that the netlib software is written in Fortran, but you should be able to use the libraries with C++.

Hi,

there is also a boost module for Boost Basic Linear Algebra.
There are more math modules available too Library Documentation - Math and numerics maybe you’ll find something useful in there :slight_smile:

Hope this helps

Hello,

I used ARPACK++:
ARPACK - Arnoldi Package

Here are the instructions needed to get it working:
https://help.ubuntu.com/community/Arpack%2B%2B#Compiling%20with%20ARPACK++

It is good at working with large matrices (I tried n = 10000: finds 2 smallest eigenvalues in 6 seconds; n = 15000: in 2 min 9 sec; n = 20000: crashes due to bad alloc, but I’m not sure if it’s not my fault (: ).

However, documentation contains errors. For example, I was lead into believing that CSC format stores non-zero row numbers starting from 1. However, numeration starts from 0. Error messages could also be more informative.

Good luck…

The basic functionality should be more or less the same for all major libraries, once you are doing real numerical work you will have to reevaluate for features and performance anyways.

My favorite because of ease of use would be Eigen:
Main Page - Eigen

Try the tutorial: Eigen: Tutorial 1/3 - Core features