Moved TBigIntPolynomial.IsEqualTo within the class
This commit is contained in:
parent
6802da1743
commit
37309d2817
|
@ -38,8 +38,8 @@ type
|
|||
property Degree: Integer read GetDegree;
|
||||
property Coefficient[const AIndex: Integer]: TBigInt read GetCoefficient;
|
||||
function CalcValueAt(const AX: Int64): TBigInt;
|
||||
function IsEqualTo(const AOther: TBigIntPolynomial): Boolean;
|
||||
function ScaleVariable(const AScaleFactor: TBigInt): TBigIntPolynomial;
|
||||
function IsEqualTo(const AOther: TBigIntPolynomial): Boolean;
|
||||
function ToString: string;
|
||||
class function Create(const ACoefficients: array of TBigInt): TBigIntPolynomial; static;
|
||||
end;
|
||||
|
@ -72,24 +72,6 @@ begin
|
|||
Result := Result * AX + FCoefficients[i];
|
||||
end;
|
||||
|
||||
function TBigIntPolynomial.IsEqualTo(const AOther: TBigIntPolynomial): Boolean;
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
if Length(FCoefficients) = Length(AOther.FCoefficients) then
|
||||
begin
|
||||
Result := True;
|
||||
for i := 0 to Length(FCoefficients) - 1 do
|
||||
if FCoefficients[i] <> AOther.FCoefficients[i] then
|
||||
begin
|
||||
Result := False;
|
||||
Break;
|
||||
end;
|
||||
end
|
||||
else
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
function TBigIntPolynomial.ScaleVariable(const AScaleFactor: TBigInt): TBigIntPolynomial;
|
||||
var
|
||||
len, i: Integer;
|
||||
|
@ -110,6 +92,24 @@ begin
|
|||
SetLength(Result.FCoefficients, 0);
|
||||
end;
|
||||
|
||||
function TBigIntPolynomial.IsEqualTo(const AOther: TBigIntPolynomial): Boolean;
|
||||
var
|
||||
i: Integer;
|
||||
begin
|
||||
if Length(FCoefficients) = Length(AOther.FCoefficients) then
|
||||
begin
|
||||
Result := True;
|
||||
for i := 0 to Length(FCoefficients) - 1 do
|
||||
if FCoefficients[i] <> AOther.FCoefficients[i] then
|
||||
begin
|
||||
Result := False;
|
||||
Break;
|
||||
end;
|
||||
end
|
||||
else
|
||||
Result := False;
|
||||
end;
|
||||
|
||||
function TBigIntPolynomial.ToString: string;
|
||||
var
|
||||
i: Integer;
|
||||
|
|
Loading…
Reference in New Issue