The SDL Component Suite is an industry leading collection of components supporting scientific and engineering computing. Please visit the SDL Web site for more information....



Interface of SDL_Matrix

const
{$IFDEF PAIDVERS}
  SDLVersionInfo = 'matrix_r1050_full';
  IsLightEd = false;
{$ELSE}
  SDLVersionInfo = 'matrix_r1050_lighted';
  IsLightEd = true;
{$ENDIF}
  release = 1050;

type
  ESDLMatrixError = class(ESDLError);      { exception type to indicate errors }
  TMatXmlTag = (xmlMatNumCols, xmlMatNumRows, xmlMatNumLayers, xmlMatNumTimeSlots,
                xmlMatCell, xmlMatBegin, xmlMatEnd, xmlInvalid);
  TDistMode = (dmJaccard, dmManhattan, dmEuclid, dmEuclidSqr, dmDice, dmUserDef);
  TEdgeOp = (eopMin, eopMax, eopSum, eopMean);
  TOnCalcDistanceEvent = procedure (Sender: TObject; Row1, Row2: integer;
                                    var Distance: double) of object;
  TOnReadMat4DElementEvent = procedure (Sender: TObject; ix, iy, il, it: integer;
                                        Value: double) of object;
  TSpMatElemInt = record
                    colidx  : longint;
                    rowidx  : longint;
                    value   : longint;
                  end;
  TNormType = (ntColwise, ntRowwise, ntSpectral, ntFrobenius);

const
  DistModeId : array[TDistMode] of string =
                  ('Jaccard coefficient', 'Manhattan', 'Euclidean',
                   'squared Euclidean', 'Dice coefficient', 'user defined');

