예제 #1
0
        public override string ToString()
        {
            StringBuilder result = new StringBuilder();

            result.AppendLine($"N = {N}");
            result.AppendLine();
            result.AppendLine($"Polynomial(degree: {PolynomialDegree}, base: {PolynomialBase}):");
            result.AppendLine("ƒ(m) = " + CurrentPolynomial.ToString());
            result.AppendLine();
            result.AppendLine("Prime Factor Base Bounds:");
            result.AppendLine($"RationalFactorBase : {PrimeFactorBase.RationalFactorBaseMax}");
            result.AppendLine($"AlgebraicFactorBase: {PrimeFactorBase.AlgebraicFactorBaseMax}");
            result.AppendLine($"QuadraticPrimeBase Range: {PrimeFactorBase.QuadraticFactorBaseMin} - {PrimeFactorBase.QuadraticFactorBaseMax}");
            result.AppendLine($"QuadraticPrimeBase Count: {PrimeFactorBase.QuadraticBaseCount}");
            result.AppendLine();
            result.AppendLine($"RFB - Rational Factor Base - Count: {RationalFactorPairCollection.Count} - Array of (p, m % p) with prime p");
            result.AppendLine(RationalFactorPairCollection.ToString(200));
            result.AppendLine();
            result.AppendLine($"AFB - Algebraic Factor Base - Count: {AlgebraicFactorPairCollection.Count} - Array of (p, r) such that ƒ(r) ≡ 0 (mod p) and p is prime");
            result.AppendLine(AlgebraicFactorPairCollection.ToString(200));
            result.AppendLine();
            result.AppendLine($"QFB - Quadratic Factor Base - Count: {QuadraticFactorPairCollection.Count} - Array of (p, r) such that ƒ(r) ≡ 0 (mod p) and p is prime");
            result.AppendLine(QuadraticFactorPairCollection.ToString());
            result.AppendLine();

            result.AppendLine();
            result.AppendLine();

            return(result.ToString());
        }
예제 #2
0
        private void NewFactorPairCollections(CancellationToken cancelToken)
        {
            LogMessage($"Constructing new factor bases (- of 3)...");

            if (!RationalFactorPairCollection.Any())
            {
                RationalFactorPairCollection = FactorPairCollection.Factory.BuildRationalFactorPairCollection(this);
            }
            Serialization.Save.FactorPair.Rational(this);
            LogMessage($"Completed rational factor base (1 of 3).");


            if (cancelToken.IsCancellationRequested)
            {
                return;
            }
            if (!AlgebraicFactorPairCollection.Any())
            {
                AlgebraicFactorPairCollection = FactorPairCollection.Factory.BuildAlgebraicFactorPairCollection(cancelToken, this);
            }
            Serialization.Save.FactorPair.Algebraic(this);
            LogMessage($"Completed algebraic factor base (2 of 3).");


            if (cancelToken.IsCancellationRequested)
            {
                return;
            }
            if (!QuadraticFactorPairCollection.Any())
            {
                QuadraticFactorPairCollection = FactorPairCollection.Factory.BuildQuadraticFactorPairCollection(cancelToken, this);
            }
            Serialization.Save.FactorPair.Quadratic(this);
            LogMessage($"Completed quadratic factor base (3 of 3).");

            if (cancelToken.IsCancellationRequested)
            {
                return;
            }
        }