Skip to content

Commit 046d987

Browse files
committed
test large numbers, improve some comments
1 parent 415d258 commit 046d987

File tree

1 file changed

+36
-36
lines changed

1 file changed

+36
-36
lines changed

src/test/java/de/tilman_neumann/jml/factor/FactorizerTest.java

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -77,22 +77,22 @@ private enum TestMode {
7777

7878
// algorithm options
7979
/** number of test numbers */
80-
private static final int N_COUNT = 100000;
80+
private static final int N_COUNT = 1;
8181
/** the bit size of N to start with */
82-
private static final int START_BITS = 20;
82+
private static final int START_BITS = 100;
8383
/** the increment in bit size from test set to test set */
84-
private static final int INCR_BITS = 5;
84+
private static final int INCR_BITS = 10;
8585
/** maximum number of bits to test (no maximum if null) */
86-
private static final Integer MAX_BITS = 20;
86+
private static final Integer MAX_BITS = null;
8787
/** each algorithm is run REPEATS times for each input in order to reduce GC influence on timings */
88-
private static final int REPEATS = 5;
88+
private static final int REPEATS = 1;
8989
/** number of warmup rounds */
90-
private static final int WARUMPS = 2;
90+
private static final int WARUMPS = 0;
9191

9292
/** Nature of test numbers */
93-
private static final TestNumberNature TEST_NUMBER_NATURE = TestNumberNature.RANDOM_ODD_COMPOSITES;
93+
private static final TestNumberNature TEST_NUMBER_NATURE = TestNumberNature.MODERATE_SEMIPRIMES;
9494
/** Test mode */
95-
private static final TestMode TEST_MODE = TestMode.PRIME_FACTORIZATION;
95+
private static final TestMode TEST_MODE = TestMode.FIRST_FACTOR;
9696

9797
private BPSWTest bpsw = new BPSWTest();
9898

@@ -105,38 +105,38 @@ public FactorizerTest() {
105105
algorithms = new FactorAlgorithm[] {
106106

107107
// Trial division
108-
new TDiv31(),
109-
new TDiv31Inverse(),
110-
new TDiv31Barrett(), // Fastest algorithm for N < 29 bit
111-
new TDiv63(),
112-
new TDiv63Inverse(1<<21),
113-
// new TDiv().setTestLimit(1<<21),
108+
//new TDiv31(),
109+
// new TDiv31Inverse(),
110+
// new TDiv31Barrett(), // very good to completely factor N < 32 bit
111+
//new TDiv63(),
112+
// new TDiv63Inverse(1<<21),
113+
//new TDiv().setTestLimit(1<<21),
114114

115115
// Hart's one line factorizer
116116
//new HartSimple(),
117-
new HartFast(true),
118-
new HartTDivRace(),
119-
new HartTDivRace2(),
120-
new HartSquarefree(true), // best algorithm for semiprime N for 29 to 37 bit
121-
new HartFast2Mult(true), // best algorithm for semiprime N for 38 to 45 bit
122-
new HartFast2MultFMA(true),
123-
new HartFast2Mult2(true), // best algorithm for semiprime N for 38 to 45 bit
117+
// new HartFast(true),
118+
//new HartTDivRace(), // quite good to factor random composites until 40 bit
119+
//new HartTDivRace2(),
120+
//new HartSquarefree(true),
121+
// new HartFast2Mult(true), // with doTDivFirst==false, very good for semiprime N from 25 to 45 bit
122+
// new HartFast2MultFMA(true),
123+
// new HartFast2Mult2(true),
124124

125125
// Lehman
126126
//new LehmanSimple(false),
127127
//new LehmanSmith(false),
128-
new LehmanFast(true), // the variant implemented by bsquared
129-
new LehmanCustomKOrder(true),
128+
//new LehmanFast(true), // the variant implemented by bsquared
129+
//new LehmanCustomKOrder(true),
130130

131131
// PollardRho
132-
// new PollardRho31(),
133-
// new PollardRhoBrent31(),
134-
// new PollardRhoTwoLoops31(),
135-
new PollardRhoBrentMontgomery32(),
132+
//new PollardRho31(),
133+
//new PollardRhoBrent31(),
134+
//new PollardRhoTwoLoops31(),
135+
//new PollardRhoBrentMontgomery32(),
136136

137-
new PollardRhoBrentMontgomery64(),
138-
new PollardRhoBrentMontgomery64MH(),
139-
new PollardRhoBrentMontgomery64MHInlined(),
137+
//new PollardRhoBrentMontgomery64(),
138+
//new PollardRhoBrentMontgomery64MH(),
139+
// new PollardRhoBrentMontgomery64MHInlined(), // best for moderate semiprimes from ~40 to 50 bit
140140

141141
//new PollardRho(),
142142
//new PollardRhoProductGcd(),
@@ -151,8 +151,8 @@ public FactorizerTest() {
151151
// * best multiplier sequence = 1680 * {squarefree sequence}
152152
// * best stopping criterion = O(5.th root(N))
153153
//new SquFoF31(),
154-
new SquFoF31Preload(),
155-
new SquFoF63(),
154+
//new SquFoF31Preload(),
155+
//new SquFoF63(),
156156

157157
// CFrac
158158
// * never the best algorithm: SquFoF63 is better for N <= 65 bit, SIQS is better for N >= 55 bits
@@ -166,9 +166,9 @@ public FactorizerTest() {
166166
// new CFrac63(true, 5, 1.5F, 0.152F, 0.25F, new TDiv_CF63_02(), new MatrixSolverGauss02(), 12),
167167

168168
// ECM
169-
new TinyEcm64(true),
170-
new TinyEcm64MH(true),
171-
new TinyEcm64MHInlined(true), // best algorithm for N from 46 to 62 bit
169+
//new TinyEcm64(true),
170+
//new TinyEcm64MH(true),
171+
// new TinyEcm64MHInlined(true), // very good for N from 46 to 62 bit
172172
// new EllipticCurveMethod(-1),
173173

174174
// SIQS:
@@ -193,7 +193,7 @@ public FactorizerTest() {
193193
// On a Ryzen 3900X, Cmult=0.31 seems to be best for N <= 345 bit, Cmult=0.305 best for N > 345 bit.
194194
// Probably, this depends heavily on the number of threads and the hardware, in particular the size of the L3-Cache.
195195
// new PSIQS(0.31F, 0.37F, null, 12, new NoPowerFinder(), new MatrixSolverBlockLanczos()),
196-
// new PSIQS_U(0.31F, 0.37F, null, 12, new NoPowerFinder(), new MatrixSolverBlockLanczos()),
196+
// new PSIQS_U(0.31F, 0.37F, null, 12, new NoPowerFinder(), new MatrixSolverBlockLanczos()),
197197
// new PSIQS_U(0.31F, 0.37F, null, 12, new NoPowerFinder(), new MatrixSolverPGauss01(12)),
198198
// new PSIQS_U(0.31F, 0.37F, null, 12, new PowerOfSmallPrimesFinder(), new MatrixSolverBlockLanczos()),
199199
// new PSIQS_U(0.31F, 0.37F, null, 12, new AllPowerFinder(), new MatrixSolverBlockLanczos()),

0 commit comments

Comments
 (0)