DataLab is a compact statistics package aiming at exploratory data analysis. Please visit the DataLab Web site for more information....


Declaration: MatrixSum (Mat1, Mat2: TDouble2DArray; Wgt1, Wgt2: double; var TargetMat: TDouble2DArray): integer;
Calculates the weighted sum of the two open arrays Mat1 and Mat2 and stores the result in the matrix TargetMat. The two parameters Wgt1 and Wgt2 define the weights. The following equation is applied to all elements of the two matrices:

TargetMat = Wgt1*Mat1 + Wgt2*Mat2

The size of the resulting matrix TargetMat is automatically adjusted to the size of Mat1. The function returns the following error codes:

 0 ... everything is OK
-1 ... the sizes of Mat1 and Mat2 do not match