Class CongruenceCollector02
java.lang.Object
de.tilman_neumann.jml.factor.base.congruence.CongruenceCollector02
- All Implemented Interfaces:
CongruenceCollector
public class CongruenceCollector02 extends java.lang.Object implements CongruenceCollector
Collects smooth and partial congruences, using cycle counting and finding algorithms instead of a partial solver.
Works only for <= 2 large primes.
-
Field Summary
Fields Modifier and Type Field Description java.math.BigIntegerfactor -
Constructor Summary
Constructors Constructor Description CongruenceCollector02()Default constructor that expects 10 more equations than variables to run the matrix solver.CongruenceCollector02(int extraCongruences)Full constructor. -
Method Summary
Modifier and Type Method Description voidcleanUp()Release memory after a factorization.voidcollectAndProcessAQPair(AQPair aqPair)Collect a single AQ pair and run the matrix solver if appropriate.voidcollectAndProcessAQPairs(java.util.List<AQPair> aqPairs)Collect AQ pairs and run the matrix solver if appropriate.longgetCollectDuration()java.math.BigIntegergetFactor()intgetPartialCongruenceCount()CongruenceCollectorReportgetReport()intgetSmoothCongruenceCount()java.util.Collection<Smooth>getSmoothCongruences()longgetSolverDuration()intgetSolverRunCount()intgetTestedNullVectorCount()voidinitialize(java.math.BigInteger N, int primeBaseSize, MatrixSolver matrixSolver, FactorTest factorTest)Initialize congruence collector for a new N.voidsetPrimeBaseSize(int newPrimeBaseSize)Re-initialize the prime base size.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
factor
public java.math.BigInteger factor
-
-
Constructor Details
-
CongruenceCollector02
public CongruenceCollector02()Default constructor that expects 10 more equations than variables to run the matrix solver. -
CongruenceCollector02
public CongruenceCollector02(int extraCongruences)Full constructor.- Parameters:
extraCongruences- The difference #equations-#variables required before the solver is started.
-
-
Method Details
-
initialize
public void initialize(java.math.BigInteger N, int primeBaseSize, MatrixSolver matrixSolver, FactorTest factorTest)Description copied from interface:CongruenceCollectorInitialize congruence collector for a new N.- Specified by:
initializein interfaceCongruenceCollector
-
setPrimeBaseSize
public void setPrimeBaseSize(int newPrimeBaseSize)Description copied from interface:CongruenceCollectorRe-initialize the prime base size. This is useful only for algorithms that combine relations from different prime bases.- Specified by:
setPrimeBaseSizein interfaceCongruenceCollector
-
collectAndProcessAQPairs
Description copied from interface:CongruenceCollectorCollect AQ pairs and run the matrix solver if appropriate. In a multi-threaded factoring algorithm, this method needs to be run in a block synchronized on this. This also speeds up single-threaded solvers like Block-Lanczos, because on modern CPUs single threads run at a higher clock rate.- Specified by:
collectAndProcessAQPairsin interfaceCongruenceCollector
-
collectAndProcessAQPair
Description copied from interface:CongruenceCollectorCollect a single AQ pair and run the matrix solver if appropriate. In a multi-threaded factoring algorithm, this method needs to be run in a block synchronized on this. This also speeds up single-threaded solvers like Block-Lanczos, because on modern CPUs single threads run at a higher clock rate.- Specified by:
collectAndProcessAQPairin interfaceCongruenceCollector
-
getSmoothCongruenceCount
public int getSmoothCongruenceCount()- Specified by:
getSmoothCongruenceCountin interfaceCongruenceCollector- Returns:
- number of smooth congruences found so far.
-
getSmoothCongruences
- Specified by:
getSmoothCongruencesin interfaceCongruenceCollector- Returns:
- smooth congruences found so far.
-
getPartialCongruenceCount
public int getPartialCongruenceCount()- Specified by:
getPartialCongruenceCountin interfaceCongruenceCollector- Returns:
- number of partial congruences found so far.
-
getFactor
public java.math.BigInteger getFactor()- Specified by:
getFactorin interfaceCongruenceCollector- Returns:
- the factor that was found or null
-
getReport
- Specified by:
getReportin interfaceCongruenceCollector
-
getCollectDuration
public long getCollectDuration()- Specified by:
getCollectDurationin interfaceCongruenceCollector
-
getSolverDuration
public long getSolverDuration()- Specified by:
getSolverDurationin interfaceCongruenceCollector
-
getSolverRunCount
public int getSolverRunCount()- Specified by:
getSolverRunCountin interfaceCongruenceCollector- Returns:
- the number of solvers runs required to find a factor (should be 1)
-
getTestedNullVectorCount
public int getTestedNullVectorCount()- Specified by:
getTestedNullVectorCountin interfaceCongruenceCollector- Returns:
- the number of null vector tests required to find a factor
-
cleanUp
public void cleanUp()Description copied from interface:CongruenceCollectorRelease memory after a factorization.- Specified by:
cleanUpin interfaceCongruenceCollector
-