@@ -77,22 +77,22 @@ private enum TestMode {
7777
7878 // algorithm options
7979 /** number of test numbers */
80- private static final int N_COUNT = 1000000 ;
80+ private static final int N_COUNT = 100000 ;
8181 /** the bit size of N to start with */
82- private static final int START_BITS = 20 ;
82+ private static final int START_BITS = 45 ;
8383 /** the increment in bit size from test set to test set */
84- private static final int INCR_BITS = 1 ;
84+ private static final int INCR_BITS = 5 ;
8585 /** maximum number of bits to test (no maximum if null) */
86- private static final Integer MAX_BITS = 31 ;
86+ private static final Integer MAX_BITS = 45 ;
8787 /** each algorithm is run REPEATS times for each input in order to reduce GC influence on timings */
88- private static final int REPEATS = 1 ;
88+ private static final int REPEATS = 5 ;
8989 /** number of warmup rounds */
90- private static final int WARUMPS = 0 ;
90+ private static final int WARUMPS = 2 ;
9191
9292 /** Nature of test numbers */
93- private static final TestNumberNature TEST_NUMBER_NATURE = TestNumberNature .MODERATE_SEMIPRIMES ;
93+ private static final TestNumberNature TEST_NUMBER_NATURE = TestNumberNature .RANDOM_ODD_COMPOSITES ;
9494 /** Test mode */
95- private static final TestMode TEST_MODE = TestMode .FIRST_FACTOR ;
95+ private static final TestMode TEST_MODE = TestMode .PRIME_FACTORIZATION ;
9696
9797 private BPSWTest bpsw = new BPSWTest ();
9898
@@ -106,9 +106,9 @@ public FactorizerTest() {
106106
107107 // Trial division
108108// new TDiv31(),
109- // new TDiv31Inverse(),
110- // new TDiv31Barrett(), // Fastest algorithm for N < 29 bit
111- // new TDiv63Inverse(1<<21),
109+ new TDiv31Inverse (),
110+ new TDiv31Barrett (), // Fastest algorithm for N < 29 bit
111+ new TDiv63Inverse (1 <<21 ),
112112// new TDiv().setTestLimit(1<<20),
113113
114114 // Hart's one line factorizer
@@ -121,23 +121,26 @@ public FactorizerTest() {
121121// new HartFast2Mult(false), // best algorithm for semiprime N for 38 to 45 bit
122122// new HartFast2MultFMA(false),
123123// new HartMultiplierChainSqrtN(false),
124+ new HartFast2Mult (true ), // best algorithm for semiprime N for 38 to 45 bit
125+ new HartFast2MultFMA (true ),
126+ new HartFast2Mult2 (true ), // best algorithm for semiprime N for 38 to 45 bit
124127
125128 // Lehman
126129 //new LehmanSimple(false),
127130 //new LehmanSmith(false),
128131// new LehmanFast(false), // the variant implemented by bsquared
129132 //new LehmanFast(true),
130- // new LehmanCustomKOrder(false ),
133+ new LehmanCustomKOrder (true ),
131134
132135 // PollardRho
133- new PollardRho31 (),
134- new PollardRhoBrent31 (),
135- new PollardRhoTwoLoops31 (),
136+ // new PollardRho31(),
137+ // new PollardRhoBrent31(),
138+ // new PollardRhoTwoLoops31(),
136139 new PollardRhoBrentMontgomery32 (),
137140
138141 //new PollardRhoBrentMontgomery64(),
139- // new PollardRhoBrentMontgomery64MH(),
140- // new PollardRhoBrentMontgomery64MHInlined(),
142+ new PollardRhoBrentMontgomery64MH (),
143+ new PollardRhoBrentMontgomery64MHInlined (),
141144
142145 //new PollardRho(),
143146 //new PollardRhoProductGcd(),
@@ -151,9 +154,9 @@ public FactorizerTest() {
151154 // * SquFoF31 works until 52 bit and is faster there than SquFoF63
152155 // * best multiplier sequence = 1680 * {squarefree sequence}
153156 // * best stopping criterion = O(5.th root(N))
154- // new SquFoF63(),
157+ new SquFoF63 (),
155158 //new SquFoF31(),
156- // new SquFoF31Preload(),
159+ new SquFoF31Preload (),
157160
158161 // CFrac
159162 // * never the best algorithm: SquFoF63 is better for N <= 65 bit, SIQS is better for N >= 55 bits
@@ -168,8 +171,8 @@ public FactorizerTest() {
168171
169172 // ECM
170173// new TinyEcm64(),
171- // new TinyEcm64MH(),
172- // new TinyEcm64MHInlined(), // best algorithm for N from 46 to 62 bit
174+ new TinyEcm64MH (),
175+ new TinyEcm64MHInlined (), // best algorithm for N from 46 to 62 bit
173176// new EllipticCurveMethod(-1),
174177
175178 // SIQS:
@@ -193,20 +196,20 @@ public FactorizerTest() {
193196 // Multi-threaded SIQS:
194197 // On a Ryzen 3900X, Cmult=0.31 seems to be best for N <= 345 bit, Cmult=0.305 best for N > 345 bit.
195198 // Probably, this depends heavily on the number of threads and the hardware, in particular the size of the L3-Cache.
196- // new PSIQS(0.31F, 0.37F, null, 20 , new NoPowerFinder(), new MatrixSolverBlockLanczos()),
197- // new PSIQS_U(0.31F, 0.37F, null, 20 , new NoPowerFinder(), new MatrixSolverBlockLanczos()),
198- // new PSIQS_U(0.31F, 0.37F, null, 20 , new NoPowerFinder(), new MatrixSolverPGauss01(12)),
199- // new PSIQS_U(0.31F, 0.37F, null, 20 , new PowerOfSmallPrimesFinder(), new MatrixSolverBlockLanczos()),
200- // new PSIQS_U(0.31F, 0.37F, null, 20 , new AllPowerFinder(), new MatrixSolverBlockLanczos()),
199+ // new PSIQS(0.31F, 0.37F, null, 12 , new NoPowerFinder(), new MatrixSolverBlockLanczos()),
200+ // new PSIQS_U(0.31F, 0.37F, null, 12 , new NoPowerFinder(), new MatrixSolverBlockLanczos()),
201+ // new PSIQS_U(0.31F, 0.37F, null, 12 , new NoPowerFinder(), new MatrixSolverPGauss01(12)),
202+ // new PSIQS_U(0.31F, 0.37F, null, 12 , new PowerOfSmallPrimesFinder(), new MatrixSolverBlockLanczos()),
203+ // new PSIQS_U(0.31F, 0.37F, null, 12 , new AllPowerFinder(), new MatrixSolverBlockLanczos()),
201204
202205 // experimental PSIQS variants
203- // new PSIQS_U_nLP(0.31F, 0.37F, null, 20 , new NoPowerFinder(), new MatrixSolverBlockLanczos()),
204- // new PSIQS_U_3LP(0.31F, 0.37F, null, 20 , new NoPowerFinder(), new MatrixSolverBlockLanczos()),
205- // new PSIQS_SB_U(0.31F, 0.37F, null, 20 , new NoPowerFinder(), new MatrixSolverBlockLanczos()),
206- // new PSIQS_SB(0.31F, 0.37F, null, 20 , new NoPowerFinder(), new MatrixSolverBlockLanczos()),
206+ // new PSIQS_U_nLP(0.31F, 0.37F, null, 12 , new NoPowerFinder(), new MatrixSolverBlockLanczos()),
207+ // new PSIQS_U_3LP(0.31F, 0.37F, null, 12 , new NoPowerFinder(), new MatrixSolverBlockLanczos()),
208+ // new PSIQS_SB_U(0.31F, 0.37F, null, 12 , new NoPowerFinder(), new MatrixSolverBlockLanczos()),
209+ // new PSIQS_SB(0.31F, 0.37F, null, 12 , new NoPowerFinder(), new MatrixSolverBlockLanczos()),
207210
208211 // Best combination of sub-algorithms for general factor arguments of any size
209- new CombinedFactorAlgorithm (16 , 1 <<16 , true ),
212+ new CombinedFactorAlgorithm (12 , 1 <<16 , true ),
210213 };
211214 }
212215
@@ -227,7 +230,7 @@ private void testRange(int bits) {
227230 }
228231
229232 if (N_COUNT > 1 ) {
230- LOG .info ("Test " + N_COUNT + " N with " + bits + " bit, e.g. N = " + testNumbers [0 ]);
233+ LOG .info ("Test " + REPEATS + "*" + N_COUNT + " N with " + bits + " bit, e.g. N = " + testNumbers [0 ]);
231234 } else {
232235 LOG .info ("Test N = " + testNumbers [0 ] + " (" + bits + " bit)" );
233236 }
0 commit comments