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....



MinMax


Unit:SDL_vector
Class: TVector, TIntVector
Declaration: procedure MinMax (LowElem, HighElem: integer; var Minimum, Maximum: double); { class TVector }
procedure MinMax (LowElem, HighElem: integer; var Minimum, Maximum: integer); { class TIntVector }

The method MinMax calculates the minimum and the maximum value of the vector elements within a specified range. The range of the vector elements which are used for the calculation is determined by the parameters LowElem and HighElem. If any of these parameters receives an invalid value, this value is automatically adjusted to the most appropriate boundary (either 1 or NrOfElems ). Note, that in the case of the method MinMax the vector is not considered as a vector in its usual sense but merely as a collection of numbers.

The lowest and the highest value of the selected data are returned in the variable parameters Minimum and Maximum.

Example: The statement Vec1.MinMax (10,20,Rmin,Rmax); calculates the lowest and the highest value of the elements with the index 10 to 20 of vector Vec1 and returns them in the variables RMin and RMax.

Example: This method is used in the following example program (see http://www.lohninger.com/examples.html for downloading the code): testvec



Last Update: 2008-Okt-29