by Nikolai Shokhirev
+-[Projects]
|
+-[DUnit] { http://dunit.sourceforge.net/ or http://sourceforge.net/projects/dunit/ }
|
+-[PasMatLib]
|
+-[Convert] { Conversion utility : ObjMath -> PasMatLib }
+-[Data] { Data Objects }
+-[Display] { Display routines for Object algebra and Numerical methods }
+-[NumMethods] { Integration, ODE }
+-[Optimization] { Optimization routines }
+-[Signal] { Signal processing }
+-[SpecFunc] { Special functions and pseudo-random numbers }
+-[Utils] { Common utilities }
|
+-[UnitTests]
| |
| +-[DataTests] { DUnit tests }
| +-[DFTTests] { DUnit tests }
| +-[DynArrTests] { DUnit tests }
| +-[DynLinAlgTests] { DUnit tests }
| +-[FunStrTests] { DUnit tests }
| +-[NumMethTests] { DUnit tests }
| +-[SignalTests] { DUnit tests }
| +-[SpecFuncTest] { DUnit tests }
| +-[TestOptim] { DUnit tests }
|
+-[Tests]
| |
| +-[Examples] { Demo }
| +-[TestData2D] { Demo }
| +-[TestDisplay] { Demo }
| +-[TestFourier] { Fourier tests/demos }
| +-[TestGraph2D] { Demo }
| +-[TestGrid2D] { Demo }
| +-[TestIsoline] { Demo }
| +-[TestRand] { Random numbers demo }
| +-[TestSurface] { Demo }
|
Project
Options
Directories/Conditionals and set the Search path to $(DELPHI)\Projects\PasMatLib
and the other necessary directories (see Delphi Help for details).
All interfaces and are named as follows: IXArrND, where
The corresponding classes that implement the above interfaces are named as TXArrND.
For 2D arrays (matrices) M[i, j]: i-th row, j-th column
Common properties
Comment: string read/write - Object name, discription, comment Lo1: TInt read/write - Low index limit in dimension 1 Hi1: TInt read - High index limit in dimension 1 Dim1: TInt read - Number of elements: Dim1 = Hi1 - Lo1 + 1Value[i1]: X read/write - Lo1 <= i1 <= Hi1, X = string/boolean/TInt/TFloat/Complex.
Self.Value[i1] = Self[i1]. Lo2: TInt read/write - Low index limit in dimension 2 Hi2: TInt read - High index limit in dimension 2 Dim2: TInt read - Number of elements: Dim2 = Hi2 - Lo2 + 1Value[i1, i2]: X read/write - Lo1 <= i1 <= Hi1,
Lo2 <= i2 <= Hi2, X = string/boolean/TInt/TFloat/Complex Lo3: TInt read/write - Low index limit in dimension 3 Hi3: TInt read - High index limit in dimension 3 Dim3: TInt read - Number of elements: Dim3 = Hi3 - Lo3 + 1Value[i1, i2, i3]: string/boolean/TInt/TFloat/Complex read/writeISArr1D.CommaText: string read/write -
Comma-separated array contentsCommon methods
procedure Fill(C: string/boolean/TInt/TFloat/Complex) - Fills
an array with the value C.procedure Assign(const A: IBArr1D) - Copies the
contents of A if the limits are the sameprocedure Swap(i, j: TInt) - Swaps the i-th and j-th elements in a 1D arrayprocedure Swap(i, j: TInt; st: TSliceType) - Swaps the i-th and j-th elements in a 2D arrayst = _Row: swaps Value[i,k] and Value[j,k], Lo2 <= k<= Hi2st = _Col: swaps Value[k,i] and Value[k,j], Lo1 <= k<= Hi1Specific methods
procedure IFArr1D.Times(C: TFloat): Self := C*Self.function IFArr1D.Norm2(): TFloat - (L2 norm)**2:
V.Norm2 = |
![]() |
function IFArr1D.Norm(Normalize: boolean = false): TFloat - L2 norm.
if Normalize then Self := Self/Norm procedure IFArr1D.Times(C: TFloat): Self := C*Self.function IFArr1D.MaxAbs: TFloat - max(|Self[i]).function IFArr1D.Dot(const A: IFArr1D): TFloat - dot (scalar)
product of Self and A.function IFArr2D.GetSlice(i1, i2: TInt): IFArr1DV := M.GetSlice(_, i2) : V[k] = M[k,i2] ( _ = MaxInt - open index)V := M.GetSlice(i1, _) : V[k] = M[i1,k]function IFArr2D.SetSlice(i1, i2: TInt; const aValue: IFArr1D);M.SetSlice(_, i2, V) : M[k,i2] := V[k] ( _ = MaxInt - open index)M.SetSlice(i1, _, V) : M[i1,k] := V[k] In order to take advantage of reference counting and automatic garbage collection, all objects should be declared as interfaces. Note that the objects have two overloaded constructors: for the default (one-based ) and arbitrary indexing.
In order to take advantage of reference counting and automatic garbage collection, all objects should be declared as interfaces. Note that the objects have two overloaded constructors: for the default (one-based ) and arbitrary indexing. The third constructor has the following form:
Create(A: IXArrND; CopyData: boolean = false);
It creates an array with the same limits as A. If CopyData = true then the contents of A is copied to the created object.
Example
procedure X; var v1: IIArr1D; v2: IFArr1D; m1, m2: IFArr2D; m3: IFArr3D; N, L, D, R: TInt; // integer x: TFloat; // double begin . . . v1 := TIArr1D.Create(D); // [1..D] 1-based integer vector v2 := TFArr1D.Create(-L,L); // [-L..L] float vector m1 := TFArr2D.Create(N,d); // [1..N,1..D] N x D float matrix (1-based) m2 := TFArr2D.Create(0,N-1,-L,L); // [0..N-1,-L..L] N x (2*L+1) float matrix m3 := TFArr3D.Create(N,D,R); // [1..N,1..D,1..R] N x D x R float 3D matrix . . . m4 := TFArr2D.Create(m2, true); // [0..N-1,-L..L] float matrix: m4[i,j] = m2[i,j] . . . x := m2[0,L]; m3[1,2,3] := x; . . . end;
TFArr1D has an additional constructor
Create(aLo1, aHi1: TInt; var A: TFArr);
The Object Algebra units are available in Download section
|
|
Please e-mail me at nikolai@shokhirev.com |
©Nikolai Shokhirev, 2002-2009