Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages   Examples  

CTBmatrix Class Template Reference

Indexable matrix container. **. More...

#include "CTBmatrix.hxx"

Collaboration diagram for CTBmatrix:

Collaboration graph
[legend]
List of all members.

Public Types

typedef T Elem_t

Public Methods

 CTBmatrix ()
 CTBmatrix (CTBint i_nrow, CTBint i_ncol)
 CTBmatrix (CTBint i_nrow, CTBint i_ncol, const T &def)
 CTBmatrix (CTBint i_nrow, CTBint i_ncol, const T &def, const T &defdiag)
 CTBmatrix (const CTBmatrix< T > &rhs)
 CTBmatrix (CTBmatrix< T > &rhs, bool b_grab)
virtual ~CTBmatrix ()
CTBint NRow () const
CTBint NColumn () const
CTBint Size () const
CTBint Capacity () const
CTBvectorDsc< TRow (CTBint i_row)
CTBvectorCDsc< TRow (CTBint i_row) const
CTBvectorDsc< TColumn (CTBint i_col)
CTBvectorCDsc< TColumn (CTBint i_col) const
CTBvectorDsc< TDiagonal ()
CTBvectorCDsc< TDiagonal () const
CTBvectorDsc< TDiagonal (CTBint i_dia)
CTBvectorCDsc< TDiagonal (CTBint i_dia) const
CTBmatrixDsc< TTranspose ()
CTBmatrixCDsc< TTranspose () const
void SwapRow (CTBint i_r1, CTBint i_r2)
void SwapColumn (CTBint i_c1, CTBint i_c2)
TAt (CTBint i_row, CTBint i_col)
const TAt (CTBint i_row, CTBint i_col) const
void Resize (CTBint i_nrow, CTBint i_ncol)
void Resize (CTBint i_nrow, CTBint i_ncol, const T &def)
void EnsureCapacity (CTBint i_cap)
void IncreaseCapacity (CTBint i_cap)
void TrimCapacity ()
void Grab (CTBmatrix< T > &rhs)
const TData () const
CTBint StrideRow () const
CTBint StrideColumn () const
void Dump (int i_indent=0, ostream &os=cout, const char *p_text=0) const
CTBvectorDsc< Toperator[] (CTBint i_row)
CTBvectorCDsc< Toperator[] (CTBint i_row) const
Toperator() (CTBint i_row, CTBint i_col)
const Toperator() (CTBint i_row, CTBint i_col) const
CTBvectorDsc< Toperator() (CTBint i_row, const CTBrange &rcol)
CTBvectorCDsc< Toperator() (CTBint i_row, const CTBrange &rcol) const
CTBvectorDsc< Toperator() (const CTBrange &rrow, CTBint i_col)
CTBvectorCDsc< Toperator() (const CTBrange &rrow, CTBint i_col) const
CTBmatrixDsc< Toperator() (const CTBrange &rrow, const CTBrange &rcol)
CTBmatrixCDsc< Toperator() (const CTBrange &rrow, const CTBrange &rcol) const
bool operator! () const
 operator T * ()
 operator const T * () const
 operator CTBmatrixDsc ()
 operator CTBmatrixCDsc () const
CTBmatrix< T > & operator= (const T &rhs)
CTBmatrix< T > & operator= (const CTBmatrix< T > &rhs)
CTBmatrix< T > & operator= (const CTBmatrixCDsc< T > &rhs)

Private Methods

void ChangeCapacity (CTBint i_cap)

Private Attributes

CTBrawBuffer< Tm_rbuf
CTBint mi_nrow
CTBint mi_ncol

Related Functions

(Note that these are not member functions.)

ostream & operator<< (ostream &os, const CTBmatrix< T > &obj)

Detailed Description

template<class T>
class CTBmatrix< T >

Indexable matrix container. **.

Requirements:
Implementation Notes:

Definition at line 23 of file CTBmatrix.hxx.


Member Typedef Documentation

template<class T>
typedef T CTBmatrix::Elem_t
 

vector element type.

Definition at line 27 of file CTBmatrix.hxx.


Constructor & Destructor Documentation

template<class T>
CTBmatrix< T >::CTBmatrix [inline]
 

Construct empty (nrow=ncol=0) matrix.

Definition at line 21 of file CTBmatrix.icc.

template<class T>
CTBmatrix< T >::CTBmatrix CTBint i_nrow,
CTBint i_ncol
 

Construct with i_nrow rows and i_ncol colmuns.

Definition at line 46 of file CTBmatrix.cxx.

