Record TRMatrix

Unit

Declaration

type generic TRMatrix<TSpace> = record

Description

Generic square matrix of real values (double) with dimension TSpace.N × TSpace.N.

The matrix elements are stored in a 1-based 2D array. Use the default array property a[row, col] to read and write individual elements. Concrete types are provided as TR2Matrix, TR3Matrix, and TR4Matrix.

Overview

Methods

Public function IsNotNull: boolean;
Public function IsNull: boolean;
Public function RowReduction: TRMatrix;
Public function Trace: double;
Public function Transpose: TRMatrix;
Public procedure Swap(ARow1, ARow2: longint);
Public class operator *(const ALeft: double; const ARight: TRMatrix): TRMatrix;
Public class operator *(const ALeft: TRMatrix; const ARight: double): TRMatrix;
Public class operator *(const ALeft, ARight: TRMatrix): TRMatrix;
Public class operator +(const ALeft, ARight: TRMatrix): TRMatrix;
Public class operator -(const ALeft, ARight: TRMatrix): TRMatrix;
Public class operator /(const ALeft: TRMatrix; const ARight: double): TRMatrix;
Public class operator <>(const ALeft, ARight: TRMatrix): boolean;
Public class operator =(const ALeft, ARight: TRMatrix): boolean;

Properties

Public property a[ARow,ACol: longint]: double read Get write Put; default;

Description

Methods

Public function IsNotNull: boolean;

Returns True if at least one element of the matrix is non-zero.

Public function IsNull: boolean;

Returns True if all elements of the matrix are zero.

Public function RowReduction: TRMatrix;

Returns the row-reduced echelon form of the matrix (Gauss elimination). The original matrix is not modified.

Public function Trace: double;

Returns the trace of the matrix, i.e. the sum of the diagonal elements: tr(A) = Σ A[i,i].

Public function Transpose: TRMatrix;

Returns the transpose of the matrix. Element [i,j] of the result equals element [j,i] of the original.

Public procedure Swap(ARow1, ARow2: longint);

Swaps rows ARow1 and ARow2 in place.

Public class operator *(const ALeft: double; const ARight: TRMatrix): TRMatrix;

Returns the product of a real scalar and a matrix. Each element is multiplied by ALeft.

Public class operator *(const ALeft: TRMatrix; const ARight: double): TRMatrix;

Returns the product of a matrix and a real scalar. Each element is multiplied by ARight.

Public class operator *(const ALeft, ARight: TRMatrix): TRMatrix;

Returns the matrix product of two matrices. (A·B)[i,j] = Σ_k A[i,k] · B[k,j]

Public class operator +(const ALeft, ARight: TRMatrix): TRMatrix;

Returns the element-wise sum of two matrices of the same size.

Public class operator -(const ALeft, ARight: TRMatrix): TRMatrix;

Returns the element-wise difference of two matrices of the same size.

Public class operator /(const ALeft: TRMatrix; const ARight: double): TRMatrix;

Returns the matrix divided by a real scalar. Each element is divided by ARight.

Public class operator <>(const ALeft, ARight: TRMatrix): boolean;

Returns True if the two matrices differ in at least one element.

Public class operator =(const ALeft, ARight: TRMatrix): boolean;

Returns True if all corresponding elements of the two matrices are equal.

Properties

Public property a[ARow,ACol: longint]: double read Get write Put; default;

Provides access to individual matrix elements using 1-based row and column indices. a[1,1] is the top-left element.


Generated by PasDoc 1.0.4.