26 #ifndef TILEDARRAY_SYMM_REPRESENTATION_H__INCLUDED
27 #define TILEDARRAY_SYMM_REPRESENTATION_H__INCLUDED
49 template <
typename Group,
typename Representative>
66 : generator_representatives_(std::move(generator_reps)) {
68 init(generator_representatives_, element_representatives_);
72 size_t order()
const {
return element_representatives_.size(); }
76 std::shared_ptr<group_type>
group()
const {
78 std::vector<element_type> generators;
79 generators.reserve(generator_representatives_.size());
80 for (
const auto& g_op_pair : generator_representatives_) {
81 generators.emplace_back(g_op_pair.first);
84 return std::make_shared<group_type>(std::move(generators));
88 return element_representatives_;
92 std::shared_ptr<group_type> g_;
93 std::map<element_type, representative_type> generator_representatives_;
94 std::map<element_type, representative_type> element_representatives_;
97 static void init(std::map<element_type, representative_type>& generator_reps,
98 std::map<element_type, representative_type>& element_reps) {
105 element_reps = generator_reps;
112 std::vector<element_type> elements;
113 for (
const auto& eop : element_reps) elements.push_back(eop.first);
115 for (
size_t i = 0; i < elements.size(); ++i) {
116 auto e = std::cref(elements[i]);
117 auto e_op = std::cref(element_reps[e]);
118 for (
const auto& g_op_pair : generator_reps) {
119 const auto& g = g_op_pair.first;
120 const auto& g_op = g_op_pair.second;
122 if (element_reps.find(h) == element_reps.end()) {
123 auto h_op = e_op.get() * g_op;
124 element_reps[h] = h_op;
125 const auto orig_elements_capacity = elements.capacity();
126 elements.emplace_back(std::move(h));
128 if (orig_elements_capacity != elements.capacity()) {
129 e = std::cref(elements[i]);
130 e_op = std::cref(element_reps[e]);