public void Sieve(PolyRelationsSieveProgress relationsSieve) { Sieve(relationsSieve._gnfs.PrimeFactorBase.RationalFactorBase, ref RationalQuotient, RationalFactorization); if (IsRationalQuotientSmooth) // No sense wasting time on factoring the AlgebraicQuotient if the relation is ultimately going to be rejected anyways. { Sieve(relationsSieve._gnfs.PrimeFactorBase.AlgebraicFactorBase, ref AlgebraicQuotient, AlgebraicFactorization); } }
public GNFS() { PrimeFactorBase = new FactorBase(); PolynomialCollection = new List <IPolynomial>(); RationalFactorPairCollection = new FactorPairCollection(); AlgebraicFactorPairCollection = new FactorPairCollection(); QuadraticFactorPairCollection = new FactorPairCollection(); CurrentRelationsProgress = new PolyRelationsSieveProgress(); }
public void Sieve(PolyRelationsSieveProgress relationsSieve) { Sieve(relationsSieve._gnfs.PrimeFactorBase.AlgebraicFactorBase, ref AlgebraicQuotient, AlgebraicFactorization); Sieve(relationsSieve._gnfs.PrimeFactorBase.RationalFactorBase, ref RationalQuotient, RationalFactorization); }
public GNFS(CancellationToken cancelToken, LogMessageDelegate logFunction, BigInteger n, BigInteger polynomialBase, int polyDegree, BigInteger primeBound, int relationQuantity, int relationValueRange) : this() { LogFunction = logFunction; N = n; SaveLocations = new DirectoryLocations(N, polynomialBase, polyDegree); if (!Directory.Exists(SaveLocations.SaveDirectory)) { // New GNFS instance Directory.CreateDirectory(SaveLocations.SaveDirectory); LogMessage($"Directory created."); if (polyDegree == -1) { this.PolynomialDegree = CalculateDegree(n); } else { this.PolynomialDegree = polyDegree; } this.PolynomialBase = polynomialBase; if (cancelToken.IsCancellationRequested) { return; } ConstructNewPolynomial(this.PolynomialBase, this.PolynomialDegree); LogMessage($"Polynomial constructed."); if (cancelToken.IsCancellationRequested) { return; } CaclulatePrimeFactorBaseBounds(primeBound); if (cancelToken.IsCancellationRequested) { return; } SetPrimeFactorBases(); LogMessage($"Prime bounds calculated."); if (cancelToken.IsCancellationRequested) { return; } NewFactorPairCollections(cancelToken); LogMessage($"Factor bases populated."); if (cancelToken.IsCancellationRequested) { return; } CurrentRelationsProgress = new PolyRelationsSieveProgress(this, relationQuantity, relationValueRange); LogMessage($"Relations container initialized."); Serialization.Save.All(this); } }