/// <summary> /// Factoriza o polinómio aplicando os métodos conhecidos. /// </summary> /// <param name="polynomial">O polinómio a ser factorizado.</param> /// <param name="primeNumber">O número primo.</param> /// <param name="bound">O limite dos coeficientes que podem representar números inteiros.</param> /// <param name="iterationsNumber">O número de iterações para o algoritmo do levantamento multifactor.</param> /// <param name="factorsList">A lista de factores.</param> /// <returns>O coeficiente independente.</returns> private CoeffType FactorizePolynomial( UnivariatePolynomialNormalForm <CoeffType> polynomial, CoeffType primeNumber, CoeffType bound, int iterationsNumber, List <UnivariatePolynomialNormalForm <CoeffType> > factorsList) { var modularField = this.modularSymmetricFactory.CreateInstance(primeNumber); var linearSystemSolver = new DenseCondensationLinSysAlgorithm <CoeffType>( modularField); var finiteFieldFactAlg = new FiniteFieldPolFactorizationAlgorithm <CoeffType>( linearSystemSolver, this.integerNumber); var finiteFieldFactorizationResult = finiteFieldFactAlg.Run( polynomial, modularField); var multiFactorLiftingStatus = new MultiFactorLiftingStatus <CoeffType>( polynomial, finiteFieldFactorizationResult, primeNumber); var multiFactorLiftingResult = this.multiFactorLiftingAlg.Run( multiFactorLiftingStatus, iterationsNumber); var searchResult = this.searchFactorizationAlgorithm.Run( multiFactorLiftingResult, bound, 3); if (searchResult.IntegerFactors.Count > 0) { factorsList.AddRange(searchResult.IntegerFactors); if (searchResult.NonIntegerFactors.Count > 0) // É necessário factorizar. { var currentFactor = searchResult.IntegerFactors[0]; for (int i = 1; i < searchResult.IntegerFactors.Count; ++i) { currentFactor = currentFactor.Multiply( searchResult.IntegerFactors[i], this.integerNumber); } var nonFactored = MathFunctions.GetIntegerDivision( searchResult.MainPolynomial, currentFactor, this.integerNumber); } } else { } throw new NotImplementedException(); }