type
  TMat3D = class;
  TIntMatrix = class (TComponent)
            private
              FNCol           : longint;                   { number of columns }
              FNRow           : longint;                      { number of rows }
              FDataID         : string;             { tag to identify the data }
              FIsSparse       : boolean;                 { TRUE: sparse matrix }
              FNumAllocated   : longint; { number of allocated sparse elements }
              FAllocBy        : longint;   { incr. of alloc. for sparse matrix }
              FSparseNumElem  : longint; { number of elements in sparse matrix }
              FSparseLowCol   : longint;{ index of lowest column in sparse mat }
              FSparseHighCol  : longint;{index of highest column in sparse mat }
              FSparseLowRow   : longint;   { index of lowest row in sparse mat }
              FSparseHighRow  : longint;  { index of highest row in sparse mat }
              SpMat           : array of TSpMatElemInt;{ sparse matrix container }
              Mat             : array of array of integer;       { matrix data }
              FOnChange       : TNotifyEvent;
              FOnPercentDone  : TOnPercentDoneEvent;
              FOnSortExchange : TSortExchgEvent;
{$IFDEF PAIDVERS}
              FirstCell       : boolean;{flag to resize matrix during XML input }
              function  ProcessXmlTag (xmlTag: TMatXmlTag;
                            attr, cont: string): integer;
{$ENDIF}
              function  GetVal (Nc,Nr: longint): integer;
              procedure PercDone (Sender: TObject; Percent: longint);
              procedure SetVal (Nc,Nr: longint; Value: integer);
              procedure SetNCols (value: longint);
              procedure SetNRows (value: longint);
              procedure SkewKurtIntern (LowCol, LowRow, HighCol, HighRow: integer;
                              var Skewness, Kurtosis: double; var NumData: longint);
            protected
              procedure   SortExchange (ExchgWhat: byte; index1, index2,
                              first, last: longint);
            public
              constructor Create (AOwner: TComponent); override;
              constructor CreateSparse (AOwner: TComponent; AllocBy: longint);
              destructor  Destroy; override;
              property  Elem[ix,iy: longint]: integer
                            read GetVal write SetVal; default;
              function  Add (MatB: TIntMatrix): boolean;
              procedure ArrayToSparse (AllocBy: longint);
              procedure Changed;
              procedure Clone (MatSource: TIntMatrix);
{$IFNDEF DOTNET}
              function  CRCofData: string;
{$ENDIF}
              procedure CopyColToVec (DestVec: TIntVector;
                            Col, FirstRow, LastRow: integer);
              procedure CopyFrom (MatSource: TIntMatrix; SourceColLo,
                            SourceRowLo, SourceColHi, SourceRowHi,
                            DestCol, DestRow: integer);
              procedure CopyRowToVec (DestVec: TIntVector;
                            Row, FirstCol, LastCol: integer);
              function  CountValues (LowCol, HighCol, LowRow, HighRow: integer;
                            RangeLow, RangeHigh: integer): integer;
              function  CountMaskedZeros (LowCol, HighCol, LowRow, HighRow: integer;
                            Bitmask: longword): integer;
              procedure EdgeVector (Orient: TOrientation;
                            EdgeOp: TEdgeOp; var DestVec: TVector);
              function  EMult (MatB, MatRes: TIntMatrix): boolean;
              procedure ExchangeColumns (c1,c2: integer);
              procedure ExchangeRows (r1,r2: integer);
              procedure Fill (value: integer);
              procedure FillDiag (value: integer);
              procedure Find (LowCol, HighCol, LowRow, HighRow: integer;
                                Value: integer; var ColIx, RowIx: integer);
              function  FindInSortedColumn (Col: integer;
                            ColIsAscending: boolean; Value: integer): integer;
              function  GeometricMean (LowCol, LowRow, HighCol,
                            HighRow: integer): double;
              function  HarmonicMean (LowCol, LowRow, HighCol,
                            HighRow: integer): double;
{$IFNDEF DOTNET}
              procedure LoadBinary (FName: string);
{$ENDIF}
              function  LoadFromFile (FileName: string;
                            AdjustMatrixSize: boolean): boolean;
              function  LoadFromStream (InStream: TMemoryStream;
                            AdjustMatrixSize: boolean): boolean; overload;
              function  LoadFromStream (InStream: TFileStream;
                            AdjustMatrixSize: boolean): boolean; overload;
              function  LoadFromXMLFile (FName: string; DataID: string): boolean;
              function  LoadSparseMat (FileName:string): boolean;
              procedure MakeValidColRange (var LowCol, HighCol: integer);
              procedure MakeValidRowRange (var LowRow, HighRow: integer);
              procedure MeanVar (LowCol, LowRow, HighCol, HighRow: integer;
                            var Mean, Variance: double);
              procedure MeanVec (Dim: TDims; Means: TVector);
              procedure MinMax (LowCol, LowRow, HighCol, HighRow: integer;
                            var Minimum, Maximum: integer);
              procedure MirrorColumns;
              procedure MirrorRows;
              function  Multiply (MatB, MatRes: TIntMatrix): boolean; overload;
              function  Multiply (VecB, VecRes: TIntVector): boolean; overload;
              function  MultiplyTransposed (MatB, MatRes: TIntMatrix): boolean;
              function  Percentile (prob: double; LowCol, LowRow, HighCol,
                            HighRow: integer): double; overload;
              function  Percentile (prob: double; LowCol, LowRow, HighCol,
                            HighRow: integer; SampleSize: integer): double; overload;
              function  Quartiles (LowCol, LowRow, HighCol,
                            HighRow: integer; var Q1, Q2, Q3: double): boolean;
{$IFNDEF DOTNET}
              function  ReadBinaryHeader (FName: string; var NrColumns,
                            NrRows: integer; var DataID: string): boolean;
{$ENDIF}
              function  ReadFromOpenXMLFile (var InFile: TextFile;
                            DataID: string): boolean;
              function  ReadFromXMLStream (InStream: TStream;
                            DataID: string): boolean;
              function  Resize (Nc, Nr: longint): boolean;
              function  ResizeAndClear (Nc, Nr: longint): boolean;
              procedure SaveAsXMLFile (FName: string; DataID: string);
{$IFNDEF DOTNET}
              procedure SaveBinary (FName: string);
{$ENDIF}
              procedure SaveToStream (var OutStream: TMemoryStream;
                            LoC,LoR,HiC,HiR: integer); overload;
              procedure SaveToStream (var OutStream: TFileStream;
                            LoC,LoR,HiC,HiR: integer); overload;
              procedure SkewKurt (LowCol, LowRow, HighCol,
                            HighRow: integer; var Skewness, Kurtosis: double);
              procedure SkewKurtSample (LowCol, LowRow, HighCol, HighRow: integer;
                            var Skewness, Kurtosis: double);
              procedure SAdd (Scalar: integer);
              procedure SMult (Scalar: integer);
              procedure SortCols (SortRowIx: integer; Ascending: boolean;
                            LowCol, LowRow, HighCol, HighRow: integer);
              procedure SortRows (SortColIx: integer; Ascending: boolean;
                            LowCol, LowRow, HighCol,
                            HighRow: integer);
              procedure SparseToArray;
              function  StoreOnFile
                            (LoC,LoR,HiC,HiR: integer;
                            FileName:string): boolean;
              function  StoreSparseMat (FileName:string): boolean;
              function  Subtract (MatB: TIntMatrix): boolean;
              function  Sum (LoC,LoR,HiC,HiR: integer): longint;
              function  Trace: longint;
              function  Transpose: boolean;
              function  TransposeAndMultiply
                            (MatB, MatRes: TIntMatrix): boolean; overload;
              function  TransposeAndMultiply
                            (VecB, VecRes: TIntVector): boolean; overload;
              procedure WriteToOpenXMLFile (var OutFile : TextFile;
                            CreateHeader: boolean; DataID: string);
              procedure WriteToXMLStream (OutStream: TStream;
                            CreateHeader: boolean; DataID: string);
            published
              property  DataID: string read FDataID write FDataID;
              property  NrOfColumns: longint read FNCol write SetNCols;
              property  NrOfRows: longint read FNRow write SetNRows;
              property  OnChange: TNotifyEvent read FOnChange write FOnChange;
              property  OnSortExchange: TSortExchgEvent
                            read FOnSortExchange write FOnSortExchange;
              property  OnPercentDone: TOnPercentDoneEvent
                            read FOnPercentDone write FOnPercentDone;
            end;


  TMatrix = class (TComponent)
            private
              FNCol           : longint;                   { number of columns }
              FNRow           : longint;                      { number of rows }
              FDataID         : string;             { tag to identify the data }
              FPrecis         : array[1..2] of integer;  { used in StoreOnFile }
              FOnChange       : TNotifyEvent;
              FOnSortExchange : TSortExchgEvent;
              FOnCalcDist     : TOnCalcDistanceEvent;
              Mat             : TDouble2DArray;  // array of array of double;
{$IFDEF PAIDVERS}
              FirstCell       : boolean; {flag to resize matrix during XML input }
              function    ProcessXmlTag (xmlTag: TMatXmlTag;
                                         attr, cont: string): integer;
{$ENDIF}
              function    GetVal (Nc,Nr: longint): double; 
              procedure   SetVal (Nc,Nr: longint; Value: double); 
              function    GetFPrecis (ix: integer): integer;
              procedure   SetFPrecis (ix: integer; value: integer);
              procedure   SetNCols (value: longint);
              procedure   SetNRows (value: longint);
              procedure   SkewKurtIntern (LowCol, LowRow, HighCol, HighRow: integer;
                              var Skewness, Kurtosis: double; var NumData: longint);
            protected
              procedure   AssignTo (Dest: TPersistent); override;
              procedure   SortExchange (ExchgWhat: byte; index1, index2,
                                        first, last: longint);
            public
              constructor Create (AOwner: TComponent); override;
              destructor  Destroy; override;
              procedure Assign(Source: TPersistent); override;
              property  Elem[ix,iy: longint]: double
                            read GetVal write SetVal; default;
              function  Add (MatB: TMatrix): boolean;
              function  Balance: boolean;
              function  CalcDistMat (Mode: TDistMode; DMat: TMatrix): integer;
              procedure Changed;
              function  CholeskyDecomp (var MatL: TMatrix): boolean;

