ScaleMatrix

Declaration: ScaleMatrix (var Data: TDouble2DArray; SclType: TSclType; LowCol, LowRow, HighCol, HighRow: integer; var Par1, Par2: double): integer;
Performs a scaling operation on the two-dimensional array Data. The type of scaling operation is controlled by the parameter SclType (see also: scaling the data for a detailed explanation). The parameters LowCol, LowRow, HighCol and HighRow specify the region of the matrix to be scaled.

The variable parameters Par1 and Par2 contain the required scaling parameters on input and characteristics of the data before the scaling operation on return:

SclType Scaling Operation Par1 Par2
sctMeanCenter The values of the array are scaled in such a way that the mean becomes zero. in: ignored
out: mean
in: ignored
out: 0
sctStandardize The values are scaled to a zero mean and a standard deviation of 1.0. in: ignored
out: mean
in: ignored
out: std.dev
sctConstSum The values are scaled to a constant sum defined by the parameter Par1. in: intended sum
out: actual sum before the scaling
in: ignored
out: 0
sctConstSquaredSum The values are scaled to a constant sum of squared values. The sum is defined by the parameter Par1. in: intended sum
out: actual sum before the scaling
in: ignored
out: 0
sctMaxAbs The values are scaled in such a way that the maximum absolute value becomes Par1 in: intended maximum
out: actual maximum of the absolute values of the minimum and maximum before the scaling
in: ignored
out: 0
sctRange The data values are scaled to cover a range between Par1 and Par2 in: intended lower value
out: actual lowest value before the scaling
in: intended upper value
out: actual highest value before the scaling
sctSquash The data values are compressed by a sigmoid function ("squashing function") to the interval [-1,+1]. The parameter Par1 specifies the origin of the squashing function, the parameter Par2 defines the slope of the function. in: origin of the squashing function
out: same as in
in: slope of the squashing function
out: same as in
sctQNormalize The data is scaled to zero median and a difference between the median and the q-percentile of 1.0, with q (in %) given by the parameter Par1. in: probability q (>50 and <100)
out: median
in: ignored
out: difference of the quantile and the median before the scaling

The function returns the following error codes:

 0 ... everything is OK
-1 ... LowCol or HighCol is out of range
-2 ... LowRow or HighRow is out of range
-3 ... Data matrix has zero size
-5 ... variance of the data is zero
-6 ... sum of the data is zero
-7 ... data has a zero range
-8 ... maximum value is zero
-9 ... probability of quantile must be greater than 50 and less than 100