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


Class: TMatrix
Declaration: [1] function Square (MatRes: TMatrix; Norm: double): boolean; { class TMatrix }
[2] function Square (MatRes: TMatrix; Norm: double; NThreads: integer): boolean; { class TMatrix }

The method Square calculates the square of the matrix and stores the results in the matrix MatRes which is automatically resized. The parameter Norm determines the normalisation factor which is used to divide the elements of the result matrix. The function returns a TRUE value if the result is valid, a FALSE value indicates that the calculation has been aborted by the user (by means of setting AbortMathProc to TRUE).

Square increments the global variable ProcStat and calls the feedback routine MathFeedBackProc in order to allow feedback to the user during time consuming calculations.

The function Square is available in two overloaded versions: version [1] automatically switches to multiprocessing if more than one CPU core is available. This speeds up calculations by a factor which is roughly proportional to the number of available hardware codes (supported only for Delphi/C++Builder XE4 or higher). Version [2] allows you to control the number of cores to be used for the calculation by setting the parameter NThreads.

Hint 1: In single-threaded applications this function works three times faster than the CalcCovar routine, provided that the matrix columns are already mean-centered.

Last Update: 2017-Apr-19