Class CongruenceCollector01
java.lang.Object
de.tilman_neumann.jml.factor.base.congruence.CongruenceCollector01
- All Implemented Interfaces:
CongruenceCollector
public class CongruenceCollector01 extends java.lang.Object implements CongruenceCollector
Collects smooth and partial congruences, and assembles partials to smooth congruences on-the-fly relying solely on the partzial solver.
Partials may have any number of large factors but not too many related partials.
I.e. CFrac will work with 3-partials, because the number of relations is comparably small.
In contrast, SIQS with 3-partials will run into severe performance issues because for large enough N,
many partials have hundreds of thousands of related partials and the partial solver can't solve such big equation systems.
-
Field Summary
Fields Modifier and Type Field Description java.math.BigInteger
factor
-
Constructor Summary
Constructors Constructor Description CongruenceCollector01()
Default constructor that expects 10 more equations than variables to run the matrix solver.CongruenceCollector01(int extraCongruences)
Full constructor. -
Method Summary
Modifier and Type Method Description void
cleanUp()
Release memory after a factorization.void
collectAndProcessAQPair(AQPair aqPair)
Collect a single AQ pair and run the matrix solver if appropriate.void
collectAndProcessAQPairs(java.util.List<AQPair> aqPairs)
Collect AQ pairs and run the matrix solver if appropriate.long
getCollectDuration()
java.math.BigInteger
getFactor()
int
getPartialCongruenceCount()
CongruenceCollectorReport
getReport()
int
getSmoothCongruenceCount()
java.util.Collection<Smooth>
getSmoothCongruences()
long
getSolverDuration()
int
getSolverRunCount()
int
getTestedNullVectorCount()
void
initialize(java.math.BigInteger N, int primeBaseSize, MatrixSolver matrixSolver, FactorTest factorTest)
Initialize congruence collector for a new N.void
setPrimeBaseSize(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
-
CongruenceCollector01
public CongruenceCollector01()Default constructor that expects 10 more equations than variables to run the matrix solver. -
CongruenceCollector01
public CongruenceCollector01(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:CongruenceCollector
Initialize congruence collector for a new N.- Specified by:
initialize
in interfaceCongruenceCollector
-
setPrimeBaseSize
public void setPrimeBaseSize(int newPrimeBaseSize)Description copied from interface:CongruenceCollector
Re-initialize the prime base size. This is useful only for algorithms that combine relations from different prime bases.- Specified by:
setPrimeBaseSize
in interfaceCongruenceCollector
-
collectAndProcessAQPairs
Description copied from interface:CongruenceCollector
Collect 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:
collectAndProcessAQPairs
in interfaceCongruenceCollector
-
collectAndProcessAQPair
Description copied from interface:CongruenceCollector
Collect 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:
collectAndProcessAQPair
in interfaceCongruenceCollector
-
getSmoothCongruenceCount
public int getSmoothCongruenceCount()- Specified by:
getSmoothCongruenceCount
in interfaceCongruenceCollector
- Returns:
- number of smooth congruences found so far.
-
getSmoothCongruences
- Specified by:
getSmoothCongruences
in interfaceCongruenceCollector
- Returns:
- smooth congruences found so far.
-
getPartialCongruenceCount
public int getPartialCongruenceCount()- Specified by:
getPartialCongruenceCount
in interfaceCongruenceCollector
- Returns:
- number of partial congruences found so far.
-
getFactor
public java.math.BigInteger getFactor()- Specified by:
getFactor
in interfaceCongruenceCollector
- Returns:
- the factor that was found or null
-
getReport
- Specified by:
getReport
in interfaceCongruenceCollector
-
getCollectDuration
public long getCollectDuration()- Specified by:
getCollectDuration
in interfaceCongruenceCollector
-
getSolverDuration
public long getSolverDuration()- Specified by:
getSolverDuration
in interfaceCongruenceCollector
-
getSolverRunCount
public int getSolverRunCount()- Specified by:
getSolverRunCount
in interfaceCongruenceCollector
- Returns:
- the number of solvers runs required to find a factor (should be 1)
-
getTestedNullVectorCount
public int getTestedNullVectorCount()- Specified by:
getTestedNullVectorCount
in interfaceCongruenceCollector
- Returns:
- the number of null vector tests required to find a factor
-
cleanUp
public void cleanUp()Description copied from interface:CongruenceCollector
Release memory after a factorization.- Specified by:
cleanUp
in interfaceCongruenceCollector
-