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


Declaration: FillDiagMatrix(var Mat: TDouble2DArray; Diag: double);
Fill all elements of the two-dimensional dynamic array Mat with zero values, except for the main diagonal which is set to Diag. Setting Diag to 1.0 creates an identity matrix.

The function returns the following error codes:

 0 ... everything is OK
-1 ... the matrix Mat has zero size
-2 ... Mat is not square matrix