Roger Dunn

Send e-mail to this Author

Professional set of Delphi and C++Builder components for virtual instrumentation

  • Meters, Bars (Gauge), with linear or log(10) scaling
  • Digital indicators (time, value)
  • Operating Point display
  • Dial (knob), Sliders, Trend/Recorder
  • buttons, switches, LED indicators
  • DB-Aware components and many more
Author Products

Total 1 product

Staircase Matrix

Code Samples > Samples > Science

By Roger Dunn.

Freeware + source 31 Mar 2005

Description

A Staircase Matrix is useful when you want a matrix of objects where the value of cell (A, B) is guaranteed to be the same as the value of cell (B, A), and where referencing cell (A, A) or cell (B, B) is meaningless.

Staircase Matrices are useful when implementing fully- or partially-connected uni-directed graphs (or networks). If A and B are indexes in your own single-dimension array of nodes, cell (A, B) in the staircase matrix represents the weight or cost of the edge between nodes A & B.

This implementation of the Staircase Matrix is guaranteed to save space over a traditional matrix of size N x N. The underlying single-dimension array is length N(N-1)/2 (e.g. normally a 10x10 matrix fitting the staircase matrix paradigm would be 100 cells big. Using TStaircaseMatrix, the underlying array is only 45 cells big.) Accessing cells is almost as quick as if you were accessing an N x N matrix.

StaircaseMatrix.pas includes implementations for TStaircaseMatrixOfObjects, TStaircaseMatrixOfIntegers, TStaircaseMatrixOfStrings, TStaircaseMatrixOfVariants, and TStaircaseMatrixOfDoubles. More instructions on using these objects is included in a comments section at the top of the unit.

Informations

  • Status: Fully functional
  • Source: Included
  • Size: 3kB

Platforms: D7