Up \ObjAlg
{ @abstract(simple containers for compound objects)
author: Nikolai Shokhirev )
created: February 02, 2002)
last modified: June 06, 2003)
ŠNikolai V. Shokhirev, 2002-2003
}
unit uCompoundArrays;
interface
uses
uMatTypes, uArrays, uComplexType;
type
{<pre> Interface for Eigensystem: <br>
EigenVectors = Array [Lo1..Hi1, Lo2..Hi2] of TFloat <br>
Eigenvalues = Array [Lo2..Hi2] of TFloat<br>
Component names = Array [Lo1..Hi1] of String </pre>}
IEigen = interface
['{05495067-1C53-11D7-82A2-00C04F2859BF}']
property Dim1: TInt read GetDim1;
property Dim2: TInt read GetDim2;
property Names: INames read GetNames write SetNames;
property EigenValues: IVector read GetEigenValues write SetEigenValues;
property EigenVectors: IMatrix read GetEigenVectors write SetEigenVectors;
end;
{<pre> Interface for Dynamic Complex 1D Array:<br>
CVector = ReVector + i*ImVector </pre>}
ICVector = interface
['{859A5E10-1C53-11D7-82A2-00C04F2859BF}']
procedure Conjugate;
property Dim: TInt read GetDim;
property Re: IVector read GetRe write SetRe;
property Im: IVector read GetIm write SetIm;
property Value[i: TInt]: Complex read GetValue write SetValue; default;
end;
{<pre> Interface for Dynamic Complex 2D Array:<br>
CMatrix = ReMatrix + i*ImMatrix </pre>}
ICMatrix = interface
['{859A5E11-1C53-11D7-82A2-00C04F2859BF}']
procedure Conjugate;
procedure Transpose;
procedure HConjugate;
property Dim1: TInt read GetDim1;
property Dim2: TInt read GetDim2;
property Re: IMatrix read GetRe write SetRe;
property Im: IMatrix read GetIm write SetIm;
end;
{<pre> Interface for Complex Eigensystem: <br>
CEigensystem = ReEigensystem + i*Eigensystem </pre>}
ICEigen = interface
['{859A5E12-1C53-11D7-82A2-00C04F2859BF}']
procedure Conjugate;
property Dim1: TInt read GetDim1;
property Dim2: TInt read GetDim2;
property Re: IEigen read GetRe write SetRe;
property Im: IEigen read GetIm write SetIm;
end;
{ Interfaces for arrays with file support - - - - - - - - - - - - - - - - - - }
{<pre> Interface for Eigensystem with file support </pre>}
IEigenSystem = interface(IEigen)
['{0549506D-1C53-11D7-82A2-00C04F2859BF}']
procedure ReadFromFile(aFileName: string);
procedure WriteToFile(aFileName: string);
property Comment: string read GetComment write SetComment;
end;
{ Interface for Dynamic Complex 1D Array with file support }
ICArray1D = interface(ICVector)
['{859A5E13-1C53-11D7-82A2-00C04F2859BF}']
procedure ReadFromFile(aFileName: string);
procedure WriteToFile(aFileName: string);
property Comment: string read GetComment write SetComment;
end;
{ Interface for Dynamic Complex 2D Array with file support }
ICArray2D = interface(ICMatrix)
['{859A5E14-1C53-11D7-82A2-00C04F2859BF}']
procedure ReadFromFile(aFileName: string);
procedure WriteToFile(aFileName: string);
property Comment: string read GetComment write SetComment;
end;
{ Interface for Complex Eigensystem with file support }
ICEigenSystem = interface(ICEigen)
['{859A5E15-1C53-11D7-82A2-00C04F2859BF}']
procedure ReadFromFile(aFileName: string);
procedure WriteToFile(aFileName: string);
property Comment: string read GetComment write SetComment;
end;
{ Objects - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - }
{ Eigensystem: implements IEigensystem }
TEigen = class(TInterfacedObject, IEigen)
public
constructor Create; overload;
constructor Create(aDim1, aDim2: TInt); overload;
destructor Destroy; override;
property Dim1: TInt read GetDim1;
property Dim2: TInt read GetDim2;
property Names: INames read GetNames write SetNames;
property EigenValues: IVector read GetEigenValues write SetEigenValues;
property EigenVectors: IMatrix read GetEigenVectors write SetEigenVectors;
end;
{ Dynamic Complex 1D Array: <br>
CVector = ReVector + i*ImVector }
TCVector = class(TInterfacedObject, ICVector)
public
constructor Create; overload;
constructor Create(aDim1: TInt); overload;
Destructor Destroy; override;
procedure Conjugate;
property Dim: TInt read GetDim;
property Im: IVector read GetIm write SetIm;
property Re: IVector read GetRe write SetRe;
property Value[i: TInt]: Complex read GetValue write SetValue; default;
end;
{ Dynamic Complex 2D Array: <br>
CMatrix = ReMatrix + i*ImMatrix }
TCMatrix = class(TInterfacedObject, ICMatrix)
public
constructor Create; overload;
constructor Create(aDim1, aDim2: TInt); overload;
destructor Destroy; override;
procedure Conjugate;
procedure Transpose;
procedure HConjugate;
property Dim1: TInt read GetDim1;
property Dim2: TInt read GetDim2;
property Re: IMatrix read GetRe write SetRe;
property Im: IMatrix read GetIm write SetIm;
property Value[i1,i2: TInt]: Complex read GetValue write SetValue; default;
end;
{ Complex Eigensystem: implements ICEigenSystem }
TCEigen = class(TInterfacedObject, ICEigen)
public
constructor Create; overload;
constructor Create(aDim1, aDim2: TInt); overload;
destructor Destroy; override;
procedure Conjugate;
property Dim1: TInt read GetDim1;
property Dim2: TInt read GetDim2;
property Re: IEigen read GetRe write SetRe;
property Im: IEigen read GetIm write SetIm;
end;
{ Objects with file support - - - - - - - - - - - - - - - - - - - - - - - - - }
{ Eigensystem with file support }
TEigenSystem = class(TEigen, IEigenSystem)
private
public
constructor Create; overload;
constructor Create( aDim1,aDim2: TInt); overload;
constructor Create(aFileName: string); overload;
destructor Destroy; override;
procedure ReadFromFile(aFileName: string);
procedure WriteToFile(aFileName: string);
property Comment: string read GetComment write SetComment;
end;
{ Dynamic Complex 1D Array with file support }
TCArray1D = class(TCVector, ICArray1D)
public
constructor Create; overload;
constructor Create( aDim1: TInt); overload;
constructor Create(aFileName: string); overload;
destructor Destroy; override;
procedure ReadFromFile(aFileName: string);
procedure WriteToFile(aFileName: string);
property Comment: string read GetComment write SetComment;
end;
{ Dynamic Complex 2D Array with file support }
TCArray2D = class(TCMatrix, ICArray2D)
public
constructor Create; overload;
constructor Create( aDim1,aDim2: TInt); overload;
constructor Create(aFileName: string); overload;
destructor Destroy; override;
procedure ReadFromFile(aFileName: string);
procedure WriteToFile(aFileName: string);
property Comment: string read GetComment write SetComment;
end;
{ Complex Eigensystem with file support }
TCEigenSystem = class(TCEigen, ICEigenSystem)
public
constructor Create; overload;
constructor Create( aDim1,aDim2: TInt); overload;
constructor Create(aFileName: string); overload;
destructor Destroy; override;
procedure ReadFromFile(aFileName: string);
procedure WriteToFile(aFileName: string);
property Comment: string read GetComment write SetComment;
class procedure ReadCEigenSystem(var aFile : TextFile; const CES: ICEigenSystem);
class procedure WriteCEigenSystem(var aFile : TextFile; const CES: ICEigenSystem);
end;
implementation
end.
Up \ObjAlg