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


Declaration:function CalcDiffMat (InData, DiffMat: TMatrix; LoC, HiC: integer; LoR, HiR: integer; Scaling: integer): boolean;

The routine CalcDiffMat calculates the difference matrix from a given data matrix. The resulting matrix is of the dimension (HiC -LoC +1)*(HiC -LoC +1), this means that the rows of the data matrix are seen as objects and the columns are seen as variables.

The parameter InData holds a pointer to the matrix of the input data. This matrix is an object of the class TMatrix. The parameter DiffMat holds a pointer to a matrix which will contain the difference matrix to be calculated.

The parameters LoC, HiC, LoR, and HiR specify the range of the data matrix, which should be used for the calculation. This enables to calculate 'local' difference matrices which originates from only a part of the data. Normally the calculation will be performed for the whole data matrix InData, LoC =1, HiC =InData.NrOfColumns, LoR =1, and HiR =InData.NrOfRows

The parameter Scaling determines how to scale the data before calculating the result matrix. This will lead to three different matrices, depending on the parameter Scaling :

Scaling Action Resulting matrix
0 none difference matrix of InData
1 mean centering ??? matrix of InData
2 standardization ??? matrix of InData

Standardization of the data (sometimes called 'autoscaling') is performed by scaling the data in a way that the mean of each column becomes zero and the variance becomes 1.0.

The function CalcDiffMat returns the value TRUE if the calculation of the difference matrix has been performed successfully. A returned value of FALSE indicates that the calculation could not finished properly (mostly due to lack of memory or too small a matrix DiffMat

Hint: The user is responsible by his own that the matrix DiffMat has been declared large enough to hold the resulting difference matrix. This matrix has to be quadratic and of size (HiC -LoC +1)*-(HiC -LoC +1). If the matrix DiffMat is too large the difference matrix is stored in the matrix elements with the lowest indices (starting at 1). The unused elements are not changed at all.

Last Update: 2012-Oct-20