The SDL Component Suite is an industry leading collection of components supporting scientific and engineering computing. Please visit the SDL Web site for more information....



MinMaxArray


Unit:SDL_openarrays
Class: none
Declaration: [1] function MinMaxArray (Src: array of double; var MinVal, MaxVal: double): integer;
[2] function MinMaxArray (Src: TIntArray; var MinVal, MaxVal: integer): integer;
[3] function MinMaxArray (Src: TIntArray; FirstIx, LastIx: integer; var MinVal, MaxVal: integer; var MinIx, MaxIx: integer): integer;
[4] function MinMaxArray (Src: TInt2DArray; var MinVal, MaxVal: integer): integer;
[5] function MinMaxArray (Src: TInt2DArray; LowCol, LowRow, HighCol, HighRow: integer; var MinVal, MaxVal: integer; var MinCol, MinRow, MaxCol, MaxRow: integer): integer;
[6] function MinMaxArray (Src: TInt3DArray; var MinVal, MaxVal: integer): integer;
[7] function MinMaxArray (Src: TInt4DArray; var MinVal, MaxVal: integer): integer;
[8] function MinMaxArray (Src: array of double; var MinVal, MaxVal: double): integer;
[9] function MinMaxArray (Src: TDoubleArray; var MinVal, MaxVal: double): integer;
[10] function MinMaxArray (Src: TDoubleArray; FirstIx, LastIx: integer; var MinVal, MaxVal: double; var MinIx, MaxIx: integer): integer;
[11] function MinMaxArray (Src: TDouble2DArray; var MinVal, MaxVal: double): integer;
[12] function MinMaxArray (Src: TDouble2DArray; LowCol, LowRow, HighCol, HighRow: integer; var MinVal, MaxVal: double; var MinCol, MinRow, MaxCol, MaxRow: integer): integer;
[13] function MinMaxArray (Src: TDouble3DArray; var MinVal, MaxVal: double): integer;
[14] function MinMaxArray (Src: TDouble4DArray; var MinVal, MaxVal: double): integer;
[15] function MinMaxArray (Src: TSingleArray; var MinVal, MaxVal: double): integer;

The function MinMaxArray returns the minimum and the maximum value of the array Src in the variable parameters MinVal and MaxVal.

Please note that versions [1] and [2], and [8] and [9] are actually equivalent. Versions [1] and [8] have been declared for syntactical reasons only: they can be called using an explicit list of values, something like

MinMaxArray ([v1,v2,v3,v4], MinVal, MaxVal);
while versions [2] and [9] cannot be called this way (the compiler does not resolve the TDoubleArray declaration).

Versions [3], [5], [10] and [12] provide additional information and can be restricted to a particular range of array elements. The parameters FirstIx and LastIx define the search range for versions [3] and [10], the parameters LowCol, LowRow, HighCol and HighRow specify the search range of versions [5] and [12]. The variable parameters MinIx and MaxIx (versions [3] and [10]) and MinCol, MinRow, MaxCol, MaxRow (versions [5] and [12]) return the indices of the found minimum and maximum.

The function returns a zero value if everything is OK and the MinVal and MaxVal parameters contain the minimum and maximum.

The function returns the following error codes:

 0 ... everything is OK, the returned value is valid
-1 ... the array has zero size
-2 ... FirstIx and/or LastIx is out of range (version [3] or [10]), or LowCol, HighCol, LowRow or HighRow is out of range (version [5] or [12])



Last Update: 2023-Feb-06