Eigen::internal::tensor_symmetry_pre_analysis< NumIndices, Sym > Class Template Reference

Pre-select whether to use a static or dynamic symmetry group. More...

#include <Symmetry.h>

Detailed Description

template<std::size_t NumIndices, typename... Sym>
class Eigen::internal::tensor_symmetry_pre_analysis< NumIndices, Sym >

Pre-select whether to use a static or dynamic symmetry group.

When a symmetry group could in principle be determined at compile time, this template implements the logic whether to actually do that or whether to rather defer that to runtime.

The logic is as follows:

No generators (trivial symmetry):
Use a trivial static group. Ideally, this has no performance impact compared to not using symmetry at all. In practice, this might not be the case.
More than 4 generators:
Calculate the group at run time, it is likely far too large for the compiler to be able to properly generate it in a realistic time.
Up to and including 4 generators:
Actually enumerate all group elements, but then check how many there are. If there are more than 16, it is unlikely that unrolling the loop (as is done in the static compile-time case) is sensible, so use a dynamic group instead. If there are at most 16 elements, actually use that static group. Note that the largest group with 4 generators still compiles with reasonable resources.

Note: Example compile time performance with g++-4.6 on an Intenl Core i5-3470 with 16 GiB RAM (all generators non-redundant and the subgroups don't factorize):

1 0.5 s / 250 MiB 0.45s / 230 MiB 2 0.5 s / 260 MiB 0.5 s / 250 MiB 3 0.65s / 310 MiB 0.62s / 310 MiB 4 2.2 s / 860 MiB 1.7 s / 770 MiB 5 130 s / 13000 MiB 120 s / 11000 MiB

It is clear that everything is still very efficient up to 4 generators, then the memory and CPU requirements become unreasonable. Thus we only instantiate the template group theory logic if the number of generators supplied is 4 or lower, otherwise this will be forced to be done during runtime, where the algorithm is reasonably fast.


The documentation for this class was generated from the following file: