17namespace IndexFunction {
18template <
class InputIt,
class InputItInt>
23 for (; first != last; ++first, ++first_int) {
24 comb_index += *first * stride;
30template <
class InputItInt,
class OutputIt>
34 assert(d_first != d_last);
35 for (; d_first != std::next(d_last, -1); ++first, ++d_first) {
36 *d_first = comb_index % *first;
37 comb_index =
Index(comb_index / *first);
39 *(std::next(d_last, -1)) = comb_index;
42template <
class InputIt,
class OutputIt>
45 assert(d_first != d_last);
46 for (; d_first != std::next(d_last, -1); ++first, ++d_first) {
48 if (*d_first < *first)
50 *d_first =
typename std::iterator_traits<OutputIt>::value_type(0);
52 ++(*(std::next(d_last, -1)));
Provides shared types, platform headers, and basic definitions.
Index vec_index_to_comb_index(InputIt first, InputIt last, InputItInt first_int)
void comb_index_to_vec_index(Index comb_index, InputItInt first, OutputIt d_first, OutputIt d_last)
void incr_vec_index(InputIt first, OutputIt d_first, OutputIt d_last)
Core namespace for Ensign's numerical algorithms and data structures.
Provides contiguous multidimensional arrays for CPU and GPU storage.