Class MatrixSolver

    • Constructor Detail

      • MatrixSolver

        public MatrixSolver()
    • 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 from congruences. 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
      • 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.