The Tensor Library
Writing tensor expressions natively in C++
The purpose of this library is to facilitate the translation
of tensor expressions into C++ without compromizing
speed. A tensor here is a vector, matrix or any multidimensional data array.
Especially expressions including several indices
can be taken as written into C++ removing the need for
Expression templates and similar techniques are being used
to achive this goal.
This software has a free license .
If you have suggestions or find bugs, if you like it (or don't like it), please mail me.
- Contains 1d (vectors), 2d (matrices) and 3d arrays.
- Support for up to four different indices in one expression
- Highly optimized.
- All usual unary and binary operations exist.
- Any subset of an Tensor can be treated individually
- Indirect access (with a Tensor as index) is possible.
- Reference counted memory management.
- Thorough error checking during compile time and run time (can be configured).
- Easily extensible.
What are index expressions?
can be taken into the sourcecode like this:
No explicit loops are necessary here, the loops over the three indices m, n and k are performed implicitely.
complex<double> iu( 0.0, 1.0 );
a[m] = norm( tsum( tsum( c( m, n ) * exp( iu * w[ k+1 ] * t( n, k ) ) ) ) );
- Download the source archiv.
- Adjust Makefile. Especially, put the correct name of your C++ compiler in the first line.
- Run make. I have used GNU make and don't know if others work.
- This library is written in ISO C++ without
using system specific extensions. I use it on Linux with
gcc 3.0 and 3.1. If the compilation goes well,
the result is a library libtensor.a and a few examples.
- Ready. You can run the examples now.
Thu Jun 6 10:47:47 CEST 2002