Fixed root isolation interval data types

This commit is contained in:
Stefan Müller 2024-05-26 19:28:04 +02:00
parent 5f93ad7869
commit 1784e41c0f
1 changed files with 7 additions and 5 deletions

View File

@ -31,7 +31,8 @@ type
// Represents an isolating interval of the form [C / 2^K, (C + H) / 2^K] in respect to [0, 1] or [A, B] in respect to
// [0, 2^boundexp], with A = C * 2^boundexp / 2^K and B = (C + H) * 2^boundexp / 2^K.
TIsolatingInterval = record
C, K, H, BoundExp: Cardinal;
C: TBigInt;
K, H, BoundExp: Cardinal;
A, B: TBigInt;
end;
@ -46,7 +47,7 @@ type
// Returns the exponent (base two) of an upper bound for the roots of the given polynomial, i.e. all real roots of
// the given polynomial are less or equal than 2^b, where b is the returned positive integer.
class function CalcUpperRootBound(constref APolynomial: TBigIntPolynomial): Cardinal;
class function CreateIsolatingInterval(const AC, AK, AH: Cardinal; constref ABoundExp: Cardinal):
class function CreateIsolatingInterval(constref AC: TBigInt; const AK, AH: Cardinal; constref ABoundExp: Cardinal):
TIsolatingInterval;
public
// Returns root-isolating intervals for non-negative, non-multiple roots.
@ -87,8 +88,8 @@ begin
Result := numeratorBit - denominatorBit;
end;
class function TPolynomialRoots.CreateIsolatingInterval(const AC, AK, AH: Cardinal; constref ABoundExp: Cardinal):
TIsolatingInterval;
class function TPolynomialRoots.CreateIsolatingInterval(constref AC: TBigInt; const AK, AH: Cardinal;
constref ABoundExp: Cardinal): TIsolatingInterval;
begin
Result.C := AC;
Result.K := AK;
@ -119,7 +120,8 @@ class function TPolynomialRoots.BisectIsolation(constref APolynomial: TBigIntPol
const AFindIntegers: Boolean): TIsolatingIntervalArray;
type
TWorkItem = record
C, K: Cardinal;
C: TBigInt;
K: Cardinal;
P: TBigIntPolynomial;
end;
TWorkStack = specialize TStack<TWorkItem>;