The SDL Component Suite is an industry leading collection of components supporting scientific and engineering computing. Please visit the SDL Web site for more information....



Fill


Unit:SDL_matrix
Class: TMatrix, TIntMatrix, TMat3D
Declaration: [1] procedure Fill (value: double); { class TMatrix, and TMat3D }
[2] procedure Fill (LowCol, HighCol, LowRow, HighRow: integer; value: double); { class TMatrix }
[3] procedure Fill (value: integer); { class TIntMatrix }
[4] procedure Fill (LowCol, HighCol, LowRow, HighRow: integer; value: double); { class TIntMatrix }

The method Fill sets all elements of a matrix to value (versions [1] and [3]). For a sparse matrix the method Fill sets only the non-zero elements to value. If value is zero the sparse matrix is completely emptied and any allocated memory is released.

Versions [2] and [4] allow filling a particular rectangular region of the matrix by specifying the lower and upper columns and rows of the area to be filled (parameters LowCol, HighCol, LowRow and HighRow).

Hint 1: Setting both the low and high parameter of a dimension (i.e. LowCol and HighCol) to zero values forces the method to use all elements of that dimension.

Hint 2: The class TMatrix has no explicit method to clear the elements of the matrix. In order to reset all elements to zero values, the method Fill should be used.

Example: The statement Mat.Fill(0.0); clears all elements of the matrix Mat.

Example: This method is used in the following example program (see http://www.lohninger.com/examples.html for downloading the code): covar, findcent, invmat



Last Update: 2023-Feb-10