PasMatLib

 User guide

by Nikolai Shokhirev

PasMatLib Tutorial

Contents

 Recommended directory structure

+-[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 }
    | 

Search Path

Project Options Directories/Conditionals and set the Search path to $(DELPHI)\Projects\PasMatLib and the other necessary directories (see Delphi Help for details).

Array Objects

Object naming

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

Specific properties

Common methods

Specific methods

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.

Declaration and Creation of Objects

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);

 

Download

The Object Algebra units are available in Download section

 

PasMatLib Tutorial


Scientific Programming | PasMatLib Tutorial | Description | Download

Rule

Home  |   Shokhirev.com |  Sample code  |   Programming  |    Resume
[Mailbox]

Please e-mail me at nikolai@shokhirev.com

©Nikolai Shokhirev, 2002-2009

 

/html>