template<class T>
CTBmatrix< T >::CTBmatrix CTBint i_nrow,
CTBint i_ncol,
const T & def
 

Construct with i_nrow rows, i_ncol colmuns, and default value def.

Definition at line 62 of file CTBmatrix.cxx.

template<class T>
CTBmatrix< T >::CTBmatrix CTBint i_nrow,
CTBint i_ncol,
const T & def,
const T & defdiag
 

Construct with default value def but defdiag on the diagonal.

Definition at line 78 of file CTBmatrix.cxx.

template<class T>
CTBmatrix< T >::CTBmatrix const CTBmatrix< T > & rhs
 

Copy constructor.

Definition at line 97 of file CTBmatrix.cxx.

template<class T>
CTBmatrix< T >::CTBmatrix CTBmatrix< T > & rhs,
bool b_grab
[inline]
 

Grab constructor.

Definition at line 31 of file CTBmatrix.icc.

template<class T>
CTBmatrix< T >::~CTBmatrix [virtual]
 

Virtual destructor.

Definition at line 113 of file CTBmatrix.cxx.


Member Function Documentation

template<class T>
CTBint CTBmatrix< T >::NRow const [inline]
 

Returns number of rows of matrix.

Definition at line 44 of file CTBmatrix.icc.

Referenced by CTBdot().

template<class T>
CTBint CTBmatrix< T >::NColumn const [inline]
 

Returns number of columns of matrix.

Definition at line 53 of file CTBmatrix.icc.

Referenced by CTBdot(), and StrideRow().

template<class T>
CTBint CTBmatrix< T >::Size const [inline]
 

Returns size of matrix ( equivalent to NRow() * NColumn() ).

Definition at line 62 of file CTBmatrix.icc.

Referenced by ChangeCapacity(), Grab(), TrimCapacity(), operator=(), and ~CTBmatrix().

template<class T>
CTBint CTBmatrix< T >::Capacity const [inline]
 

Returns capacity of matrix.

Definition at line 71 of file CTBmatrix.icc.

Referenced by EnsureCapacity(), IncreaseCapacity(), Resize(), and TrimCapacity().

template<class T>
CTBvectorDsc< T > CTBmatrix< T >::Row CTBint i_row [inline]
 

Access row i_row, (index checked ifdef CTB__IndexCheck).

Definition at line 80 of file CTBmatrix.icc.

template<class T>
CTBvectorCDsc< T > CTBmatrix< T >::Row CTBint i_row const [inline]
 

Constant access row i_row, (index checked ifdef CTB__IndexCheck).

Definition at line 92 of file CTBmatrix.icc.

template<class T>
CTBvectorDsc< T > CTBmatrix< T >::Column CTBint i_col [inline]
 

Access column i_col, (index checked ifdefCTB__IndexCheck).

Definition at line 104 of file CTBmatrix.icc.

template<class T>
CTBvectorCDsc< T > CTBmatrix< T >::Column CTBint i_col const [inline]
 

Constant access column i_col, (index checked ifdef CTB__IndexCheck).

Definition at line 116 of file CTBmatrix.icc.

template<class T>
CTBvectorDsc< T > CTBmatrix< T >::Diagonal [inline]
 

Access diagonal, returns a vector descriptor.

Definition at line 128 of file CTBmatrix.icc.

template<class T>
CTBvectorCDsc< T > CTBmatrix< T >::Diagonal const [inline]
 

Constant access diagonal, returns a vector descriptor.

Definition at line 137 of file CTBmatrix.icc.

template<class T>
CTBvectorDsc< T > CTBmatrix< T >::Diagonal CTBint i_dia
 

Access off-diagonal, returns a vector descriptor.

Returns a descriptor to the super diagonal if i_dia > 0 and to a sub diagonal if i_dia < 0. The diagonal is returned for i_dia = 0, but keep in mind that Diagonal() is faster for this case.

If i_dia >= NColumn() or if i_dia <= -NRow() a descriptor with a zero vector length is returned.

Definition at line 134 of file CTBmatrix.cxx.

template<class T>
CTBvectorCDsc< T > CTBmatrix< T >::Diagonal CTBint i_dia const [inline]
 

Constant access off-diagonal, returns a vector descriptor.

Definition at line 164 of file CTBmatrix.icc.

template<class T>
CTBmatrixDsc< T > CTBmatrix< T >::Transpose [inline]
 

Return matrix descriptor for transposed matrix.

Definition at line 146 of file CTBmatrix.icc.

template<class T>
CTBmatrixCDsc< T > CTBmatrix< T >::Transpose const [inline]
 

