Vector.Max Method

Overload List

#SignatureDescription
1function Max: Double;Maximum value.
└ indexed: function Max(Index: Integer; Len: Integer): Double;
2procedure Max(out AMax: Double; out AIndex: Integer);Calculate the maximum value of all calling object elements.
3procedure Max(out AMax: Double; Index: Integer; Len: Integer);Calculate the maximum value from calling object elements [Index]..[Index+Len-1].
4procedure Max(out AMax: Double; out AIndex: Integer; Index: Integer; Len: Integer);Calculate the maximum value of calling object elements [Index]..[Index+Len-1].

Overload 1: function Max: Double;

Maximum value.

Returns: Double

Remarks:

Returns the maximum value of all calling object elements. The result is a real value. An exception is raised is calling object Vector.Complex is true.

Examples
var a: Vector;
    b: double;
begin
    a.SetIt(False,[1,2,3,4]);
    b := a.Max; // b = 4
end;
var
    a: Vector;
    result: double;
begin
    a := [1.0, 2.0, 3.0, 4.0];
    result := a.Max;
    if Abs(result - 4.0) > 1e-10 then
        raise Exception.Create('Vector.Max: expected 4.0, got ' + result.ToString);
end;
See Also: Vector.Min, Vector.Maxc, Vector.MaxMin

Indexed: function Max(Index: Integer; Len: Integer): Double;

Returns the maximum value from calling object elements [Index]..[Index+Len-1]. The result is a real value.

#NameTypeDescription
1IndexIntegerstart index
2LenIntegerelement count

Returns: Double

Remarks:

An exception is raised if calling object Vector.Complex property is true or array borders are overrun.

Overload 2: procedure Max(out AMax: Double; out AIndex: Integer);

Calculate the maximum value of all calling object elements.

#NameTypeDescription
1AMaxDouble
2AIndexIntegerstart index

Result: stored in self (calling object)

Remarks:

The AMax parameter returns the maximum value. The AIndex parameter returns the index of maximum value. An exception is raised if calling object Vector.Complex property is true.

Overload 3: procedure Max(out AMax: Double; Index: Integer; Len: Integer);

Calculate the maximum value from calling object elements [Index]..[Index+Len-1].

#NameTypeDescription
1AMaxDouble
2IndexIntegerstart index
3LenIntegerelement count

Result: stored in self (calling object)

Remarks:

The result AMean is a real value. An exception is raised if calling object Vector.Complex property is true or array borders are overrun.

Overload 4: procedure Max(out AMax: Double; out AIndex: Integer; Index: Integer; Len: Integer);

Calculate the maximum value of calling object elements [Index]..[Index+Len-1].

#NameTypeDescription
1AMaxDouble
2AIndexIntegerstart index
3IndexIntegerstart index
4LenIntegerelement count

Result: stored in self (calling object)

Remarks:

The AMax parameter returns the maximum value. The AIndex parameter returns the index of maximum value. An exception is raised if calling object Vector.Complex property is true or array borders are overrud/underrun.