Remove the symCoeff() method of the the Tensor module and move the
functionality into a new operator() of the symmetry classes. This makes
the Tensor module now completely self-contained without symmetry
support (even though previously it was only a forward declaration and a
otherwise harmless trivial templated method) and also removes the
inconsistency with the rest of eigen w.r.t. the method's naming scheme.
When constructing a symmetry group, make the code automatically detect
the number of indices required from the indices of the group's
generators. Also, allow the symmetry group to be applied to lists of
indices that are larger than the number of indices of the symmetry
group.
Before:
SGroup<4, Symmetry<0, 1>, Symmetry<2,3>> group;
group.apply<SomeOp, int>(std::array<int,4>{{0, 1, 2, 3}}, 0);
After:
SGroup<Symmetry<0, 1>, Symmetry<2,3>> group;
group.apply<SomeOp, int>(std::array<int,4>{{0, 1, 2, 3}}, 0);
group.apply<SomeOp, int>(std::array<int,5>{{0, 1, 2, 3, 4}}, 0);
This should make the symmetry group easier to use - especially if one
wants to reuse the same symmetry group for different tensors of maybe
different rank.
static/runtime asserts remain for the case where the length of the
index list to which a symmetry group is to be applied is too small.
Add a template parameter to gen_numeric_list that acts as a starting
point for the list, i.e. gen_numeric_list<int, 5, 4> will generate a
numeric_list<int, 4, 5, 6, 7, 8>.
libc++ from 3.4 onwards supports constexpr std::get, but only if
compiled with -std=c++1y. Change the detection so that libc++'s
internals are only used if either -std=c++1y is not specified or the
library is too old, making the whole hack a bit more future-proof.
Add a symCoeff() method to the Tensor class template that allows the
user of the class to set multiple elements of a tensor at once if they
are connected by a symmetry operation with respect to the tensor's
indices (symmetry/antisymmetry/hermiticity/antihermiticity under
echange of two indices and combination thereof for different pairs of
indices).
A compile-time resolution of the required symmetry groups via meta
templates is also implemented. For small enough groups this is used to
unroll the loop that goes through all the elements of the Tensor that
are connected by this group. For larger groups or groups where the
symmetries are defined at run time, a standard run-time implementation
of the same algorithm is provided.
For example, the following code completely initializes all elements of
the totally antisymmetric tensor in three dimensions ('epsilon
tensor'):
SGroup<3, AntiSymmetry<0,1>, AntiSymmetry<1,2>> sym;
Eigen::Tensor<double, 3> epsilon(3,3,3);
epsilon.setZero();
epsilon.symCoeff(sym, 0, 1, 2) = 1;
This commit adds an initial implementation of a class template Tensor
that allows for the storage of objects with more than two indices.
Currently, only storing data and setting the object to zero for POD
data types are implemented.
Create a new directory CXX11 under unsupported/Eigen that contains code
that requires C++11. In that directory, add a few generic templates
useful for any module relying on C++11. These templates may be included
with #include <[unsupported/]Eigen/CXX11/Core>. At the moment, this
will only provide templates in the Eigen::internal namespace.
The Matrix is required to be mutable but it also needs to be a reference and
temporaries do not bind to non-const references - thus we need a hack and
cast away the constness.