Class CongruenceCollector03
java.lang.Object
de.tilman_neumann.jml.factor.base.congruence.CongruenceCollector03
- All Implemented Interfaces:
CongruenceCollector
public class CongruenceCollector03 extends java.lang.Object implements CongruenceCollector
First congruence collector using a cycle counter for 3LP.
With 3LP, the cycle count from the cycle counting algorithm is an upper bound of the true number of cycles.
So if it indicates that we might have found a new cycle, then the partial solver must be run to check that and resolve the smooth congruence.
With 3-partials and large enough N, some partials may have hundreds of thousands of "related partials".
Collecting them all would be such a heavy load for findRelatedPartials() and for the partial solver that factoring progress would eventually nearly come to a stop.
To prevent that, we had to insert a "cutoff" where findRelatedPartials() stops looking for more related partials;
furthermore this seems to produce a lot of duplicate smooth relations... Thus we had to make smoothCongruences a Set instead of a List.
But now it works!
-
Field Summary
Fields Modifier and Type Field Description java.math.BigIntegerfactor -
Constructor Summary
Constructors Constructor Description CongruenceCollector03()Default constructor that expects 10 more equations than variables to run the matrix solver.CongruenceCollector03(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
-
CongruenceCollector03
public CongruenceCollector03()Default constructor that expects 10 more equations than variables to run the matrix solver. -
CongruenceCollector03
public CongruenceCollector03(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
-