Record TCMatrix

Unit

Declaration

type generic TCMatrix<TSpace> = record

Description

Generic square matrix of complex values (TComplex) with dimension TSpace.N × TSpace.N.

Extends the functionality of TRMatrix to the complex domain. Supports implicit conversion from a real matrix. Use the default array property a[row, col] to read and write individual elements. Concrete types are provided as TC2Matrix, TC3Matrix, and TC4Matrix.

Overview

Nested Types

Public TRMatrix = specialize TRMatrix<TSpace>;

Methods

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

Properties

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

Description

Nested Types

Public TRMatrix = specialize TRMatrix<TSpace>;

This item has no 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: TCMatrix;

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

Public function Trace: TComplex;

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

Public function Transpose: TCMatrix;

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, ARight: TCMatrix): TCMatrix;

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

Public class operator *(const ALeft: TCMatrix; const ARight: TComplex): TCMatrix;

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

Public class operator *(const ALeft: TComplex; const ARight: TCMatrix): TCMatrix;

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

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

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

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

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

Public class operator /(const ALeft: TCMatrix; const ARight: TComplex): TCMatrix;

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

Public class operator :=(const AMatrix: TRMatrix): TCMatrix;

Implicit conversion from a real matrix to a complex matrix. Each element a[i,j] is converted to TComplex(Re=a[i,j], Im=0).

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

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

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

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

Properties

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

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


Generated by PasDoc 1.0.4.