I am looking for a C++ tensor library that supports dimension-agnostic code. Specifically, I need to perform operations along each dimension (up to 3), e.g. calculating a weighted sum. The dimensions is a template parameter (and thus a compile-time constant). Another constraint is that the library should be relatively lightweight, so rather Eigen/Boost-style than Trilinos/PETSc.
Any suggestions?
Note: I have had a look at Eigen and think it almost fits the profile exactly, if it weren't limited to 2D tensors. If I am mistaken by this, please correct me.