@@ -181,28 +181,29 @@ namespace nda {
181181 }
182182
183183 /* *
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+ */
188189 [[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 ));
192193 return vec;
193194 }
194195
195196 /* *
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
199201 */
200202 template <typename V>
201203 void init_from_representative_data (A &x, V const &vec) const {
202204 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]); }
206207 }
207208 };
208209
@@ -278,4 +279,4 @@ namespace nda {
278279 return segment_length;
279280 }
280281 };
281- } // namespace nda
282+ } // namespace nda
0 commit comments