diff --git a/cpu-opt/main.cpp b/cpu-opt/main.cpp index 6c7a128..ded223b 100644 --- a/cpu-opt/main.cpp +++ b/cpu-opt/main.cpp @@ -283,63 +283,60 @@ void learn(const Coxeter &cox, CosetTable &cosets, Gen gens[2]; Ind s_i, e_i; Cos s_c, e_c, i_c; - int g_i; - Gen g; int lookup, idx; -#pragma omp parallel for schedule(dynamic, 1) private(gens, s_i, e_i, s_c, e_c, i_c, g_i, g, lookup, idx) + Gen g; +#pragma omp parallel for schedule(dynamic, 1) private(gens, s_i, e_i, s_c, e_c, i_c, lookup, idx, g) for (unsigned int r = 0; r < nrels; ++r) { auto &table = reltables[r]; + auto &start_inds = table.start_inds; + auto &end_inds = table.end_inds; + auto &start_cosets = table.start_cosets; + auto &end_cosets = table.end_cosets; + auto &init_cosets = table.init_cosets; + auto &coset_poss = table.coset_poss; gens[0] = table.gen[0]; gens[1] = table.gen[1]; for (unsigned int c = 0; c < table.num_rows; c++) { - s_i = table.start_inds[c]; - e_i = table.end_inds[c]; - s_c = table.start_cosets[c]; - e_c = table.end_cosets[c]; - i_c = table.init_cosets[c]; + s_i = start_inds[c]; + e_i = end_inds[c]; + s_c = start_cosets[c]; + e_c = end_cosets[c]; + i_c = init_cosets[c]; - g_i = s_i & 1; - g = gens[g_i]; while (s_i < e_i) { - lookup = cosets[g + s_c*ngens]; + lookup = cosets[gens[s_i&1] + s_c*ngens]; if (lookup < 0) break; - g_i = 1-g_i; - g = gens[g_i]; s_i++; s_c = lookup; if (s_c > i_c) { - idx = table.coset_poss[s_c]; + idx = coset_poss[s_c]; if (idx >= 0) table.rem_row(idx); } } - table.start_inds[c] = s_i; - table.start_cosets[c] = s_c; + start_inds[c] = s_i; + start_cosets[c] = s_c; - g_i = e_i & 1; - g = gens[g_i]; while (s_i < e_i) { - lookup = cosets[g + e_c*ngens]; + lookup = cosets[gens[e_i&1] + e_c*ngens]; if (lookup < 0) break; - g_i = 1-g_i; - g = gens[g_i]; e_i--; e_c = lookup; if (e_c > i_c) { - idx = table.coset_poss[e_c]; + idx = coset_poss[e_c]; if (idx >= 0) table.rem_row(idx); } } - table.end_inds[c] = e_i; - table.end_cosets[c] = e_c; + end_inds[c] = e_i; + end_cosets[c] = e_c; if (s_i == e_i) { g = gens[s_i&1];