{$IFNDEF DOTNET}
              function  CRCofData: string;
{$ENDIF}
              procedure CopyColToVec (DestVec: TVector;
                            Col, FirstRow, LastRow: integer);
              procedure CopyFrom (MatSource: TMatrix;
                            SourceColLo, SourceRowLo,
                            SourceColHi, SourceRowHi,
                            DestCol, DestRow: integer); overload;
              procedure CopyFrom (MatSource: TIntMatrix;
                            SourceColLo, SourceRowLo,
                            SourceColHi, SourceRowHi,
                            DestCol, DestRow: integer); overload;
              procedure CopyFrom (MatSource: TMat3D;
                            SourceColLo, SourceRowLo,
                            SourceColHi, SourceRowHi,
                            SourceLayer,
                            DestCol, DestRow: integer); overload;
              function Correlate (OtherMat: TMatrix): double;
              procedure Clone (MatSource: TMatrix);
              procedure CopyFromVec (VecSource: TVector;
                            Source1stElem, SourceLastElem,
                            DestCol, DestRow: integer); overload;
              procedure CopyFromVec (Dim: TDims; VecSource: TVector;
                            Source1stElem, SourceLastElem,
                            DestCol, DestRow: integer); overload;
              procedure CopyRowToVec (DestVec: TVector;
                            Row, FirstCol, LastCol: integer);
              function  CountValues (LowCol, HighCol, LowRow, HighRow: integer;
                            RangeLow, RangeHigh: double): integer;
              function  Square (MatRes: TMatrix; Norm: double): boolean;
              function  Determinant: double;
              procedure Diff(Order: integer);
              function  DistanceOfObjects (Mode: TDistMode;
                            obj1, obj2: integer): double;
              function  EMult (MatB, MatRes: TMatrix): boolean;
              procedure EdgeVector (Orient: TOrientation;
                            EdgeOp: TEdgeOp; var DestVec: TVector);
              procedure ExchangeColumns (c1,c2: integer);
              procedure ExchangeRows (r1,r2: integer);
              procedure Fill (value: double);
              procedure FillDiag (value: double);
              procedure FillRandomUniform (RangeLow, RangeHigh: double);
              procedure FillRandomGauss (Mean, StdDev: double);
              procedure Find (LowCol, HighCol, LowRow, HighRow: integer;
                            Value: double; var ColIx, RowIx: integer);
              function  FindInSortedColumn (Col: integer;
                            ColIsAscending: boolean; Value: double): integer;
              procedure Free;
              function  GeometricMean (LowCol, LowRow, HighCol,
                            HighRow: integer): double;
              function  HarmonicMean (LowCol, LowRow, HighCol,
                            HighRow: integer): double;
              function  Histogram (LoX, LoY, HiX, HiY: longint;
                            FirstBin, LastBin, BinWidth: double;
                            Histo: TIntVector; var Underflow, Overflow,
                            MaxCnt: longint): boolean;
              function  Invert: boolean;
{$IFNDEF DOTNET}
              procedure LoadBinary (FName: string);
{$ENDIF}
              function  LoadFromFile (FileName: string;
                            AdjustMatrixSize: boolean): boolean; overload;
              function  LoadFromFile (FileName: string; AdjustMatrixSize,
                            AutoDetect: boolean): boolean; overload;
              function  LoadFromStream (InStream: TMemoryStream;
                            AdjustMatrixSize: boolean): boolean; overload;
              function  LoadFromStream (InStream: TFileStream;
                            AdjustMatrixSize: boolean): boolean; overload;
              function  LoadFromXMLFile (FName: string; DataID: string): boolean;
              function  LUdecomposition (var MatL, MatU: TMatrix): boolean;
              procedure MakeValidColRange (var LowCol, HighCol: integer);
              procedure MakeValidRowRange (var LowRow, HighRow: integer);
              procedure MeanCenterColumns (Means: TVector);
              procedure MeanCenterRows (Means: TVector);
              procedure MeanVar (LowCol, LowRow, HighCol,
                            HighRow: integer; var Mean,
                            Variance: double);
              procedure MeanVec (Dim: TDims; Means: TVector);
              procedure MinMax (LowCol, LowRow, HighCol,
                            HighRow: integer; var Minimum,
                            Maximum: double);
              procedure MirrorColumns;
              procedure MirrorRows;
              function  Multiply (MatB, MatRes: TMatrix): boolean; overload;
              function  Multiply (VecB, VecRes: TVector): boolean; overload;
              function  MultiplyTransposed (MatB, MatRes: TMatrix): boolean;
              function  Norm (nt: TNormType): double;
              function  Percentile (prob: double; LowCol, LowRow,
                            HighCol, HighRow: integer): double; overload;
              function  Percentile (prob: double; LowCol, LowRow, HighCol,
                            HighRow: integer; SampleSize: integer): double; overload;
              property  Precision [Index: integer]: integer
                            read GetFPrecis write SetFPrecis;
              procedure QNormalizeColumns (RefQuant: double;
                            Medians, QuantDiffs: TVector);
              procedure QNormalizeRows (RefQuant: double;
                            Medians, QuantDiffs: TVector);
              function  Quartiles (LowCol, LowRow, HighCol,
                            HighRow: integer; var Q1, Q2, Q3: double): boolean;
{$IFNDEF DOTNET}
              function  ReadBinaryHeader (FName: string; var NrColumns,
                            NrRows: integer; var DataID: string): boolean;
{$ENDIF}
              function  ReadFromXMLStream (InStream: TStream;
                            DataID: string): boolean;
              function  ReadFromOpenXMLFile (var InFile: TextFile;
                            DataID: string): boolean;
              function  Resize (Nc, Nr: longint): boolean;
              function  ResizeAndClear (Nc, Nr: longint): boolean;
              procedure SaveAsXMLFile (FName: string; DataID: string);
{$IFNDEF DOTNET}
              procedure SaveBinary (FName: string);
{$ENDIF}
              procedure SaveToStream (var OutStream: TMemoryStream;
                            LoC,LoR,HiC,HiR: integer); overload;
              procedure SaveToStream (var OutStream: TFileStream;
                            LoC,LoR,HiC,HiR: integer); overload;
              procedure SkewKurt (LowCol, LowRow, HighCol,
                            HighRow: integer; var Skewness, Kurtosis: double);
              procedure SkewKurtSample (LowCol, LowRow, HighCol,
                            HighRow: integer; var Skewness, Kurtosis: double);
              procedure SAdd (Scalar: double);
              procedure SMult (Scalar: double);
              procedure SortCols (SortRowIx: integer; Ascending: boolean;
                            LowCol, LowRow, HighCol, HighRow: integer);
              procedure SortRows (SortColIx: integer; Ascending: boolean;
                            LowCol, LowRow, HighCol,
                            HighRow: integer);
              procedure StandardizeColumns (Means, StdDevs: TVector);
              procedure StandardizeRows (Means, StdDevs: TVector);
              function  StoreOnFile
                            (LoC,LoR,HiC,HiR: integer;
                            FileName:string): boolean;
              function  Subtract (MatB: TMatrix): boolean;
              function  Sum (LoC,LoR,HiC,HiR: integer): double;
              function  Transpose: boolean;
              function  TransposeAndMultiply
                            (MatB, MatRes: TMatrix): boolean; overload;
              function  TransposeAndMultiply
                            (VecB: TVector; VecRes: TVector): boolean; overload;
              function  Trace: double;
              procedure WriteToOpenXMLFile(var OutFile : TextFile;
                            CreateHeader: boolean; DataID: string);
              procedure WriteToXMLStream (OutStream: TStream;
                            CreateHeader: boolean; DataID: string);
            published
              property  NrOfColumns: longint read FNCol write SetNCols;
              property  NrOfRows: longint read FNRow write SetNRows;
              property  DataID: string read FDataID write FDataID;
              property  OnChange: TNotifyEvent read FOnChange write FOnChange;
              property  OnSortExchange: TSortExchgEvent
                            read FOnSortExchange write FOnSortExchange;
              property  OnCalcDistance: TOnCalcDistanceEvent
                            read FOnCalcDist write FOnCalcDist;
            end;


   TMat3D = class (TComponent)
            private
              FNumX     : longint;                         { number of columns }
              FNumY     : longint;                            { number of rows }
              FNumZ     : longint;                          { number of layers }
              FDataID   : string;                   { tag to identify the data }
              Mat       : array of array of array of double;
              FOnChange : TNotifyEvent;
{$IFDEF PAIDVERS}
              FirstCell : boolean;{flag to resize matrix during input from XML }
              function    ProcessXmlTag (xmlTag: TMatXmlTag; attr,
                              cont: string): integer;
{$ENDIF}
              function    GetVal (Nx,Ny,Nz: longint): double;
              procedure   SetVal (Nx,Ny,Nz: longint; Value: double);
              procedure   SetNCols (value: longint);
              procedure   SetNRows (value: longint);
              procedure   SetNLayers (value: longint);
            public
              constructor Create (AOwner: TComponent); override;
              destructor  Destroy; override;
              procedure Changed;
              procedure Clone (MatSource: TMat3D);
              procedure CopyLayerToMatrix (DestMat: TMatrix; LowCol, HighCol,
                           LowRow, HighRow, Layer: integer);
              procedure CopyMatrixToLayer (SrcMat: TMatrix; SrcLowCol, SrcHighCol,
                           SrcLowRow, SrcHighRow, Layer,
                           LayLowCol, LayLowRow: integer);
{$IFNDEF DOTNET}
              function  CRCofData: string;
{$ENDIF}
              property  Elem[ix,iy,iz: longint]: double
                            read GetVal write SetVal; default;
              procedure Fill (value: double);
              procedure FillDiag (value: double);
              procedure FillRandomUniform (RangeLow, RangeHigh: double);
              procedure FillRandomGauss (Mean, StdDev: double);
              procedure Find (LowCol, HighCol, LowRow, HighRow, LowLayer,
                            HighLayer: integer; Value: double;
                            var ColIx, RowIx, LayerIx: integer);
              function  LoadFromXMLFile (FName: string; DataID: string): boolean;
              procedure MakeValidColRange (var LowCol, HighCol: integer);
              procedure MakeValidRowRange (var LowRow, HighRow: integer);
              procedure MakeValidLayerRange (var LowLayer, HighLayer: integer);
              procedure MinMax (LowCol, HighCol, LowRow, HighRow, LowLayer,
                            HighLayer: integer; var Minimum, Maximum: double);
              function  Percentile (prob: double; LowCol, HighCol,
                            LowRow, HighRow,
                            LowLayer, HighLayer: integer): double; overload;
              function  Percentile (prob: double; LowCol, HighCol, LowRow,
                            HighRow, LowLayer, HighLayer: integer;
                            SampleSize: integer): double; overload;
              function  ReadFromOpenXMLFile (var InFile: TextFile;
                            DataID: string): boolean;
              function  ReadFromXMLStream (InStream: TStream;
                            DataID: string): boolean;
              function  Resize (Nc, Nr, Nl: longint): boolean;
              function  ResizeAndClear (Nc, Nr, Nl: longint): boolean;
              procedure SaveAsXMLFile (FName: string; DataID: string);
              procedure WriteToOpenXMLFile (var OutFile : TextFile;
                            CreateHeader: boolean; DataID: string);
              procedure WriteToXMLStream (OutStream: TStream;
                            CreateHeader: boolean; DataID: string);
            published
              property  DataID: string read FDataID write FDataID;
              property  NrOfColumns: longint read FNumX write SetNCols;
              property  NrOfRows: longint read FNumY write SetNRows;
              property  NrOfLayers: longint read FNumZ write SetNLayers;
              property  OnChange: TNotifyEvent read FOnChange write FOnChange;
            end;


