10 #ifndef EIGEN_CXX11_TENSORSYMMETRY_DYNAMICSYMMETRY_H
11 #define EIGEN_CXX11_TENSORSYMMETRY_DYNAMICSYMMETRY_H
26 void add(
int one,
int two,
int flags = 0);
28 template<
typename Gen_>
29 inline void add(Gen_) {
add(Gen_::One, Gen_::Two, Gen_::Flags); }
35 template<
typename Op,
typename RV,
typename Index, std::size_t N,
typename... Args>
36 inline RV
apply(
const std::array<Index, N>& idx, RV initial, Args&&... args)
const
38 eigen_assert(N >=
m_numIndices &&
"Can only apply symmetry group to objects that have at least the required amount of indices.");
39 for (std::size_t
i = 0;
i <
size();
i++)
40 initial = Op::run(
h_permute(
i, idx,
typename internal::gen_numeric_list<int, N>::type()),
m_elements[
i].flags, initial, std::forward<Args>(args)...);
44 template<
typename Op,
typename RV,
typename Index,
typename... Args>
45 inline RV
apply(
const std::vector<Index>& idx, RV initial, Args&&... args)
const
47 eigen_assert(idx.size() >=
m_numIndices &&
"Can only apply symmetry group to objects that have at least the required amount of indices.");
48 for (std::size_t
i = 0;
i <
size();
i++)
56 template<
typename Tensor_,
typename... IndexTypes>
57 inline internal::tensor_symmetry_value_setter<Tensor_, DynamicSGroup>
operator()(Tensor_& tensor,
typename Tensor_::Index firstIndex, IndexTypes... otherIndices)
const
59 static_assert(
sizeof...(otherIndices) + 1 == Tensor_::NumIndices,
"Number of indices used to access a tensor coefficient must be equal to the rank of the tensor.");
60 return operator()(tensor, std::array<typename Tensor_::Index, Tensor_::NumIndices>{{firstIndex, otherIndices...}});
63 template<
typename Tensor_>
64 inline internal::tensor_symmetry_value_setter<Tensor_, DynamicSGroup>
operator()(Tensor_& tensor, std::array<typename Tensor_::Index, Tensor_::NumIndices>
const& indices)
const
66 return internal::tensor_symmetry_value_setter<Tensor_, DynamicSGroup>(tensor, *
this, indices);
92 template<
typename Index, std::size_t N,
int...
n>
93 inline std::array<Index, N>
h_permute(std::size_t which,
const std::array<Index, N>& idx, internal::numeric_list<int, n...>)
const
98 template<
typename Index>
99 inline std::vector<Index>
h_permute(std::size_t which, std::vector<Index> idx)
const
101 std::vector<Index> result;
102 result.reserve(idx.size());
103 for (
auto k :
m_elements[which].representation)
104 result.push_back(idx[k]);
106 result.push_back(idx[
i]);
116 if (k == (std::size_t)g.
one)
118 else if (k == (std::size_t)g.
two)
126 GroupElement
mul(GroupElement, GroupElement)
const;
129 return mul(
ge(g1), g2);
134 return mul(g1,
ge(g2));
145 if (ee.representation ==
e.representation)
146 return ee.flags ^
e.flags;
155 template<
typename... Gen>
161 add_all(internal::type_list<Gen...>());
169 template<
typename Gen1,
typename... GenNext>
170 inline void add_all(internal::type_list<Gen1, GenNext...>)
173 add_all(internal::type_list<GenNext...>());
204 std::size_t newNumIndices = (one > two) ? one : two + 1;
206 gelem.representation.reserve(newNumIndices);
208 gelem.representation.push_back(
i);
240 for (std::size_t
i = 1;
i < coset_order;
i++)
244 std::size_t coset_rep = coset_order;
252 for (std::size_t
i = 1;
i < coset_order;
i++)
258 coset_rep += coset_order;
264 switch (flagDiffOfSameGenerator) {
Array< int, Dynamic, 1 > v
Array< double, 1, 3 > e(1./3., 0.5, 2.)
#define eigen_internal_assert(x)
DynamicSGroupFromTemplateArgs(DynamicSGroupFromTemplateArgs const &other)
void add_all(internal::type_list< Gen1, GenNext... >)
DynamicSGroupFromTemplateArgs< Gen... > & operator=(DynamicSGroupFromTemplateArgs< Gen... > &&o)
DynamicSGroupFromTemplateArgs()
DynamicSGroupFromTemplateArgs< Gen... > & operator=(const DynamicSGroupFromTemplateArgs< Gen... > &o)
void add_all(internal::type_list<>)
DynamicSGroupFromTemplateArgs(DynamicSGroupFromTemplateArgs &&other)
GroupElement mul(GroupElement g1, Generator g2) const
internal::tensor_symmetry_value_setter< Tensor_, DynamicSGroup > operator()(Tensor_ &tensor, typename Tensor_::Index firstIndex, IndexTypes... otherIndices) const
std::vector< Index > h_permute(std::size_t which, std::vector< Index > idx) const
DynamicSGroup & operator=(const DynamicSGroup &o)
std::array< Index, N > h_permute(std::size_t which, const std::array< Index, N > &idx, internal::numeric_list< int, n... >) const
void updateGlobalFlags(int flagDiffOfSameGenerator)
internal::tensor_symmetry_value_setter< Tensor_, DynamicSGroup > operator()(Tensor_ &tensor, std::array< typename Tensor_::Index, Tensor_::NumIndices > const &indices) const
void addSymmetry(int one, int two)
void addHermiticity(int one, int two)
GroupElement mul(Generator g1, Generator g2) const
void addAntiHermiticity(int one, int two)
std::vector< Generator > m_generators
DynamicSGroup(const DynamicSGroup &o)
DynamicSGroup & operator=(DynamicSGroup &&o)
DynamicSGroup(DynamicSGroup &&o)
void add(int one, int two, int flags=0)
GroupElement mul(GroupElement, GroupElement) const
void addAntiSymmetry(int one, int two)
int findElement(GroupElement e) const
RV apply(const std::array< Index, N > &idx, RV initial, Args &&... args) const
std::vector< GroupElement > m_elements
RV apply(const std::vector< Index > &idx, RV initial, Args &&... args) const
GroupElement ge(Generator const &g) const
GroupElement mul(Generator g1, GroupElement g2) const
: TensorContractionSycl.h, provides various tensor contraction kernel for SYCL backend
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
constexpr Generator(int one_, int two_, int flags_)
std::vector< int > representation