Return constant matrix descriptor for transposed matrix.

Definition at line 155 of file CTBmatrix.icc.

template<class T>
void CTBmatrix< T >::SwapRow CTBint i_r1,
CTBint i_r2
 

Swap contents of rows i_r1 and i_r2.

Definition at line 157 of file CTBmatrix.cxx.

template<class T>
void CTBmatrix< T >::SwapColumn CTBint i_c1,
CTBint i_c2
 

Swap contents of columns i_c1 and i_c2.

Definition at line 181 of file CTBmatrix.cxx.

template<class T>
T & CTBmatrix< T >::At CTBint i_row,
CTBint i_col
 

Access matrix element with index range check.

Exceptions:
CTBexceptionIndexRange   index out of range

Definition at line 208 of file CTBmatrix.cxx.

Referenced by operator()().

template<class T>
const T & CTBmatrix< T >::At CTBint i_row,
CTBint i_col
const
 

Constant access matrix element with index range check.

Exceptions:
CTBexceptionIndexRange   index out of range

Definition at line 225 of file CTBmatrix.cxx.

template<class T>
void CTBmatrix< T >::Resize CTBint i_nrow,
CTBint i_ncol
 

Change size of matrix to i_nrow rows and i_ncol columns.

Definition at line 239 of file CTBmatrix.cxx.

Referenced by CTBdot().

template<class T>
void CTBmatrix< T >::Resize CTBint i_nrow,
CTBint i_ncol,
const T & def
 

Change matrix to i_nrow rows and i_ncol columns, default def.

Definition at line 278 of file CTBmatrix.cxx.

template<class T>
void CTBmatrix< T >::EnsureCapacity CTBint i_cap [inline]
 

Ensure capacity.

Definition at line 175 of file CTBmatrix.icc.

Referenced by operator=().

template<class T>
void CTBmatrix< T >::IncreaseCapacity CTBint i_cap
 

Increase capacity to i_cap, at least double it.

Definition at line 317 of file CTBmatrix.cxx.

template<class T>
void CTBmatrix< T >::TrimCapacity [inline]
 

Reduce capacity to NRow() * NColumn() .

Definition at line 185 of file CTBmatrix.icc.

template<class T>
void CTBmatrix< T >::Grab CTBmatrix< T > & rhs
 

Grab resources.

The resources allocated for rhs will be transfered to the calling object.

Definition at line 330 of file CTBmatrix.cxx.

template<class T>
const T * CTBmatrix< T >::Data const [inline]
 

Returns pointer to first element of matrix.

This method is equivalent to operator T *() and has only been added to provide the interface used by CTBmatrixDsc also for CTBmatrix.

Definition at line 200 of file CTBmatrix.icc.

template<class T>
CTBint CTBmatrix< T >::StrideRow const [inline]
 

Returns row stride of matrix (returns NColumn() ).

This method returns always NColumn() and has only been added to provide the interface used by CTBmatrixDsc also for CTBmatrix.

Definition at line 213 of file CTBmatrix.icc.

template<class T>
CTBint CTBmatrix< T >::StrideColumn const [inline]
 

Returns column stride of matrix (returns always 1).

This method returns always 1 and has only been added to provide the interface used by CTBmatrixDsc also for CTBmatrix.

Definition at line 226 of file CTBmatrix.icc.

template<class T>
void CTBmatrix< T >::Dump int i_indent = 0,
ostream & os = cout,
const char * p_text = 0
const
 

Dump.

Definition at line 349 of file CTBmatrix.cxx.

template<class T>
CTBvectorDsc< T > CTBmatrix< T >::operator[] CTBint i_row [inline]
 

Access row (index checked if CTB__IndexCheck defined).

Definition at line 235 of file CTBmatrix.icc.

template<class T>
CTBvectorCDsc< T > CTBmatrix< T >::operator[] CTBint i_row const [inline]
 

Constant access row (index checked ifdef CTB__IndexCheck).

Definition at line 247 of file CTBmatrix.icc.

template<class T>
T & CTBmatrix< T >::operator() CTBint i_row,
CTBint i_col
[inline]
 

Access element (index checked ifdef CTB__IndexCheck).

Definition at line 259 of file CTBmatrix.icc.

template<class T>
const T & CTBmatrix< T >::operator() CTBint i_row,
CTBint i_col
const [inline]
 

Constant access element (index checked ifdef CTB__IndexCheck).

Definition at line 272 of file CTBmatrix.icc.

