Recently Eigen 2.0 was released. You might already have heard about Eigen, it is a small but very high performance maths library which has its roots in KDE. Below, the two core developers are interviewed about it.
OK, let's start out with the basics. Could you introduce yourselves?
Benoit: I'm a Mathematics postdoc at the University of Toronto, coming from France. I'm working onC*-algebras, and teaching linear algebra. In addition to Eigen, I contribute to a few other free software projects, mostly within KDE. In the past I also contributed to Avogadro and a little bit to Open Babel.
Gael: I'm a French researcher in Computer Graphics currently working at INRIA Bordeaux. In particular, my research interests include real-time rendering and surface representations. My major contribution in the open-source world is by far what I did in Eigen, but I also contributed a bit to vcglib and MeshLab.
What is Eigen?
Benoit and Gael: Eigen is a free C++ template maths library mainly focused on vectors, matrices, and linear algebra. It is a self-contained library covering a very broad range of use cases. For example, it covers both dense and sparse objects, and in the dense case, it covers both fixed-size and dynamic-size objects. Moreover it provides linear algebra algorithms, a geometry framework, etc. It has a very nice API for C++ programmers, and it embraces very high performance.
What drove you to create Eigen and Eigen 2?
Benoit: Eigen 1 was a very small project, 2500 LOC and just a few months of development. Its creation in 2006 was driven by the then-simple needs of some KDE and KOffice apps. Although these needs were simple, they were already very diverse because KDE is a large meta project, and the existing libraries were too specialised to cover them all. However it quickly turned out that we had underestimated KDE's needs, and Eigen 1 was insufficient. So in 2007, I started developing Eigen 2. The aim was to finally cover all the needs of KDE and KOffice apps - a goal that, in retrospect, was very ambitious and will only be reached with Eigen 2.1. After an initial experiment with TVMET's code, I decided to restart from scratch in August 2007 and quickly got a working implementation of expression templates. However, this early Eigen 2 was very small. Development speed really picked up when Gael joined in early 2008.
Gael: A bit more than a year ago, I became tired of going back and forth between my own fixed size vector/matrix classes and more generic linear algebra packages. So, I started looking at the other existing solutions without being excited by any of them. Since I have been using KDE for about 9 years, I was really curious to know what the KDE's folks did in this area. At that time, it was exactly the start of Eigen 2 which looked promising but the fact it was based on TVMET puzzled me. Eventually, Benoît had the great idea to restart the development of Eigen 2 from scratch, and after one or two months he came up with a very lean design. Moreover his vision and feature plan for Eigen 2 exactly matched my own, and being part of the KDE community was exciting too! At the beginning, I naively thought that after one or two months the job would be done! Instead, we started playing with exciting stuff like explicit vectorisation, efficient matrix products, sparse matrix, etc.
Many people are familiar with other linear algebra and matrix libraries, including BLAS/LAPACK, Intel's Math Kernel Library,and Apple's vecLib framework. Can you explain how Eigen is different,besides being written in C++?
Benoit and Gael: Giving a fair answer to that question would require a thorough comparison to all existing libraries which is obviously out the scope of this interview. Search for "C++ matrix library" to get an idea. For us, the most important criteria includes:
- generality: we need many different kinds of matrices: fixed-size, dynamic-size dense, sparse. For example, BLAS and LAPACK handle only dynamic-size dense matrices. Even MKL and vecLib have only limited support for fixed-size matrices.
- performance: with optimisations for fixed size matrices, vectorisation, lazy evaluation, cache-friendly algorithms... See some benchmarks here.
- ease of use: we have a C++ API that's neat even by the high standards of KDE developers, good documentation, and lots of convenience features...
- license policy: Eigen is LGPL, there is no licensing issue.
What projects are using Eigen right now?
Benoit and Gael: Eigen is already used in a wide range of applications. Some of them include:
- Computer graphics projects:
- KDE and KOffice are of course historical users. More specifically:
- the above-mentioned Krita
- a little bit KSpread
- some screensavers, KGLlib, KGLEngine2d, SolidKreator.
- Kalzium'smolecular viewer is using Eigen indirectly through Avogadro (see below).
- In KDE 4.3, we have good hopes to add Step to this list.
- Chemistry projects:
It is very interesting and motivating to see how many projects already switched, or are going to switch to Eigen, proving Eigen fills a real gap.
What are some goals of Eigen moving forward? What kind of help do you need? What are some new features we might see in Eigen 2.1?
Benoit and Gael:
Our goals for 2.1 are:
- Finish stabilising the API (the API guarantee is only partial in 2.0)
- Complete the Sparse module. One goal is to make it good enough for Step in KDE 4.3 and Krita.
- Make sure all dense decompositions are world-class (LU is already good, though we have improvements in mind, SVD is being completely rewritten, etc...)
- Make fixed-size specialisations of algorithms
- Optimize the case of complex numbers
- Vectorise more operations (e.g., exp() or sin() or log())
- Investigate optionally using new GCC 4.4 hotness: per-function optimisation flags
We need a lot of help with all that, more details can be found in our To-do. If new contributors join the team, in the longer term, we could see some new modules covering statistics, fast fourier transform, non linear optimisations, etc.
We also welcome testing, especially on exotic (read: non-GNU or non-x86/x86-64) platforms. All bug reports are much appreciated.
How does it benefit Eigen to be part of KDE?
Benoit: In many, many ways!
- KDE initially provided a long list of use cases, so we had a clear picture of what was needed.
- The surrounding KDE community is where the first people interested in Eigen came from.
- Still today, we occasionally receive help from various KDE contributors. For example, just because we are in kdesupport, Alexander Neundorf reviewed our CMake code.
- The KDE SVN repository works well and working in such a huge repository is a guarantee that possible issues (such as preserving history across a SCM change) will be handled for us.
- Having my blog aggregated on Planet KDE means that my Eigen posts have much more impact.
- We also benefit a lot from having our users forum at the excellent forum.kde.org.
Eigen is being developed in KDE's subversion repository. How does it benefit KDE that Eigen is developed in kdesupport, rather than being an external dependency?
Benoit: It allows KDE to track the development version of Eigen much faster. Whenever a feature or a fix is added to Eigen, KDE can use it right away without waiting for a release. Of course, we still have to make releases of Eigen for each release of KDE.
Another thing is that it makes it easier to build KDE: one less dependency. And whenever KDE developers need matrix maths, they don't need to wonder for a long time what library to use, they can right away rely on Eigen since it is in kdesupport. Of course, this only is a valid argument if Eigen is actually a better choice for KDE than the alternatives, but we're convinced it is :)
For a variant of this interview follow see mac research.