14 for (i = 0; i < unique.size(); i++) {
17 if (unique[i].size() != input.
size())
continue;
18 for (j = 0; j < ind_equiv.size(); j++) {
20 for (k = 0; k < ind_equiv[j].size(); k++) {
21 tval = input[ind_equiv[j][k]];
23 for (l = 0; l < ind_equiv[j].size(); l++)
24 tcount +=
int(unique[i][ind_equiv[j][l]] == tval) -
25 int(input[ind_equiv[j][l]] == tval);
27 if (tcount != 0)
break;
29 if (k != ind_equiv[j].size())
break;
31 if (j == ind_equiv.size())
return i;
42 for (i = 0; i < unique.size(); i++) {
45 if (unique[i].size() != input.
size())
continue;
46 for (j = 0; j < input.
size(); j++) {
49 for (l = 0; l < input.
size(); l++)
50 tcount +=
int(unique[i][l] == tval) - int(input[l] == tval);
52 if (tcount != 0)
break;
55 if (j == input.
size())
return i;
63 if (!series.
size())
return 0;
64 int lcm_val(series[0]);
65 for (
Index i = 1; i < series.
size(); i++) lcm_val =
lcm(lcm_val, series[i]);
77 std::cerr <<
"WARNING in global/definitions::get_prime_factors"
79 std::cerr <<
"You're asking for prime factors of " << target
80 <<
". Returning empty array." << std::endl
87 while (target % factor == 0) {
89 target = target / factor;
94 if (factor_list.
size() > 0) {
100 return factors_array;
void push_back(const T &toPush)
Index which_unique_combination(const Array< Index > &input, const Array< Index >::X2 &unique, const Array< Index >::X2 &ind_equiv)
ReturnArray< Array< int > > get_prime_factors(int target)
int lcm(const Array< int > &series)
Find least common multiple.
INDEX_TYPE Index
For long integer indexing: