Tensors – C++ Library for Tensor Algebra
This library is useful for the implementation of tensor equations mainly using Gibbs' direct notation. An orthonormal Cartesian system can be considered and hence expressions in index notation can also be handled (e.g. expanded).
The focus is on the implementation of already deduced equations; therefore developments in tensor calculus cannot be handled here. Nonetheless, symbolic manipulations can be conveniently done using GiNaC.
Note that numerical computations using Tensors directly may be inefficient because C++ operator overloadings used in the library that generates temporary copies. We have plans though to use the so-called expression templates technique in the future and then avoid temporary copies.
The following operators are defined (where T# represents a tensor of #th order):
* dot: sc = T1 * T1 T1 = T1 * T2 T2 = T1 * T3 T3 = T1 * T4 T1 = T2 * T1 T2 = T2 * T2 T3 = T2 * T3 T4 = T2 * T4 T2 = T3 * T1 T3 = T3 * T2 T4 = T3 * T3 T3 = T4 * T1 T4 = T4 * T2 % double-dot: sc = T2 % T2 T1 = T2 % T3 T2 = T2 % T4 T1 = T3 % T2 T2 = T3 % T3 T3 = T3 % T4 T2 = T4 % T2 T3 = T4 % T3 T4 = T4 % T4 & dyadic: T2 = (T1 & T1) T3 = (T1 & T2) T4 = (T1 & T3) T3 = (T2 & T1) T4 = (T2 & T2) ^ leaf-dyadic (Rijkl = Lik.Rjl orthonormal system): T4 = (T2 ^ T2) | palm-dyadic (Rijkl = Lil.Rjk orthonormal system): T4 = (T2 | T2)
Additionally, the following operations between tensors and a scalar sc can be programmed:
Tensor times scalar: T1 = T1 * sc T2 = T2 * sc T3 = T3 * sc T4 = T4 * sc Tensor divided by scalar: T1 = T1 / sc T2 = T2 / sc T3 = T3 / sc T4 = T4 / sc