@@ -181,28 +181,29 @@ namespace nda {
181
181
}
182
182
183
183
/* *
184
- * Reduce multidimensional array to its representative data using symmetries
185
- * @param x An NdArray
186
- * @return Vector of data values for the representatives elements of each symmetry class
187
- */
184
+ * Reduce a multidimensional array to its representative data using symmetries
185
+ *
186
+ * @param x The multidimensional array
187
+ * @return Vector of data values for the representative elements of each symmetry class
188
+ */
188
189
[[nodiscard]] std::vector<get_value_t <A>> get_representative_data (A const &x) const {
189
- long const len = sym_classes.size ();
190
- std::vector<get_value_t <A>> vec (len);
191
- for (auto const i : range (len)) vec[i] = std::apply (x, x.indexmap ().to_idx (sym_classes[i][0 ].first ));
190
+ size_t len = sym_classes.size ();
191
+ auto vec = std::vector<get_value_t <A>>(len);
192
+ for (long i : range (len)) vec[i] = std::apply (x, x.indexmap ().to_idx (sym_classes[i][0 ].first ));
192
193
return vec;
193
194
}
194
195
195
196
/* *
196
- * Init multidimensional array from its representative data using symmetries
197
- * @param x An NdArray
198
- * @param vec Vector or vector view of data values for the representatives elements of each symmetry class
197
+ * Initialize a multidimensional array from its representative data using symmetries
198
+ *
199
+ * @param x The multidimensional array
200
+ * @param vec Vector of data values for the representative elements of each symmetry class
199
201
*/
200
202
template <typename V>
201
203
void init_from_representative_data (A &x, V const &vec) const {
202
204
static_assert (std::is_same_v<const get_value_t <A> &, decltype (vec[0 ])>);
203
- for (auto const i : range (vec.size ())) {
204
- auto const ref_val = vec[i];
205
- for (auto const &[lin_idx, op] : sym_classes[i]) { std::apply (x, x.indexmap ().to_idx (lin_idx)) = op (ref_val); }
205
+ for (long i : range (vec.size ())) {
206
+ for (auto const &[lin_idx, op] : sym_classes[i]) { std::apply (x, x.indexmap ().to_idx (lin_idx)) = op (vec[i]); }
206
207
}
207
208
};
208
209
@@ -278,4 +279,4 @@ namespace nda {
278
279
return segment_length;
279
280
}
280
281
};
281
- } // namespace nda
282
+ } // namespace nda
0 commit comments