Skip to content

Commit

Permalink
get rid of snake case in class names
Browse files Browse the repository at this point in the history
  • Loading branch information
TilmanNeumann committed Dec 30, 2024
1 parent a93e14c commit 8be49b0
Show file tree
Hide file tree
Showing 40 changed files with 187 additions and 187 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@

import de.tilman_neumann.jml.factor.base.FactorArguments;
import de.tilman_neumann.jml.factor.base.FactorResult;
import de.tilman_neumann.jml.factor.base.matrixSolver.MatrixSolver_Gauss02;
import de.tilman_neumann.jml.factor.base.matrixSolver.MatrixSolver_BlockLanczos;
import de.tilman_neumann.jml.factor.base.matrixSolver.MatrixSolverGauss02;
import de.tilman_neumann.jml.factor.base.matrixSolver.MatrixSolverBlockLanczos;
import de.tilman_neumann.jml.factor.ecm.EllipticCurveMethod;
import de.tilman_neumann.jml.factor.ecm.TinyEcm64MHInlined;
import de.tilman_neumann.jml.factor.hart.HartFast2Mult;
Expand Down Expand Up @@ -73,10 +73,10 @@ public class CombinedFactorAlgorithm extends FactorAlgorithm {
private EllipticCurveMethod ecm = new EllipticCurveMethod(0);

// SIQS tuned for small N
private SIQS siqs_smallArgs;
private SIQS siqsForSmallArgs;

// The SIQS chosen for big arguments depends on constructor parameters
private FactorAlgorithm siqs_bigArgs;
private FactorAlgorithm siqsForBigArgs;

private BPSWTest bpsw = new BPSWTest();

Expand All @@ -102,20 +102,20 @@ public CombinedFactorAlgorithm(int numberOfThreads, Integer tdivLimit, boolean p
super(tdivLimit);

Sieve smallSieve = permitUnsafeUsage ? new Sieve03gU() : new Sieve03g();
siqs_smallArgs = new SIQS(0.32F, 0.37F, null, new PowerOfSmallPrimesFinder(), new SIQSPolyGenerator(), smallSieve, new TDiv_QS_Small(), 10, new MatrixSolver_Gauss02());
siqsForSmallArgs = new SIQS(0.32F, 0.37F, null, new PowerOfSmallPrimesFinder(), new SIQSPolyGenerator(), smallSieve, new TDiv_QS_Small(), 10, new MatrixSolverGauss02());

if (numberOfThreads==1) {
// Avoid multi-thread overhead if the requested number of threads is 1
if (permitUnsafeUsage) {
siqs_bigArgs = new SIQS(0.31F, 0.37F, null, new NoPowerFinder(), new SIQSPolyGenerator(), new Sieve03hU(), new TDiv_QS_2LP(permitUnsafeUsage), 10, new MatrixSolver_BlockLanczos());
siqsForBigArgs = new SIQS(0.31F, 0.37F, null, new NoPowerFinder(), new SIQSPolyGenerator(), new Sieve03hU(), new TDiv_QS_2LP(permitUnsafeUsage), 10, new MatrixSolverBlockLanczos());
} else {
siqs_bigArgs = new SIQS(0.31F, 0.37F, null, new NoPowerFinder(), new SIQSPolyGenerator(), new Sieve03h(), new TDiv_QS_2LP(permitUnsafeUsage), 10, new MatrixSolver_BlockLanczos());
siqsForBigArgs = new SIQS(0.31F, 0.37F, null, new NoPowerFinder(), new SIQSPolyGenerator(), new Sieve03h(), new TDiv_QS_2LP(permitUnsafeUsage), 10, new MatrixSolverBlockLanczos());
}
} else {
if (permitUnsafeUsage) {
siqs_bigArgs = new PSIQS_U(0.31F, 0.37F, null, numberOfThreads, new NoPowerFinder(), new MatrixSolver_BlockLanczos());
siqsForBigArgs = new PSIQS_U(0.31F, 0.37F, null, numberOfThreads, new NoPowerFinder(), new MatrixSolverBlockLanczos());
} else {
siqs_bigArgs = new PSIQS(0.31F, 0.37F, null, numberOfThreads, new NoPowerFinder(), new MatrixSolver_BlockLanczos());
siqsForBigArgs = new PSIQS(0.31F, 0.37F, null, numberOfThreads, new NoPowerFinder(), new MatrixSolverBlockLanczos());
}
}
}
Expand All @@ -131,8 +131,8 @@ public BigInteger findSingleFactor(BigInteger N) {
if (NBits<25) return tDiv31.findSingleFactor(N);
if (NBits<46) return hart.findSingleFactor(N);
if (NBits<63) return tinyEcm.findSingleFactor(N);
if (NBits<=150) return siqs_smallArgs.findSingleFactor(N);
return siqs_bigArgs.findSingleFactor(N);
if (NBits<=150) return siqsForSmallArgs.findSingleFactor(N);
return siqsForBigArgs.findSingleFactor(N);
}

@Override
Expand Down Expand Up @@ -206,8 +206,8 @@ public void searchFactors(FactorArguments args, FactorResult result) {
}

// SIQS / PSIQS: The crossover point needs checking
if (NBits<=150) siqs_smallArgs.searchFactors(args, result);
else siqs_bigArgs.searchFactors(args, result);
if (NBits<=150) siqsForSmallArgs.searchFactors(args, result);
else siqsForBigArgs.searchFactors(args, result);
}
}

