|
Boost : |
From: Walter Landry (wlandry_at_[hidden])
Date: 2004-06-03 21:05:40
John Phillips <phillips_at_[hidden]> 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_at_[hidden]
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk