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

Home Programming DataLab DLabPascal 2-Dimensional Arrays TMatrix Class TMatrix |
||
![]() |
||
Class TMatrixThe class TMatrix provide a container for a two-dimensional matrix of floating point numbers (of type double) and the corresponding methods to manipulate this matrix.The indices of a matrix of the class TMatrix are counted starting at 1 up to NrOfRows, or NrOfColumns respectively. In order to use TMatrix the user has first to create one or several matrices (instances of class TMatrix ) by calling the method Create. If a matrix is not needed anymore, it should be removed from the memory by calling the method Free. The individual elements of a matrix are represented by the property Elem. Most of the matrix operations are available via methods. The matrix can be manipulated using the following properties and methods: The following code snippet shows a very simple sample application: a square matrix (Mat1) of 27 elements is created and filled with a constant value for the diagonal elements of 1.0, with all other elements being set to zero values. At the end of the program the matrix is destroyed.
const
MatCols = 40; { size of the matrix }
MatRows = 27;
var
Mat1 : TMatrix;
begin
Mat1 := TMatrix.Create (nil);
Mat1.Resize (MatCols, MatRows);
{ here comes your code to
process the matrix Mat1 }
Mat1.Free;
end;
|
||