Content 
FLENS (Trinity)
C++ is a programming language for writing libraries. And FLENS is a C++ library for writing numerical linear algebra libraries.
The combination C++/FLENS allows the implementation of high performance libraries in the field of numerical linear algebra.
Here some Benchmarks
Purpose
One of the most successful and relevant libraries in the field of numerical linear algebra is LAPACK which is implemented in Fortran 77. So a necessary conditions for FLENS being a useful numerical linear algebra are:

It has to be possible to reimplement LAPACK, PLASMA, MAGMA etc. with FLENS.
Furthermore, the implementation has to be at least as easytoaccomplish, expressive, readable and maintainable for experts in this field.

This reimplementation must provide the same accuracy as the original LAPACK.
In the C++ community many people underestimate how much effort is spent in LAPACK on numerical stability and accuracy. This goes far beyond school book methods and numerical recipies. At the same time high performance gets achieved at the level of peak performance.

Transparency
Never ever create implicitly a temporary vector or matrix. If an operation would require a temporary it ideally triggers a compile time error but at least an assertion failure at runtime.
It always must be clear what computational back end gets used to carry out a linear algebra operation (e.g. matrixvector or matrixmatrix products). A linear algebra expression coded with overloaded operators must be equivalent to a sequence of explicit function calls. No magic!

There must be no runtime overhead compared to the Fortran implementation.
An implementation with FLENS must provide the same performance as a dedicated, handcoded implementation in C or Fortran.
Only if these conditions are fully met, further benefits will matter. Some benefits that make FLENS/C++ more favorable than using Fortran are:

Easeofuse for people doing numerical linear algebra.
We are dealing with matrices and vectors in the context of numerical linear algebra. So we want to remind some C++ folks that these are not containers like for instance std::vector.
So easeofuse for containers and easeofuse for matrices/vectors are two different things. For containers iterators are great. For matrices they are not.

Easeofuse and type safety for common tasks in numerical linear algebra.
One of the most crucial tasks is working with matrix/vector views. These are matrices or vectors that reference elements from another matrix or vector. Some more concrete examples of common cases are:

Matrix views referencing elements from a vector or raw C array buffer.

The same junk of data can be referred as a general matrix, symmetric, hermitian or triangular matrix. Using corresponding matrix view types one statically tags the memory for its intended usage. In a numerical algorithm it is not uncommon that you first want to the same data first as a general matrix, then as a lower triangular matrix and finally as a upper triangular matrix. So using matrix view types makes it possible to check whether accessing elements on the upper triangular is legal or not. And by the way: No, if you have a lower triangular matrix and you access an element from the upper triangular part you do not get a zero. Instead you get an assertion failure as you deserve because your algorithm does not exploit this special case. And FLENS is not responsible to optimize your flawed algorithm.

Matrices can be col major or row major. Referencing contiguous rectangular blocks leads to matrix views that are again col or row major. Starting with Trinity, in FLENS we also support matrix views that, e.g., reference every second row and every third column of a matrix. These so called grid views can be used like a regular matrix but its elements are located neither in row or column major order. Efficiency for these kind of views can be provided through BLAS kernels like ulmBLAS or BLIS.


We want to optimize two aspects:

User aspect: Using the resulting FLENSLAPACK should be easier than using LAPACK directly.

Developer aspect: It should be easier to develop something like LAPACK with C++/FLENS than with Fortran. Note that developing something like LAPACK requires quite some mathematical background that many people underestimate. If you don't have this background and want to develop high performance numerical software you have to study some textbooks first.

Being able to reimplement LAPACK efficiently with FLENS is just one application to prove and benchmark its concepts. But FLENS should be considered a building block for numerical linear algebra. It extends the scope of C++ for features that are necessary for doing numerical linear algebra. That means it is possible to also realize new approaches in this field. For example realizing ideas from Plasma, Magma, etc.
Examples and Tutorial

Features

C++ library (requires a C++11 conform compiler)

Easy install as FLENS is headers only

FLENS gives you

Matrix/vector types for dense linear algebra

Highlevel interface to BLAS (see FLENSBLAS).

Reimplementation of LAPACK (see FLENSLAPACK)

CXXBLAS, FLENSBLAS and FLENSLAPACK support types from the QD Library and mpfr.


Starting with Trinity by default FLENS uses ulmBLAS as default computational BLAS back end. Alternatively you can use other BLAS back ends, e.g.

FLENS also allows to use overloaded operators for BLAS operations. Most important in this respect:

Overloaded operators come without performance penalty!

In a special debug mode you can exactly trace what is happening and how you linear algebra expressions gets evaluated through BLAS calls

More features are explained in the tutorial.

Compiler Requirements
FLENS uses some of the C++11 features and therefore requires a recent C++ compiler:
Obtain FLENS (Trinity)
You can clone the Trinity branch from GitHub
git clone recursive b Trinity https://github.com/michaellehn/FLENS.git
Mailing List
Join the mailing list!
Contributors

Iris Häcker

Michael Lehn

Klaus Pototzky

Alexander Stippler