tesseract
3.03
|
#include <matrix.h>
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) |
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) { }
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; }
int BandTriMatrix< T >::bandwidth | ( | ) | const [inline] |
int BandTriMatrix< T >::dimension | ( | ) | const [inline] |
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; }