Back to index

fet  5.18.0
Public Member Functions | Private Attributes
Matrix2D< T > Class Template Reference

#include <matrix.h>

List of all members.

Public Member Functions

 Matrix2D ()
 ~Matrix2D ()
void clear ()
void resize (int _d1, int _d2)
T * operator[] (int i)
T & operator() (int i, int j)

Private Attributes

int d1
int d2
T ** a
T * content

Detailed Description

template<typename T>
class Matrix2D< T >

Definition at line 55 of file matrix.h.


Constructor & Destructor Documentation

template<typename T >
Matrix2D< T >::Matrix2D ( )

Definition at line 153 of file matrix.h.

{
       d1=d2=-1;
}
template<typename T >
Matrix2D< T >::~Matrix2D ( )

Definition at line 158 of file matrix.h.

{
       this->clear();
}

Member Function Documentation

template<typename T >
void Matrix2D< T >::clear ( )

Definition at line 163 of file matrix.h.

{
       if(d1>=0 || d2>=0){
              assert(d1>0 && d2>0);
              
              delete[] a;
              
              delete[] content;
       }
       d1=d2=-1;
}
template<typename T >
T & Matrix2D< T >::operator() ( int  i,
int  j 
) [inline]

Definition at line 200 of file matrix.h.

{
       return content[i*d2+j];
}
template<typename T >
T * Matrix2D< T >::operator[] ( int  i) [inline]

Definition at line 195 of file matrix.h.

{
       return a[i];
}
template<typename T >
void Matrix2D< T >::resize ( int  _d1,
int  _d2 
)

Definition at line 175 of file matrix.h.

{
       if(_d1<=0 || _d2<=0){
              this->clear();
              return;
       }

       if(d1!=_d1 || d2!=_d2){
              this->clear();

              d1=_d1;
              d2=_d2;

              content=new T[d1*d2];
              a=new T*[d1];
              for(int i=0; i<d1; i++)
                     a[i]=content+i*d2;
       }
}

Here is the caller graph for this function:


Member Data Documentation

template<typename T>
T** Matrix2D< T >::a [private]

Definition at line 61 of file matrix.h.

template<typename T>
T* Matrix2D< T >::content [private]

Definition at line 62 of file matrix.h.

template<typename T>
int Matrix2D< T >::d1 [private]

Definition at line 58 of file matrix.h.

template<typename T>
int Matrix2D< T >::d2 [private]

Definition at line 59 of file matrix.h.


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