Fixed root isolation interval data types
This commit is contained in:
parent
5f93ad7869
commit
1784e41c0f
|
@ -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
|
// 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.
|
// [0, 2^boundexp], with A = C * 2^boundexp / 2^K and B = (C + H) * 2^boundexp / 2^K.
|
||||||
TIsolatingInterval = record
|
TIsolatingInterval = record
|
||||||
C, K, H, BoundExp: Cardinal;
|
C: TBigInt;
|
||||||
|
K, H, BoundExp: Cardinal;
|
||||||
A, B: TBigInt;
|
A, B: TBigInt;
|
||||||
end;
|
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
|
// 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.
|
// 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 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;
|
TIsolatingInterval;
|
||||||
public
|
public
|
||||||
// Returns root-isolating intervals for non-negative, non-multiple roots.
|
// Returns root-isolating intervals for non-negative, non-multiple roots.
|
||||||
|
@ -87,8 +88,8 @@ begin
|
||||||
Result := numeratorBit - denominatorBit;
|
Result := numeratorBit - denominatorBit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class function TPolynomialRoots.CreateIsolatingInterval(const AC, AK, AH: Cardinal; constref ABoundExp: Cardinal):
|
class function TPolynomialRoots.CreateIsolatingInterval(constref AC: TBigInt; const AK, AH: Cardinal;
|
||||||
TIsolatingInterval;
|
constref ABoundExp: Cardinal): TIsolatingInterval;
|
||||||
begin
|
begin
|
||||||
Result.C := AC;
|
Result.C := AC;
|
||||||
Result.K := AK;
|
Result.K := AK;
|
||||||
|
@ -119,7 +120,8 @@ class function TPolynomialRoots.BisectIsolation(constref APolynomial: TBigIntPol
|
||||||
const AFindIntegers: Boolean): TIsolatingIntervalArray;
|
const AFindIntegers: Boolean): TIsolatingIntervalArray;
|
||||||
type
|
type
|
||||||
TWorkItem = record
|
TWorkItem = record
|
||||||
C, K: Cardinal;
|
C: TBigInt;
|
||||||
|
K: Cardinal;
|
||||||
P: TBigIntPolynomial;
|
P: TBigIntPolynomial;
|
||||||
end;
|
end;
|
||||||
TWorkStack = specialize TStack<TWorkItem>;
|
TWorkStack = specialize TStack<TWorkItem>;
|
||||||
|
|
Loading…
Reference in New Issue