Roger Dunn

Send e-mail to this Author

Create feature-rich windows applications with many new components and universal dialogs.

  • improved DBGrid
  • new DBRecordView, DBTreeView
  • toolbars and db dialogs to Find, Filter, Sort, Export, Print...
  • StringGrid with columns definition
  • GroupBox with automatic alignment and resizing of owned controls

And many more from $25 to $95 only - click for details!

Author Products

Total 1 product

Staircase Matrix

Code Samples > Samples > Science

By Roger Dunn.

Freeware + source 31 Mar 2005


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.


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

Platforms: D7