SimpleMatrix< T > Class Template Reference

A simple matrix class. More...

#include <CommonDefs.h>

List of all members.

Public Member Functions

 SimpleMatrix (unsigned int nRows, unsigned int nCols, T elements=T())
 Constructor.
std::vector< T > & operator[] (int i)
 Standard accessor.
unsigned int GetNRows ()
 Returns the number of rows.
unsigned int GetNCols ()
 Returns the number of columns.

Private Attributes

std::vector< std::vector< T > > _matrix
unsigned int _nRows
unsigned int _nCols


Detailed Description

template<class T>
class SimpleMatrix< T >

A simple matrix class.

This class defines a matrix built by STL vectors. It is basically a variable-dimension vector of vectors; the dimension is defined at construction and cannot be changed in current implementation. It is intended as a container and not for algebraic manipulations. The class provides a standard access operator [].

Definition at line 45 of file CommonDefs.h.


Constructor & Destructor Documentation

template<class T>
SimpleMatrix< T >::SimpleMatrix ( unsigned int  nRows,
unsigned int  nCols,
elements = T() 
) [inline]

Constructor.

The constructor will build an nRows x nCols matrix, initialized with a default value. If T is a class with no default constructor, a default value for T must be provided, which will be replicated in every matrix element.

Parameters:
nRows The number of rows.
nCols The number of columns
elements The initialization value for the matrix elements.

Definition at line 58 of file CommonDefs.h.


Member Function Documentation

template<class T>
unsigned int SimpleMatrix< T >::GetNCols (  )  [inline]

Returns the number of columns.

Returns:
The number of columns.

Definition at line 84 of file CommonDefs.h.

template<class T>
unsigned int SimpleMatrix< T >::GetNRows (  )  [inline]

Returns the number of rows.

Returns:
The number of rows.

Definition at line 76 of file CommonDefs.h.

template<class T>
std::vector<T>& SimpleMatrix< T >::operator[] ( int  i  )  [inline]

Standard accessor.

Parameters:
i The desired row.
Returns:
The i-th row (a vector).

Definition at line 68 of file CommonDefs.h.


Member Data Documentation

template<class T>
std::vector<std::vector<T> > SimpleMatrix< T >::_matrix [private]

Definition at line 90 of file CommonDefs.h.

Referenced by SimpleMatrix< UInt_t >::operator[]().

template<class T>
unsigned int SimpleMatrix< T >::_nCols [private]

Definition at line 91 of file CommonDefs.h.

Referenced by SimpleMatrix< UInt_t >::GetNCols().

template<class T>
unsigned int SimpleMatrix< T >::_nRows [private]

Definition at line 91 of file CommonDefs.h.

Referenced by SimpleMatrix< UInt_t >::GetNRows().


The documentation for this class was generated from the following file:

Generated on Wed May 27 15:21:42 2009 for PamCut by  doxygen 1.5.9