not so tensor

SourceForge Logo

SourceForge Project Page

Laxor is a C++ template library for numerical tensor algebra. It will allow a physicist or mathematician to enter tensor expressions using the familiar Einstein notation, and to produce efficiently running binaries.

Its implementation of the "Einstein" notation produces a tight relationship between the mathematical formulas and the code, allowing quick implementation of new physics formulas, and facilitating experimentation with the high-level reorganizations that lead to the greatest performance improvements.

Laxor uses "template meta-programming", by which the index bookkeeping calculations are mostly accomplished at compile time, so that after template resolution, the compiler is presented with (large) tensor element expressions that are much like what one might code by hand.

There are a number of projects around that approach the problem of tensor algebra, from a variety of angles. For example, tensor-index resolution used in a linear algebra package, and in some cases an attempt to model the "Einstein" notation (but often in a way that produces very slow code). These have not caught on, partly because the end users need both ease of use and efficient execution.

Presently, most physicists rely on explicit hand-coded or automatically-generated expressions in C or Fortran to do tensor calculations.

Hand-coded expressions for tensors are intrinsically huge (often involving hundreds of operations) maintainable only by their author. High-level reorganization of such code can be very difficult.

Automatic systems let physicists enter formulas in a concise form, but require an awful amount of tweaking, and the code in the end is often far from optimal. Also, it often happens that some years later the automatic system becomes unavailable, rendering all the coding useless. An automatic system for generating the expressions involves two steps to produce code (generation and compilation), and three sets of documents (the original math in a journal, computer files with the mathematical formulas, and the source code files).

With Laxor, the formulas will be in the source code, and correspond directly to the math in the journal. Laxor uses only standard C++ features, and so projects based on it can be expected to work for the foreseeable future.

This software is placed under the GNU Lesser Public License and is free, both as in freedom and as in beer.