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



InvertArray


Unit:SDL_openarrays
Class: none
Declaration: [1] function InvertArray (var Arr: TBoolArray): integer;
[2] function InvertArray (var Arr: TBool2DArray): integer;
[3] function InvertArray (var Arr: TDouble2DArray): integer;

The function InvertArray inverts the array Arr. Please keep in mind that inverting a boolean array (versions [1] and [2]) is completely different to inverting a (square) numeric array (version [3]).

Versions [1] and [2]:

The inversion of boolean arrays is done cell by cell by exchanging TRUE and FALSE values. The function returns the following error codes:

 0 ... everything is OK
-1 ... Arr has zero size

Version [3]:

The inversion of a numeric array means calculating the inverse matrix of the (square) array Arr. The inverse matrix is stored on top of the original data (thereby destroying the original contents). The matrix inversion is carried out using the LU-decomposition procedure (decomposition into two triangle matrices). It must not be applied to non-quadratic matrices.

The function returns the following error codes:

 0 ... everything is OK
-1 ... Arr is not a square matrix
-2 ... not enough memory on heap
-3 ... LU decomposition was not possible (the matrix is singular)
In the case of a non-zero return code the resulting matrix is undefined.

Version [3] increments the global variable ProcStat and calls the feedback routine MathFeedBackProc in order to allow feedback to the user during time consuming calculations. The InvertArray function can be terminated by setting the global variable AbortMathProc to TRUE.

Hint: The lower limit of the necessary free heap memory can be calculated by the equation n*((n+2)*8+2) (bytes), with 'n' being the number of columns of the matrix.



Last Update: 2018-Dec-21