Expand Down
50 changes: 25 additions & 25 deletions src/main/java/de/tilman_neumann/jml/factor/FactorizerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,11 @@ public FactorizerTest() {
// * stopRoot, stopMult: if big enough, then a second k is rarely needed; (5, 1.5) is good
// * TDiv_CF01 is good for N < 80 bits; for N > 90 bit we need TDiv_CF02
// * ksAdjust: Must be <=3 for N=20bit, <=6 for N=30 bit etc. // TODO this implies some optimization potential
// new CFrac(true, 5, 1.5F, 0.152F, 0.253F, new TDiv_CF01(), new MatrixSolver_Gauss02(), 5),
// new CFrac(true, 5, 1.5F, 0.152F, 0.253F, new TDiv_CF02(), new MatrixSolver_Gauss02(), 5),
// new CFrac(true, 5, 1.5F, 0.152F, 0.253F, new TDiv_CF03(), new MatrixSolver_Gauss02(), 5),
// new CFrac63(true, 5, 1.5F, 0.152F, 0.25F, new TDiv_CF63_01(), new MatrixSolver_Gauss02(), 3),
// new CFrac63(true, 5, 1.5F, 0.152F, 0.25F, new TDiv_CF63_02(), new MatrixSolver_Gauss02(), 12),
// new CFrac(true, 5, 1.5F, 0.152F, 0.253F, new TDiv_CF01(), new MatrixSolverGauss02(), 5),
// new CFrac(true, 5, 1.5F, 0.152F, 0.253F, new TDiv_CF02(), new MatrixSolverGauss02(), 5),
// new CFrac(true, 5, 1.5F, 0.152F, 0.253F, new TDiv_CF03(), new MatrixSolverGauss02(), 5),
// new CFrac63(true, 5, 1.5F, 0.152F, 0.25F, new TDiv_CF63_01(), new MatrixSolverGauss02(), 3),
// new CFrac63(true, 5, 1.5F, 0.152F, 0.25F, new TDiv_CF63_02(), new MatrixSolverGauss02(), 12),

// ECM
// new TinyEcm64(),
Expand All @@ -146,36 +146,36 @@ public FactorizerTest() {

// SIQS:
// small N
// new SIQS_Small(0.32F, 0.37F, null, new SIQSPolyGenerator(), 10, true),
// new SIQS(0.32F, 0.37F, null, new NoPowerFinder(), new SIQSPolyGenerator(), new SimpleSieve(), new TDiv_QS_Small(), 10, new MatrixSolver_Gauss02()),
// new SIQS(0.32F, 0.37F, null, new NoPowerFinder(), new SIQSPolyGenerator(), new Sieve03g(), new TDiv_QS_Small(), 10, new MatrixSolver_Gauss02()),
// new SIQS(0.32F, 0.37F, null, new NoPowerFinder(), new SIQSPolyGenerator(), new Sieve03gU(), new TDiv_QS_Small(), 10, new MatrixSolver_Gauss02()),
// new SIQS(0.32F, 0.37F, null, new NoPowerFinder(), new SIQSPolyGenerator(), new Sieve03gU(), new TDiv_QS_Small(), 10, new MatrixSolver_Gauss02()),
// new SIQSSmall(0.32F, 0.37F, null, new SIQSPolyGenerator(), 10, true),
// new SIQS(0.32F, 0.37F, null, new NoPowerFinder(), new SIQSPolyGenerator(), new SimpleSieve(), new TDiv_QS_Small(), 10, new MatrixSolverGauss02()),
// new SIQS(0.32F, 0.37F, null, new NoPowerFinder(), new SIQSPolyGenerator(), new Sieve03g(), new TDiv_QS_Small(), 10, new MatrixSolverGauss02()),
// new SIQS(0.32F, 0.37F, null, new NoPowerFinder(), new SIQSPolyGenerator(), new Sieve03gU(), new TDiv_QS_Small(), 10, new MatrixSolverGauss02()),
// new SIQS(0.32F, 0.37F, null, new NoPowerFinder(), new SIQSPolyGenerator(), new Sieve03gU(), new TDiv_QS_Small(), 10, new MatrixSolverGauss02()),

// large N
// new SIQS(0.31F, 0.37F, null, new NoPowerFinder(), new SIQSPolyGenerator(), new Sieve03g(), new TDiv_QS_2LP_Full(true), 10, new MatrixSolver_PGauss01(12)),
// new SIQS(0.31F, 0.37F, null, new NoPowerFinder(), new SIQSPolyGenerator(), new Sieve03gU(), new TDiv_QS_2LP_Full(true), 10, new MatrixSolver_PGauss01(12)),
// new SIQS(0.31F, 0.37F, null, new NoPowerFinder(), new SIQSPolyGenerator(), new Sieve03h(), new TDiv_QS_2LP(true), 10, new MatrixSolver_PGauss01(12)),
// new SIQS(0.31F, 0.37F, null, new NoPowerFinder(), new SIQSPolyGenerator(), new Sieve03hU(), new TDiv_QS_2LP(true), 10, new MatrixSolver_PGauss01(4)),
// new SIQS(0.31F, 0.37F, null, new NoPowerFinder(), new SIQSPolyGenerator(), new Sieve03g(), new TDiv_QS_2LP_Full(true), 10, new MatrixSolverPGauss01(12)),
// new SIQS(0.31F, 0.37F, null, new NoPowerFinder(), new SIQSPolyGenerator(), new Sieve03gU(), new TDiv_QS_2LP_Full(true), 10, new MatrixSolverPGauss01(12)),
// new SIQS(0.31F, 0.37F, null, new NoPowerFinder(), new SIQSPolyGenerator(), new Sieve03h(), new TDiv_QS_2LP(true), 10, new MatrixSolverPGauss01(12)),
// new SIQS(0.31F, 0.37F, null, new NoPowerFinder(), new SIQSPolyGenerator(), new Sieve03hU(), new TDiv_QS_2LP(true), 10, new MatrixSolverPGauss01(4)),

// sieving with prime powers: best sieve for small N!
// new SIQS(0.31F, 0.37F, null, new PowerOfSmallPrimesFinder(), new SIQSPolyGenerator(), new Sieve03hU(), new TDiv_QS_2LP(true), 10, new MatrixSolver_Gauss03()),
// new SIQS(0.31F, 0.37F, null, new AllPowerFinder(), new SIQSPolyGenerator(), new Sieve03hU(), new TDiv_QS_2LP(true), 10, new MatrixSolver_Gauss03()),
// new SIQS(0.31F, 0.37F, null, new PowerOfSmallPrimesFinder(), new SIQSPolyGenerator(), new Sieve03hU(), new TDiv_QS_2LP(true), 10, new MatrixSolverGauss03()),
// new SIQS(0.31F, 0.37F, null, new AllPowerFinder(), new SIQSPolyGenerator(), new Sieve03hU(), new TDiv_QS_2LP(true), 10, new MatrixSolverGauss03()),

// Multi-threaded SIQS:
// On a Ryzen 3900X, Cmult=0.31 seems to be best for N <= 345 bit, Cmult=0.305 best for N > 345 bit.
// Probably, this depends heavily on the number of threads and the hardware, in particular the size of the L3-Cache.
// new PSIQS(0.31F, 0.37F, null, 20, new NoPowerFinder(), new MatrixSolver_BlockLanczos()),
// new PSIQS_U(0.31F, 0.37F, null, 20, new NoPowerFinder(), new MatrixSolver_BlockLanczos()),
// new PSIQS_U(0.31F, 0.37F, null, 20, new NoPowerFinder(), new MatrixSolver_PGauss01(12)),
// new PSIQS_U(0.31F, 0.37F, null, 20, new PowerOfSmallPrimesFinder(), new MatrixSolver_BlockLanczos()),
// new PSIQS_U(0.31F, 0.37F, null, 20, new AllPowerFinder(), new MatrixSolver_BlockLanczos()),
// new PSIQS(0.31F, 0.37F, null, 20, new NoPowerFinder(), new MatrixSolverBlockLanczos()),
// new PSIQS_U(0.31F, 0.37F, null, 20, new NoPowerFinder(), new MatrixSolverBlockLanczos()),
// new PSIQS_U(0.31F, 0.37F, null, 20, new NoPowerFinder(), new MatrixSolverPGauss01(12)),
// new PSIQS_U(0.31F, 0.37F, null, 20, new PowerOfSmallPrimesFinder(), new MatrixSolverBlockLanczos()),
// new PSIQS_U(0.31F, 0.37F, null, 20, new AllPowerFinder(), new MatrixSolverBlockLanczos()),

// experimental PSIQS variants
// new PSIQS_U_nLP(0.31F, 0.37F, null, 20, new NoPowerFinder(), new MatrixSolver_BlockLanczos()),
// new PSIQS_U_3LP(0.31F, 0.37F, null, 20, new NoPowerFinder(), new MatrixSolver_BlockLanczos()),
// new PSIQS_SB_U(0.31F, 0.37F, null, 20, new NoPowerFinder(), new MatrixSolver_BlockLanczos()),
// new PSIQS_SB(0.31F, 0.37F, null, 20, new NoPowerFinder(), new MatrixSolver_BlockLanczos()),
// new PSIQS_U_nLP(0.31F, 0.37F, null, 20, new NoPowerFinder(), new MatrixSolverBlockLanczos()),
// new PSIQS_U_3LP(0.31F, 0.37F, null, 20, new NoPowerFinder(), new MatrixSolverBlockLanczos()),
// new PSIQS_SB_U(0.31F, 0.37F, null, 20, new NoPowerFinder(), new MatrixSolverBlockLanczos()),
// new PSIQS_SB(0.31F, 0.37F, null, 20, new NoPowerFinder(), new MatrixSolverBlockLanczos()),

// Best combination of sub-algorithms for general factor arguments of any size
new CombinedFactorAlgorithm(16, 1<<16, true),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,16 @@ public class AQPairFactory {
public AQPair create(BigInteger A, SortedIntegerArray smallFactors, SortedLongArray bigFactors) {
int distinctBigFactorsCount = bigFactors.size();
if (distinctBigFactorsCount == 0) {
return new Smooth_Perfect(A, smallFactors);
return new SmoothPerfect(A, smallFactors);
}
if (distinctBigFactorsCount == 1) {
int exp = bigFactors.getExponent(0);
if (exp==1) return new Partial_1Large(A, smallFactors, bigFactors.get(0));
if (exp==2) return new Smooth_1LargeSquare(A, smallFactors, bigFactors.get(0));
if (exp==1) return new Partial1Large(A, smallFactors, bigFactors.get(0));
if (exp==2) return new Smooth1LargeSquare(A, smallFactors, bigFactors.get(0));
// higher exponents are treated below
} else if (distinctBigFactorsCount == 2) {
if (bigFactors.getExponent(0)==1 && bigFactors.getExponent(1)==1) {
return new Partial_2Large(A, smallFactors, bigFactors.get(0), bigFactors.get(1));
return new Partial2Large(A, smallFactors, bigFactors.get(0), bigFactors.get(1));
}
// total factor counts > 2 are treated below
}
Expand All @@ -50,10 +50,10 @@ public AQPair create(BigInteger A, SortedIntegerArray smallFactors, SortedLongAr
for (int i=0; i<distinctBigFactorsCount; i++) {
if ((bigFactors.getExponent(i)&1)==1) {
// big factors are not square -> it is a partial congruence
return new Partial_nLarge(A, smallFactors, bigFactors);
return new PartialNLarge(A, smallFactors, bigFactors);
}
}
// big factors are square -> it is a smooth congruence
return new Smooth_nLargeSquares(A, smallFactors, bigFactors);
return new SmoothNLargeSquares(A, smallFactors, bigFactors);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
* Reduced to work with perfect smooths and 1-partials only.
* @author Tilman Neumann
*/
public class CongruenceCollector_Small implements CongruenceCollector {
private static final Logger LOG = LogManager.getLogger(CongruenceCollector_Small.class);
public class CongruenceCollectorSmall implements CongruenceCollector {
private static final Logger LOG = LogManager.getLogger(CongruenceCollectorSmall.class);
private static final boolean DEBUG = false; // used for logs and asserts
private static final boolean ANALYZE = false;

Expand Down Expand Up @@ -75,15 +75,15 @@ public class CongruenceCollector_Small implements CongruenceCollector {
/**
* Default constructor that expects 10 more equations than variables to run the matrix solver.
*/
public CongruenceCollector_Small() {
public CongruenceCollectorSmall() {
this(10);
}

/**
* Full constructor.
* @param extraCongruences The difference #equations-#variables required before the solver is started.
*/
public CongruenceCollector_Small(int extraCongruences) {
public CongruenceCollectorSmall(int extraCongruences) {
this.extraCongruences = extraCongruences;
}

Expand Down Expand Up @@ -171,8 +171,8 @@ private boolean add(AQPair aqPair) throws FactorException {
}

// otherwise aqPair must be a partial with one large factor.
if (DEBUG) Ensure.ensureTrue(aqPair instanceof Partial_1Large);
Partial_1Large partial = (Partial_1Large) aqPair;
if (DEBUG) Ensure.ensureTrue(aqPair instanceof Partial1Large);
Partial1Large partial = (Partial1Large) aqPair;
final Long bigFactor = partial.getLargeFactorsWithOddExponent()[0];

// Check if the partial helps to assemble a smooth congruence:
Expand All @@ -182,7 +182,7 @@ private boolean add(AQPair aqPair) throws FactorException {
Set<AQPair> partials = new LinkedHashSet<>();
partials.add(partial);
partials.add(relatedPartial);
Smooth foundSmooth = new Smooth_Composite(partials);
Smooth foundSmooth = new SmoothComposite(partials);
boolean added = addSmooth(foundSmooth); // throws FactorException
if (ANALYZE) {
if (added) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public static ArrayList<Smooth> findIndependentCycles(HashSet<Partial> relations
allPartials.addAll(chains.get(r0));
allPartials.add(ri);
allPartials.addAll(chains.get(ri));
Smooth smooth = new Smooth_Composite(allPartials);
Smooth smooth = new SmoothComposite(allPartials);
smoothsFromPartials.add(smooth);
continue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*
* @author Tilman Neumann
*/
public class Partial_1Large extends Partial {
public class Partial1Large extends Partial {

private long bigFactor; // needs 8 byte instead of 56 byte for a Long[1]

Expand All @@ -33,7 +33,7 @@ public class Partial_1Large extends Partial {
* @param smallFactors small factors of Q
* @param bigFactor the single large factor of Q
*/
public Partial_1Large(BigInteger A, SortedIntegerArray smallFactors, long bigFactor) {
public Partial1Large(BigInteger A, SortedIntegerArray smallFactors, long bigFactor) {
super(A, smallFactors);
// only 1 large factor
this.bigFactor = bigFactor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*
* @author Tilman Neumann
*/
public class Partial_2Large extends Partial {
public class Partial2Large extends Partial {

private long bigFactor1, bigFactor2; // needs 16 byte instead of 64 byte for a Long[2]

Expand All @@ -34,7 +34,7 @@ public class Partial_2Large extends Partial {
* @param bigFactor1 the first large factor of Q
* @param bigFactor2 the second large factor of Q
*/
public Partial_2Large(BigInteger A, SortedIntegerArray smallFactors, long bigFactor1, long bigFactor2) {
public Partial2Large(BigInteger A, SortedIntegerArray smallFactors, long bigFactor1, long bigFactor2) {
super(A, smallFactors);
// we have 2 large factor; guarantee that bigFactor1 is the smaller one
if (bigFactor1 <= bigFactor2) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
*
* @author Tilman Neumann
*/
public class Partial_nLarge extends Partial {
public class PartialNLarge extends Partial {

private long[] bigFactors; // needs about 50 byte for 3 large factors
private byte[] bigFactorExponents; // needs about 36 byte for 3 large factors
Expand All @@ -37,7 +37,7 @@ public class Partial_nLarge extends Partial {
* @param smallFactors small factors of Q
* @param bigFactors large factors of Q
*/
public Partial_nLarge(BigInteger A, SortedIntegerArray smallFactors, SortedLongArray bigFactors) {
public PartialNLarge(BigInteger A, SortedIntegerArray smallFactors, SortedLongArray bigFactors) {
super(A, smallFactors);
// copy big factors of Q
this.bigFactors = bigFactors.copyFactors();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ private Smooth solve(List<Partial> congruences, Map<Long, Integer> factors_2_col
}
// We found a smooth congruence from partials.
// Checking for exact squares is done in CongruenceCollector.addSmooth(), no need to do it here again...
Smooth smoothCongruence = new Smooth_Composite(totalAQPairs);
Smooth smoothCongruence = new SmoothComposite(totalAQPairs);
return smoothCongruence;
} // else: current row is not a null-vector -> just keep it
} // else: current row does not have the pivotColumnIndex -> just keep it
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ private Smooth solve2Partials() {
totalAQPairs.add(congruence);
}
// Checking for exact squares is done in CongruenceCollector.addSmooth(), no need to do it here again...
Smooth smoothCongruence = new Smooth_Composite(totalAQPairs);
Smooth smoothCongruence = new SmoothComposite(totalAQPairs);
return smoothCongruence;
}

Expand Down Expand Up @@ -400,7 +400,7 @@ private Smooth solveSmall(Map<Long, Integer> factors_2_columnIndices) {
}
// We found a smooth congruence from partials.
// Checking for exact squares is done in CongruenceCollector.addSmooth(), no need to do it here again...
Smooth smoothCongruence = new Smooth_Composite(totalAQPairs);
Smooth smoothCongruence = new SmoothComposite(totalAQPairs);
return smoothCongruence;
} // else: current row is not a null-vector -> just keep it
} // else: current row does not have the pivotColumnIndex -> just keep it
Expand Down Expand Up @@ -429,7 +429,7 @@ private Smooth solveLarge(Map<Long, Integer> factors_2_columnIndices) {
break;
}

// solution operations taken directly from MatrixSolver_Gauss01 ++
// solution operations taken directly from MatrixSolverGauss01
row.addXor(pivot); // This operation should be fast!
if (row.isNullVector()) {
if (DEBUG) LOG.debug("solve(): 5: Found null-vector: " + row);
Expand All @@ -442,7 +442,7 @@ private Smooth solveLarge(Map<Long, Integer> factors_2_columnIndices) {
}
// We found a smooth congruence from partials.
// Checking for exact squares is done in CongruenceCollector.addSmooth(), no need to do it here again...
Smooth smoothCongruence = new Smooth_Composite(totalAQPairs);
Smooth smoothCongruence = new SmoothComposite(totalAQPairs);
return smoothCongruence;
} else {
// else: current row is not a null-vector, keep trying to reduce
Expand Down
Loading

0 comments on commit 8be49b0

Please sign in to comment.