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 Degree: Integer read GetDegree;
|
||||||
property Coefficient[const AIndex: Integer]: TBigInt read GetCoefficient;
|
property Coefficient[const AIndex: Integer]: TBigInt read GetCoefficient;
|
||||||
function CalcValueAt(const AX: Int64): TBigInt;
|
function CalcValueAt(const AX: Int64): TBigInt;
|
||||||
function IsEqualTo(const AOther: TBigIntPolynomial): Boolean;
|
|
||||||
function ScaleVariable(const AScaleFactor: TBigInt): TBigIntPolynomial;
|
function ScaleVariable(const AScaleFactor: TBigInt): TBigIntPolynomial;
|
||||||
|
function IsEqualTo(const AOther: TBigIntPolynomial): Boolean;
|
||||||
function ToString: string;
|
function ToString: string;
|
||||||
class function Create(const ACoefficients: array of TBigInt): TBigIntPolynomial; static;
|
class function Create(const ACoefficients: array of TBigInt): TBigIntPolynomial; static;
|
||||||
end;
|
end;
|
||||||
|
@ -72,24 +72,6 @@ begin
|
||||||
Result := Result * AX + FCoefficients[i];
|
Result := Result * AX + FCoefficients[i];
|
||||||
end;
|
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;
|
function TBigIntPolynomial.ScaleVariable(const AScaleFactor: TBigInt): TBigIntPolynomial;
|
||||||
var
|
var
|
||||||
len, i: Integer;
|
len, i: Integer;
|
||||||
|
@ -110,6 +92,24 @@ begin
|
||||||
SetLength(Result.FCoefficients, 0);
|
SetLength(Result.FCoefficients, 0);
|
||||||
end;
|
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;
|
function TBigIntPolynomial.ToString: string;
|
||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
|
|
Loading…
Reference in New Issue