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


Declaration: MatrixMultElem (Mat1, Mat2: TDouble2DArray; Wgt, Offs: double; var TargetMat: TDouble2DArray): integer;
Multiplies the two matrices Mat1 and Mat2 elementwise. The elements of matrix Mat2 can be offset by the parameter Offs. The Wgt parameter can be used to scale the result according to the following equation:

TargetMat[] := Mat1[] * (Mat2[] + Offs) * Wgt;

The results are stored in the matrix TargetMat. The function returns the following error codes:

 0 ... everything is OK
-1 ... Mat1 and Mat2 do not match in size

Hint: The following statement squares the elements of the matrix Data: MatrixMultElem(Data, Data, 1.0, 0.0, Data);