FillDiagMatrix

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