
John Phillips <phillips@mps.ohio-state.edu> wrote:
*Metaprogramming A utility I would love to have for some things I have done in the past is a good, general tensor library. One that allows compile time selection of the number of covariant and contravariant indices, raising and lowering operations, index contraction, a wide variety of element types (at least double, complex and functions that return doubles or complexes), and all the other basic tools of tensor manipulation that numeric work might need. If I ever get the time, I would start trying to implement this using the boost preprocessor and metaprogramming libraries to keep the size of the code base sensible.
Have you looked at http://www.oonumerics.org/FTensor/ It implements a fair number of different tensor types (e.g. symmetric, antisymmetic), the element type is templated, and it has natural ways of specifying contractions. It doesn't have separate covariant and contravariant tensors, but that wouldn't be that hard to implement. It would just be a fair amount of work for quesionable gain. I used it for my General Relativity code, and I never missed the distinction between covariant and contravariant indices. I bill it as a high performance tensor library, though now I think it might actually be better to use ordinary loops instead of the compile-time loops. Regards, Walter Landry wlandry@ucsd.edu