Просмотр исходного кода

Fixed bug causing incorrect solution.

When the controller decomp(...) function would run, it would change the modulus using ZZ_p::init(), so if the decomp failed and the 'do while' loop in generate_problem() needed a second iteration, the ZZ_p base and target would be incorrect because they would be using the incorrect modulus. The decomp(...) function now resets the modulus before it exits.
Steven Engler 8 лет назад
Родитель
Сommit
eab9bf0d09
1 измененных файлов с 1 добавлено и 0 удалено
  1. 1 0
      controller.cc

+ 1 - 0
controller.cc

@@ -471,6 +471,7 @@ static vector<SubproblemProgress> decomp(const ZZ_p &base, const ZZ_p &target,
 	phi *= f.fvec[i];
     }
 
+    ZZ_pPush push; // This will backup and restore the ZZ_p at the end of the function
     ZZ_p::init(f.factor);
     for (int i = 0; i < fveclen; ++i) {
 	const ZZ& order = f.fvec[i];