Making the Most of the MKL Eigensolver Share your comment!

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.

012716 pic1

So a typical program using LAPACKE_dsysv might look like this:

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.

Posted on January 27, 2016 by David Bolton, Slashdot Media Contributing Editor