It always amuses me how having a procedure named after someone can make it sound exotic or fancy. However, with words that have “Eigen” at the start, it’s surprisingly not named after anyone called Eigen but appears to be a German word that means “characteristic” or “peculiarity.”

An Eigensolver is a program or algorithm that calculates eigenvectors or eigenvalues. That sounds almost as helpful as what dictionaries have for the meaning of “recursive”: the short phrase, “See recursive”. Eigenvectors are part of linear Algebra, which is the mathematics of vectors and linear mappings between such spaces. In a two-dimensional square matrix, if you transform it by applying a linear transformation, the eigenvector of the matrix is a vector that does not change its direction after the transformation.

For example, shear along one axis by dragging the top right-hand corner of an image to the right. Then, as the example on Wikipedia shows, it transforms the X coordinates but leaves the Y coordinates unchanged.

In practice, things are more complicated than that, but it provides a basic understanding of what an eigenvector is, so you can see where an Eigensolver might be of use. At first you might think “fine, but what use is an eigenvector?” Surprisingly, more than you realize. For example, you can determine a function f(n) which calculates the value of the Fibonacci number for n.

Note: If this is your first experience of eigenvectors, know that eigenvalues and eigenvectors can be complex valued as well as real. I’m not going to go in to any mathematical depth. But, if you are using them, you should know about complex numbers and matrices, particularly inverting matrices and determinants. It’s at an undergraduate level of mathematics knowledge.

**Intel MKL Extended Eigensolver**

This is an implementation of the free FEAST 2.1 Eigenvalue solver and has interfaces for C, FORTRAN77 and Fortran90.

There are very-extensive MKL examples provided for C, Fortran 90 and 95. Although I’m talking about the FEAST solver, there are more than 1,600 C source files for the entire MKL library. On Windows, these are located under the IntelSWTools folder, in the folder for your version, in the MKL folder. As my setup has multiple version folders, you may need to look for MKL under earlier versions. It’s worth building and running getversion.c (under the versionqueryc folder) to verify that you have the latest version of MKL. On mine, it’s 11.3.1.

**Using FEAST**

There are routines provided for standard and generalized eigenvalue problems. You need to call the correct one depending on whether your matrices are dense, banded (values along a diagonal band) or sparse (stores only non-zero values).

The Intel documentation covers these concepts, but it’s also worth reading the detailed documentation on the NetLib website. NetLib is a collection of mathematical software, papers and databases. For instance for LAPACK, as well as BLAS and LAPACKE.

So a typical program using LAPACKE_dsysv might look like this:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
#include #include #include "mkl_lapacke.h" #define N 5 #define NRHS 3 #define LDA N #define LDB N int main() { MKL_INT n = N, nrhs = NRHS, lda = LDA, ldb = LDB, info; /* Data */ MKL_INT ipiv[N]; double a[LDA*N] = { -5.86, 3.99, -5.93, -2.82, 7.69, 0.00, 4.46, 2.58, 4.42, 4.61, 0.00, 0.00, -8.52, 8.57, 7.69, 0.00, 0.00, 0.00, 3.72, 8.07, 0.00, 0.00, 0.00, 0.00, 9.83 }; double b[LDB*NRHS] = { 1.32, 2.22, 0.12, -6.41, 6.33, -6.33, 1.69, -1.56, -9.49, -3.67, -8.77, -8.33, 9.54, 9.56, 7.48 }; printf("LAPACKE_dsysv (column-major, high-level) Results\n"); info = LAPACKE_dsysv(LAPACK_COL_MAJOR, 'L', n, nrhs, a, lda, ipiv, b, ldb); if (info > 0) { printf("The element of the diagonal factor "); printf("D(%i,%i) is zero, so that D is singular;\n", info, info); printf("the solution could not be computed.\n"); exit(1); } exit(0); |

**Final Thought**

MKLib is impressive, especially as it is a completely free third-party program, and the eigenvalues/eigenvectors Eigensolver fits in nicely.

Because MKL works on many platforms, Intel has provided an online tool to generate the link command line. There are 12 input fields on a web form, letting you choose platform, which Intel Compiler (C/C++ or FORTRAN), and so on.