template<class T>
CTBvectorDsc< T > CTBmatrix< T >::operator() CTBint i_row,
const CTBrange & rcol
[inline]
 

Access row subset (index checked ifdef CTB__IndexCheck).

Definition at line 285 of file CTBmatrix.icc.

template<class T>
CTBvectorCDsc< T > CTBmatrix< T >::operator() CTBint i_row,
const CTBrange & rcol
const [inline]
 

Constant access row subset (index checked ifdef CTB__IndexCheck).

Definition at line 299 of file CTBmatrix.icc.

template<class T>
CTBvectorDsc< T > CTBmatrix< T >::operator() const CTBrange & rrow,
CTBint i_col
[inline]
 

Access column subset (index checked ifdef CTB__IndexCheck).

Definition at line 313 of file CTBmatrix.icc.

template<class T>
CTBvectorCDsc< T > CTBmatrix< T >::operator() const CTBrange & rrow,
CTBint i_col
const [inline]
 

Constant access column subset (index checked ifdef CTB__IndexCheck).

Definition at line 327 of file CTBmatrix.icc.

template<class T>
CTBmatrixDsc< T > CTBmatrix< T >::operator() const CTBrange & rrow,
const CTBrange & rcol
[inline]
 

Access submatrix (index checked ifdef CTB__IndexCheck).

Definition at line 341 of file CTBmatrix.icc.

template<class T>
CTBmatrixCDsc< T > CTBmatrix< T >::operator() const CTBrange & rrow,
const CTBrange & rcol
const [inline]
 

Constant access submatrix (index checked ifdef CTB__IndexCheck).

Definition at line 355 of file CTBmatrix.icc.

template<class T>
bool CTBmatrix< T >::operator! const [inline]
 

Returns true if matrix empty (equivalent to Size()==0 ).

Definition at line 369 of file CTBmatrix.icc.

template<class T>
CTBmatrix< T >::operator T * [inline]
 

Convert to pointer to data, returns null if Size()==0.

Definition at line 378 of file CTBmatrix.icc.

template<class T>
CTBmatrix< T >::operator const T * const [inline]
 

Constant convert to pointer to data, returns null if Size()==0.

Definition at line 387 of file CTBmatrix.icc.

template<class T>
CTBmatrix< T >::operator CTBmatrixDsc< T > [inline]
 

Convert to matrix descriptor.

Definition at line 396 of file CTBmatrix.icc.

template<class T>
CTBmatrix< T >::operator CTBmatrixCDsc< T > const [inline]
 

Convert to constant matrix descriptor.

Definition at line 405 of file CTBmatrix.icc.

template<class T>
CTBmatrix< T > & CTBmatrix< T >::operator= const T & rhs
 

Set all elements to the scalar value rhs.

Definition at line 366 of file CTBmatrix.cxx.

template<class T>
CTBmatrix< T > & CTBmatrix< T >::operator= const CTBmatrix< T > & rhs
 

Copy elements of matrix rhs.

Implementation Notes:
  • An explicit assignment operator is needed to implement the desired `deep copy' semantics. The default compiler generated assignment operator would implement `shallow copy' semantics.

Definition at line 386 of file CTBmatrix.cxx.

template<class T>
CTBmatrix< T > & CTBmatrix< T >::operator= const CTBmatrixCDsc< T > & rhs
 

Copy elements of matrix descriptor rhs.

Definition at line 406 of file CTBmatrix.cxx.

template<class T>
void CTBmatrix< T >::ChangeCapacity CTBint i_cap [private]
 

Change capacity.

Definition at line 437 of file CTBmatrix.cxx.

Referenced by EnsureCapacity(), IncreaseCapacity(), Resize(), and TrimCapacity().


Friends And Related Function Documentation

template<class T>
ostream & operator<< ostream & os,
const CTBmatrix< T > & obj
[related]
 

ostream insertion.

Definition at line 417 of file CTBmatrix.icc.


Member Data Documentation

template<class T>
CTBrawBuffer<T> CTBmatrix::m_rbuf [private]
 

raw memory buffer.

Definition at line 114 of file CTBmatrix.hxx.

template<class T>
CTBint CTBmatrix::mi_nrow [private]
 

number of rows.

Definition at line 115 of file CTBmatrix.hxx.

template<class T>
CTBint CTBmatrix::mi_ncol [private]
 

number of columns.

Definition at line 116 of file CTBmatrix.hxx.


The documentation for this class was generated from the following files:
Generated at Fri Oct 24 18:13:55 2003 for CTBbase by doxygen1.2.9-20010812 written by Dimitri van Heesch, © 1997-2001