Class MatrixSolver
- java.lang.Object
-
- de.tilman_neumann.jml.factor.base.matrixSolver.MatrixSolver
-
- Direct Known Subclasses:
MatrixSolver01_Gauss
,MatrixSolver02_BlockLanczos
public abstract class MatrixSolver extends Object
Base implementation for a congruence equation system (the "LinAlg phase matrix") solver.- Author:
- Tilman Neumann
-
-
Constructor Summary
Constructors Constructor Description MatrixSolver()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
cleanUp()
Release memory after a factorization.protected Map<Integer,Integer>
createFactor2ColumnIndexMap(Map<Integer,ArrayList<Smooth>> oddExpFactors_2_congruences)
Create a map from odd-exp-elements to matrix column indices.abstract String
getName()
int
getTestedNullVectorCount()
void
initialize(BigInteger N, FactorTest factorTest)
Initialize for a new N.void
processNullVector(Set<AQPair> aqPairs)
protected void
removeSingletons(List<Smooth> congruences, Map<Integer,ArrayList<Smooth>> oddExpFactors_2_congruences)
Remove singletons fromcongruences
.void
solve(Collection<? extends Smooth> congruences)
Main method to solve a congruence equation system.protected abstract void
solve(List<Smooth> congruences, Map<Integer,Integer> factors_2_columnIndices)
Create the matrix from the pre-processed congruences and solve it.
-
-
-
Method Detail
-
getName
public abstract String getName()
-
initialize
public void initialize(BigInteger N, FactorTest factorTest)
Initialize for a new N.- Parameters:
N
-factorTest
-
-
solve
public void solve(Collection<? extends Smooth> congruences) throws FactorException
Main method to solve a congruence equation system.- Parameters:
congruences
- the congruences forming the equation system- Throws:
FactorException
- if a factor of N was found
-
removeSingletons
protected void removeSingletons(List<Smooth> congruences, Map<Integer,ArrayList<Smooth>> oddExpFactors_2_congruences)
Remove singletons fromcongruences
. This can reduce the size of the equation system; actually it never diminishes the difference (#eqs - #vars). It is very fast, too - like 60ms for a matrix for which solution via Gauss elimination takes 1 minute.- Parameters:
congruences
-oddExpFactors_2_congruences
-
-
createFactor2ColumnIndexMap
protected Map<Integer,Integer> createFactor2ColumnIndexMap(Map<Integer,ArrayList<Smooth>> oddExpFactors_2_congruences)
Create a map from odd-exp-elements to matrix column indices.- Parameters:
oddExpFactors_2_congruences
- unsorted map from factors to the congruences in which they appear with odd exponent- Returns:
- map from factors to column indices
-
solve
protected abstract void solve(List<Smooth> congruences, Map<Integer,Integer> factors_2_columnIndices) throws FactorException
Create the matrix from the pre-processed congruences and solve it.- Parameters:
congruences
-factors_2_columnIndices
- map from factors to matrix column indices- Throws:
FactorException
-
processNullVector
public void processNullVector(Set<AQPair> aqPairs) throws FactorException
- Throws:
FactorException
-
getTestedNullVectorCount
public int getTestedNullVectorCount()
- Returns:
- the number of solver runs needed (so far). Is not populated (i.e. 0) if ANALYZE_SOLVER_RUNS==false.
-
cleanUp
public void cleanUp()
Release memory after a factorization.
-
-