{$IFNDEF DOTNET}
   TMat4D = class (TComponent)
            private
              FNumX             : longint;                 { number of columns }
              FNumY             : longint;                    { number of rows }
              FNumZ             : longint;                  { number of layers }
              FNumT             : longint;              { number of time slots }
              FDataID           : string;           { tag to identify the data }
              Mat               : array of array of array of array of double;
              FOnChange         : TNotifyEvent;
              FOnPercentDone    : TOnPercentDoneEvent;
              FOnReadElement    : TOnReadMat4DElementEvent;
{$IFDEF PAIDVERS}
              FirstCell : boolean;{flag to resize matrix during input from XML }
              function    ProcessXmlTag (xmlTag: TMatXmlTag; attr,
                              cont: string): integer;
{$ENDIF}
              function  GetVal (Nx,Ny,Nz,Nt: longint): double;
              procedure SetVal (Nx,Ny,Nz,Nt: longint; Value: double);
              procedure SetNCols (value: longint);
              procedure SetNRows (value: longint);
              procedure SetNLayers (value: longint);
              procedure SetNTSlots (value: longint);
              procedure PercDone (Sender: TObject; Percent: longint);
              procedure ReadElement (Sender: TObject; ix, iy, il, it: integer;
                           Value: double);
            protected
              procedure AssignTo (Dest: TPersistent); override;
            public
              procedure AppendToBinaryFile (FName: string; TSlotStart,
                                            TSlotEnd: integer);
              procedure Assign(Source: TPersistent); override;
              constructor Create (AOwner: TComponent); override;
              destructor  Destroy; override;
              procedure Changed;
              procedure Clone (MatSource: TMat4D);
              function  ConvertLinTo3DAddr (LinAddr: integer;
                           var ix, iy, il: integer): boolean;
              procedure Copy1DArrayToPixel (Src: TDoubleArray; Col, Row,
                           FirstLayer, TimeSlot: integer);
              procedure CopyTimeSlotToMat3D (DestMat: TMat3D; LowCol, HighCol,
                           LowRow, HighRow, LowLay, HighLay, TimeSlot: integer);
              procedure CopyMat3DToTimeSlot (SrcMat: TMat3D; SrcLowCol, SrcHighCol,
                           SrcLowRow, SrcHighRow, SrcLowLay, SrcHighLay, TimeSlot,
                           DestCol, DestRow, DestLayer: integer);
              procedure CopyFrom (MatSource: TMat4D;
                           SrcLowCol, SrcHighCol, SrcLowRow, SrcHighRow,
                           SrcLowLayer, SrcHighLayer, SrcLowTSlot,
                           SrcHighTSlot, DestCol, DestRow,
                           DestLayer, DestTSlot: integer);
              procedure CopyLayerToMatrix (DestMat: TMatrix; LowCol, HighCol,
                           LowRow, HighRow, Layer, TimeSlot: integer);
              procedure CopyMatrixToLayer (SrcMat: TMatrix; SrcLowCol, SrcHighCol,
                           SrcLowRow, SrcHighRow, Layer, TimeSlot,
                           LayLowCol, LayLowRow: integer);
              function  CountValues (LowCol, HighCol, LowRow, HighRow,
                           LowLayer, HighLayer, LowTimeslot, HighTimeslot: integer;
                           RangeLow, RangeHigh: double): integer;
              function  CRCofData: string;
              procedure Cut (LowCol, HighCol, LowRow, HighRow, LowLayer, HighLayer,
                           LowTimeslot, HighTimeslot: integer);
              procedure Resample (XDiv, XOffset, YDiv, YOffset, ZDiv, ZOffset,
                           TDiv, TOffset: integer; Average: boolean);
              property  Elem[ix,iy,iz,it: longint]: double
                           read GetVal write SetVal; default;
              procedure Fill (value: double);
              procedure FillDiag (value: double);
              procedure FillLayer (Layer: integer; value: double);
              procedure FillRandomUniform (RangeLow, RangeHigh: double);
              procedure FillRandomGauss (Mean, StdDev: double);
              procedure Find (LowCol, HighCol, LowRow, HighRow, LowLayer,
                            HighLayer, LowTimeSlot, HighTimeSlot: integer;
                            Value: double;
                            var ColIx, RowIx, LayerIx, TimeSlotIx: integer);
              function  Lin3DAddr (ix, iy, il: integer): integer;
              procedure LoadBinary (FName: string; TSlotStart, TSlotEnd: integer);
              function  LoadFromXMLFile (FName: string; DataID: string): boolean;
              procedure MakeValidColRange (var LowCol, HighCol: integer);
              procedure MakeValidRowRange (var LowRow, HighRow: integer);
              procedure MakeValidLayerRange (var LowLayer, HighLayer: integer);
              procedure MakeValidTSlotRange (var LowTSlot, HighTSlot: integer);
              procedure MaximumOfLayersToMatrix (DestMat: TMatrix; LowCol, HighCol,
                            LowRow, HighRow, LowLayer, HighLayer, LowTimeSlot,
                            HighTimeSlot: integer);
              procedure MeanOfLayersToMatrix (DestMat: TMatrix; LowCol, HighCol,
                            LowRow, HighRow, LowLayer, HighLayer, LowTimeSlot,
                            HighTimeSlot: integer);
              function  MemoryConsumed: double;
              procedure MinimumOfLayersToMatrix (DestMat: TMatrix; LowCol, HighCol,
                            LowRow, HighRow, LowLayer, HighLayer, LowTimeSlot,
                            HighTimeSlot: integer);
              procedure MinMax (LowCol, HighCol, LowRow, HighRow,
                            LowLayer, HighLayer, LowTimeSlot, HighTimeSlot: integer;
                            var Minimum, Maximum: double);
              procedure MeanVar (LowCol, HighCol, LowRow, HighRow,
                            LowLayer, HighLayer, LowTimeSlot, HighTimeSlot: integer;
                            var Mean, Variance: double);
              procedure MirrorColumns;
              procedure MirrorRows;
              procedure MirrorLayers;
              procedure MirrorTimeSlots;
              function  Percentile (prob: double; LowCol, HighCol, LowRow,
                            HighRow, LowLayer, HighLayer, LowTimeSlot,
                            HighTimeSlot: integer): double; overload;
              function  Percentile (prob: double; LowCol, HighCol, LowRow,
                            HighRow, LowLayer, HighLayer, LowTimeSlot,
                            HighTimeSlot: integer;
                            SampleSize: integer): double; overload;
              procedure ReadBinary (FName: string; TSlotStart, TSlotEnd: integer);
              function  ReadBinaryHeader (FName: string;
                            var NrColumns, NrRows, NrLayers, NrTimeSlots: integer;
                            var DataID: string): boolean;
              function  ReadFromOpenXMLFile (var InFile: TextFile;
                            DataID: string): boolean;
              procedure ReadLayer (FName: string; Layer, TSlot: integer); overload;
              procedure ReadLayer (FName: string; Layer, TSlot: integer;
                            var Data: TDouble2DArray); overload;
              function  Resize (Nc, Nr, Nl, Nt: longint): boolean;
              function  ResizeAndClear (Nc, Nr, Nl, Nt: longint): boolean;
              procedure SaveBinary (FName: string; TSlotStart, TSlotEnd: integer);
              procedure SaveAsXMLFile (FName: string; DataID: string);
              procedure StdDevOfLayersToMatrix (DestMat: TMatrix; LowCol, HighCol,
                           LowRow, HighRow, LowLayer, HighLayer, LowTimeSlot,
                           HighTimeSlot: integer);
              function  Sum (LowCol, HighCol, LowRow, HighRow, LowLayer,
                           HighLayer, LowTimeSlot, HighTimeSlot: integer): double;
              function  SquaredSum (LowCol, HighCol, LowRow, HighRow, LowLayer,
                           HighLayer, LowTimeSlot, HighTimeSlot: integer): double;
              function  Transpose: boolean;
              procedure WriteToOpenXMLFile (var OutFile : TextFile;
                            CreateHeader: boolean; DataID: string);
            published
              property  DataID: string read FDataID write FDataID;
              property  NrOfColumns: longint read FNumX write SetNCols;
              property  NrOfRows: longint read FNumY write SetNRows;
              property  NrOfLayers: longint read FNumZ write SetNLayers;
              property  NrOfTimeSlots: longint read FNumT write SetNTSlots;
              property  OnChange: TNotifyEvent read FOnChange write FOnChange;
              property  OnPercentDone: TOnPercentDoneEvent
                            read FOnPercentDone write FOnPercentDone;
              property  OnReadElement: TOnReadMat4DElementEvent
                            read FOnReadElement write FOnReadElement;
            end;
{$ENDIF}




Last Update: 2012-Oct-20