tesseract  3.03
BandTriMatrix< T > Class Template Reference

#include <matrix.h>

Inheritance diagram for BandTriMatrix< T >:
GENERIC_2D_ARRAY< T >

List of all members.

Public Member Functions

 BandTriMatrix (int dim1, int dim2, const T &empty)
int dimension () const
int bandwidth () const
virtual int index (int column, int row) const
void AttachOnCorner (BandTriMatrix< T > *array2)

Detailed Description

template<class T>
class BandTriMatrix< T >

Definition at line 235 of file matrix.h.


Constructor & Destructor Documentation

template<class T>
BandTriMatrix< T >::BandTriMatrix ( int  dim1,
int  dim2,
const T &  empty 
) [inline]

Definition at line 240 of file matrix.h.

    : GENERIC_2D_ARRAY<T>(dim1, dim2, empty)  {
  }

Member Function Documentation

template<class T>
void BandTriMatrix< T >::AttachOnCorner ( BandTriMatrix< T > *  array2) [inline]

Definition at line 264 of file matrix.h.

                                                {
    int new_dim1 = this->dim1_ + array2->dim1_;
    int new_dim2 = MAX(this->dim2_, array2->dim2_);
    T* new_array = new T[new_dim1 * new_dim2];
    for (int col = 0; col < new_dim1; ++col) {
      for (int j = 0; j < new_dim2; ++j) {
        int new_index = col * new_dim2 + j;
        if (col < this->dim1_ && j < this->dim2_) {
          new_array[new_index] = this->get(col, col + j);
        } else if (col >= this->dim1_ && j < array2->dim2_) {
          new_array[new_index] = array2->get(col - this->dim1_,
                                             col - this->dim1_ + j);
          array2->put(col - this->dim1_, col - this->dim1_ + j, NULL);
        } else {
          new_array[new_index] = this->empty_;
        }
      }
    }
    delete[] this->array_;
    this->array_ = new_array;
    this->dim1_ = new_dim1;
    this->dim2_ = new_dim2;
  }
template<class T>
int BandTriMatrix< T >::bandwidth ( ) const [inline]

Definition at line 249 of file matrix.h.

{ return this->dim2_; }
template<class T>
int BandTriMatrix< T >::dimension ( ) const [inline]

Definition at line 247 of file matrix.h.

{ return this->dim1_; }
template<class T>
virtual int BandTriMatrix< T >::index ( int  column,
int  row 
) const [inline, virtual]

Reimplemented from GENERIC_2D_ARRAY< T >.

Definition at line 254 of file matrix.h.

                                               {
    ASSERT_HOST(row >= column);
    ASSERT_HOST(row - column < this->dim2_);
    return column * this->dim2_ + row - column;
  }

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines