10 #ifndef EIGEN_CXX11_TENSORSYMMETRY_SYMMETRY_H 11 #define EIGEN_CXX11_TENSORSYMMETRY_SYMMETRY_H 37 template<
int One_,
int Two_>
40 static_assert(One_ != Two_,
"Symmetries must cover distinct indices.");
41 constexpr
static int One = One_;
42 constexpr
static int Two = Two_;
43 constexpr
static int Flags = 0;
46 template<
int One_,
int Two_>
49 static_assert(One_ != Two_,
"Symmetries must cover distinct indices.");
50 constexpr
static int One = One_;
51 constexpr
static int Two = Two_;
55 template<
int One_,
int Two_>
58 static_assert(One_ != Two_,
"Symmetries must cover distinct indices.");
59 constexpr
static int One = One_;
60 constexpr
static int Two = Two_;
64 template<
int One_,
int Two_>
67 static_assert(One_ != Two_,
"Symmetries must cover distinct indices.");
68 constexpr
static int One = One_;
69 constexpr
static int Two = Two_;
98 template<
typename... Gen>
120 template<
typename... Gen>
135 template<
typename... Gen>
154 template<
typename... Sym>
struct tensor_symmetry_num_indices
156 constexpr
static std::size_t value = 1;
162 constexpr
static std::size_t One =
static_cast<std::size_t
>(One_);
163 constexpr
static std::size_t Two =
static_cast<std::size_t
>(Two_);
167 constexpr
static std::size_t maxOneTwoPlusOne = ((One > Two) ? One : Two) + 1;
169 constexpr
static std::size_t value = (maxOneTwoPlusOne > Three) ? maxOneTwoPlusOne : Three;
226 template<std::
size_t NumIndices>
232 template<std::size_t NumIndices,
typename Gen_,
typename... Gens_>
235 constexpr
static std::size_t max_static_generators = 4;
236 constexpr
static std::size_t max_static_elements = 16;
241 possible_size == 0 || possible_size >= max_static_elements,
247 template<
bool instantiate, std::size_t NumIndices,
typename... Gens>
250 constexpr
static std::size_t
size = 0;
254 template<std::size_t NumIndices,
typename... Gens>
257 template<
typename Tensor_>
262 constexpr
static std::size_t NumIndices = Tensor_::NumIndices;
264 static inline int run(
const std::array<Index, NumIndices>& transformed_indices,
int transformation_flags,
int dummy, Tensor_& tensor,
const Scalar& value_)
266 Scalar value(value_);
271 tensor.coeffRef(transformed_indices) = value;
276 template<
typename Tensor_>
280 constexpr
static std::size_t NumIndices = Tensor_::NumIndices;
282 static inline int run(
const std::array<Index, NumIndices>& transformed_indices,
int transform_flags,
int current_flags,
const std::array<Index, NumIndices>& orig_indices)
284 if (transformed_indices == orig_indices) {
292 return current_flags;
296 template<
typename Tensor_,
typename Symmetry_,
int Flags = 0>
302 constexpr
static std::size_t NumIndices = Tensor_::NumIndices;
305 : m_tensor(tensor), m_symmetry(symmetry), m_indices(indices) { }
319 #ifdef EIGEN_TENSOR_SYMMETRY_CHECK_VALUES 320 int value_flags = m_symmetry.template apply<internal::tensor_symmetry_calculate_flags<Tensor_>,
int>(m_indices, m_symmetry.globalFlags(), m_indices);
326 m_symmetry.template apply<internal::tensor_symmetry_assign_value<Tensor_>,
int>(m_indices, 0, m_tensor, value);
334 #endif // EIGEN_CXX11_TENSORSYMMETRY_SYMMETRY_H static int run(const std::array< Index, NumIndices > &transformed_indices, int transformation_flags, int dummy, Tensor_ &tensor, const Scalar &value_)
const AutoDiffScalar< DerType > & conj(const AutoDiffScalar< DerType > &x)
helper::type::type root_type
tensor_symmetry_value_setter(Tensor_ &tensor, Symmetry_ const &symmetry, std::array< Index, NumIndices > const &indices)
static int run(const std::array< Index, NumIndices > &transformed_indices, int transform_flags, int current_flags, const std::array< Index, NumIndices > &orig_indices)
EIGEN_DEVICE_FUNC RealReturnType real() const
Symmetry group, initialized from template arguments.
static constexpr size_t size(Tuple< Args... > &)
Provides access to the number of elements in a tuple as a compile-time constant expression.
internal::tensor_symmetry_pre_analysis< NumIndices, Gen... >::root_type Base
SGroup< Gen... > & operator=(SGroup< Gen... > &&other)
SGroup(SGroup< Gen... > &&other)
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
SGroup< Gen... > & operator=(const SGroup< Gen... > &other)
void doAssign(Scalar const &value)
std::array< Index, NumIndices > m_indices
tensor_static_symgroup_if<(sizeof...(Gens_)+1<=max_static_generators), NumIndices, Gen_, Gens_... > helper
EIGEN_DEVICE_FUNC const ImagReturnType imag() const
SGroup(const SGroup< Gen... > &other)
tensor_symmetry_value_setter< Tensor_, Symmetry_, Flags > & operator=(Scalar const &value)