1 #ifndef MTTOOLBOX_ALGORITHM_RECURSION_AND_TEMPERING_HPP
2 #define MTTOOLBOX_ALGORITHM_RECURSION_AND_TEMPERING_HPP
80 template<
typename U,
typename V = U>
106 isPrime = &primitivity;
139 bool verbose =
false,
140 std::ostream& os = std::cout,
141 bool no_lsb =
false) {
146 int veq[bit_size<U>()];
150 for (
int i = 0;; i++) {
151 if (search.start(1000 * mexp)) {
156 *out <<
"not found in " << (i + 1) * 10000 << endl;
163 time_t t = time(NULL);
164 *out <<
"irreducible parameter is found at " << ctime(&t);
167 *out <<
"count = " << search.getCount() << endl;
170 poly = search.getMinPoly();
171 weight = NTL::weight(poly);
175 print_kv(veq, mexp, bit_size<U>());
176 *out <<
"delta = " << dec << delta << endl;
187 time_t t = time(NULL);
188 *out <<
"lsb tempering parameters are found at "
189 << ctime(&t) << endl;
190 print_kv(veq, mexp, bit_size<U>());
191 *out <<
"lsb delta = " << dec << delta << endl;
198 time_t t = time(NULL);
199 *out <<
"tempering parameters are found at " << ctime(&t)
202 print_kv(veq, mexp, bit_size<U>());
203 *out <<
"delta = " << dec << delta << endl;
239 bool verbose =
false,
240 std::ostream& os = std::cout) {
241 return search(lg, st, st, verbose, os,
true);
297 void print_kv(
int veq[],
int mexp,
int size) {
299 for (
int i = 0; i < size; i++) {
300 *out << dec << i + 1 <<
":" << veq[i]
301 <<
"(" << mexp / (i + 1) - veq[i] <<
")"
308 #endif //MTTOOLBOX_ALGORITHM_RECURSION_AND_TEMPERING_HPP
テンパリングパラメータ探索アルゴリズムのための抽象クラス