claraty::Matrix_NxM< T, Nrows, Ncols > Class Template Reference
[Data Structure]
#include <matrix_nxm.h>
Inheritance diagram for claraty::Matrix_NxM< T, Nrows, Ncols >:


Public Types | |
| enum | SIZE_TYPE { SQUARE, EQUALS, NCOLS_EQUALS_NROWS } |
| typedef T | value_type |
| typedef value_type * | pointer |
| typedef const value_type * | const_pointer |
| typedef N_2D_Array_Iterator< T > | iterator |
| typedef N_2D_Array_const_Iterator< T > | const_iterator |
| typedef value_type & | reference |
| typedef const value_type & | const_reference |
| typedef size_t | size_type |
| typedef ptrdiff_t | difference_type |
Public Member Functions | |
| Matrix_NxM () | |
| Matrix_NxM (const Vector< T > *columns[Ncols]) | |
| template<class In> | |
| Matrix_NxM (In start) | |
| Matrix_NxM (N_2D_Array_const_Iterator< T > start) | |
| Matrix_NxM (const T *start) | |
| Matrix_NxM (const T &filler) | |
| Matrix_NxM (const Matrix_NxM &m) | |
| Matrix_NxM (const Matrix< T > &m) | |
| Matrix_NxM (const N_2D_Array< T > &a) | |
| ~Matrix_NxM () | |
| const Matrix_NxM & | operator= (const T &filler) |
| Matrix_NxM | operator- () const |
| T & | operator() (int r, int c) |
| const T & | operator() (int r, int c) const |
| Matrix_NxM & | transpose_in_place () |
| Matrix_NxM< T, Ncols, Nrows > | transpose () const |
| void | resize (int newNumRows, int newNumCols) |
| void | copy_into_columns (const Vector< T > *columns[]) |
| operator vnl_matrix_ref () | |
| Matrix & | operator+= (const T &rhs) |
| template<class rhsType> | |
| Matrix & | operator+= (const Matrix< rhsType > &rhs) |
| Matrix & | operator-= (const T &rhs) |
| template<class rhsType> | |
| Matrix & | operator-= (const Matrix< rhsType > &rhs) |
| Matrix & | operator *= (const T &rhs) |
| Matrix & | operator/= (const T &rhs) |
| T | sum_of_squares () const |
| Matrix | transpose_times (const Matrix< T > &B) const |
| Vector< T > | row (int r) const |
| Vector< T > | column (int c) const |
| T | min_value (int *min_row=NULL, int *min_col=NULL) const |
| T | max_value (int *max_row=NULL, int *max_col=NULL) const |
| Matrix | abs () const |
| T | average () const |
| T | sum () const |
| template<class In> | |
| N_2D_Array & | set_diagonal (int size, In start) |
| N_2D_Array & | set_diagonal (const N_2D_Array< T > &a) |
| int | get_size () const |
| int | ncols () const |
| int | get_num_of_cols () const |
| int | nrows () const |
| int | get_num_of_rows () const |
| bool | is_square () const |
| bool | is_subarray () const |
| iterator | begin () |
| const_iterator | begin () const |
| iterator | end () |
| const_iterator | end () const |
| N_2D_Array & | displace_subarray (int delta_x, int delta_y) |
| N_2D_Array & | resize_subarray (int left, int top, int width, int height) |
| N_2D_Array & | associate_subarray (const N_2D_Array &parent, int left, int top, int width, int height) |
| int | get_full_num_cols () const |
| int | get_full_num_rows () const |
| void | dissociate (int new_nrows=-1, int new_ncols=-1) |
| N_2D_Array< T > | get_row (int row) const |
| N_2D_Array< T > | get_col (int col) const |
| const T * | get_row_pointer (int row) const |
| iterator | column_iterator (int col) |
| const_iterator | column_iterator (int col) const |
| T & | rc (int row, int column) |
| const T & | rc (int row, int column) const |
| T & | xy (int x, int y) |
| const T & | xy (int x, int y) const |
| T & | xy (const N_2D_Point_i &p) |
| const T & | xy (const N_2D_Point_i &p) const |
| void | write (std::ostream &os) const |
| operator void * () const | |
| N_2D_Array | operator== (const N_2D_Array &rhs) const |
| bool | io (FDM_Map map) |
Public Attributes | |
| T | _data [Nrows][Ncols] |
Protected Member Functions | |
| template<class BinOp> | |
| Matrix & | scalar_apply (BinOp op, const T &rhs) |
| T & | element (int i) |
| const T & | element (int i) const |
| T * | get_data () |
| const T * | get_data () const |
| template<class In> | |
| void | _copy (In start) |
| void | _copy (T filler) |
| template<class rhsType> | |
| int | _check_size (SIZE_TYPE type, const N_2D_Array< rhsType > &rhs) const |
| void | _init_special (int nr, int nc, T *data, int memwidth) |
| void | _drop_memory () |
| void | _init_index (bool allocate=true) |
| bool | _is_noncontiguous () const |
Protected Attributes | |
| int | _num_of_rows |
| int | _num_of_cols |
| int | _mem_width |
| int | _mem_height |
| T * | _elements |
| T ** | _index |
| T * | _mem_base |
| Reference_Count * | _ref_count |
| bool | _isSubarray |
Private Member Functions | |
| void | _init () |
Detailed Description
template<class T, int Nrows, int Ncols>
class claraty::Matrix_NxM< T, Nrows, Ncols >
Definition at line 43 of file matrix_nxm.h.
Member Typedef Documentation
typedef T claraty::N_2D_Array< T >::value_type [inherited] |
Definition at line 64 of file 2d_array.h.
typedef value_type* claraty::N_2D_Array< T >::pointer [inherited] |
Definition at line 65 of file 2d_array.h.
typedef const value_type* claraty::N_2D_Array< T >::const_pointer [inherited] |
Definition at line 66 of file 2d_array.h.
typedef N_2D_Array_Iterator<T> claraty::N_2D_Array< T >::iterator [inherited] |
Definition at line 67 of file 2d_array.h.
typedef N_2D_Array_const_Iterator<T> claraty::N_2D_Array< T >::const_iterator [inherited] |
Definition at line 68 of file 2d_array.h.
typedef value_type& claraty::N_2D_Array< T >::reference [inherited] |
Definition at line 69 of file 2d_array.h.
typedef const value_type& claraty::N_2D_Array< T >::const_reference [inherited] |
Definition at line 70 of file 2d_array.h.
typedef size_t claraty::N_2D_Array< T >::size_type [inherited] |
Definition at line 71 of file 2d_array.h.
typedef ptrdiff_t claraty::N_2D_Array< T >::difference_type [inherited] |
Definition at line 72 of file 2d_array.h.
Member Enumeration Documentation
enum claraty::N_2D_Array::SIZE_TYPE [inherited] |
Constructor & Destructor Documentation
| claraty::Matrix_NxM< T, Nrows, Ncols >::Matrix_NxM | ( | ) | [inline] |
Definition at line 70 of file matrix_nxm.h.
References claraty::Matrix_NxM< T, Nrows, Ncols >::_init().
00070 : Matrix<T>() { _init(); }
Here is the call graph for this function:

| claraty::Matrix_NxM< T, Nrows, Ncols >::Matrix_NxM | ( | const Vector< T > * | columns[Ncols] | ) | [inline] |
Definition at line 72 of file matrix_nxm.h.
References claraty::Matrix_NxM< T, Nrows, Ncols >::_init(), and claraty::Matrix< T >::copy_into_columns().
00072 { 00073 _init(); 00074 copy_into_columns(columns); 00075 }
Here is the call graph for this function:

| claraty::Matrix_NxM< T, Nrows, Ncols >::Matrix_NxM | ( | In | start | ) | [inline] |
Definition at line 80 of file matrix_nxm.h.
References claraty::N_2D_Array< T >::_copy(), and claraty::Matrix_NxM< T, Nrows, Ncols >::_init().
Here is the call graph for this function:

| claraty::Matrix_NxM< T, Nrows, Ncols >::Matrix_NxM | ( | N_2D_Array_const_Iterator< T > | start | ) | [inline] |
Definition at line 81 of file matrix_nxm.h.
References claraty::N_2D_Array< T >::_copy(), and claraty::Matrix_NxM< T, Nrows, Ncols >::_init().
Here is the call graph for this function:

| claraty::Matrix_NxM< T, Nrows, Ncols >::Matrix_NxM | ( | const T * | start | ) | [inline] |
Definition at line 83 of file matrix_nxm.h.
References claraty::N_2D_Array< T >::_copy(), and claraty::Matrix_NxM< T, Nrows, Ncols >::_init().
Here is the call graph for this function:

| claraty::Matrix_NxM< T, Nrows, Ncols >::Matrix_NxM | ( | const T & | filler | ) | [inline] |
Definition at line 84 of file matrix_nxm.h.
References claraty::N_2D_Array< T >::_copy(), and claraty::Matrix_NxM< T, Nrows, Ncols >::_init().
Here is the call graph for this function:

| claraty::Matrix_NxM< T, Nrows, Ncols >::Matrix_NxM | ( | const Matrix_NxM< T, Nrows, Ncols > & | m | ) | [inline] |
Definition at line 89 of file matrix_nxm.h.
References claraty::N_2D_Array< T >::_copy(), claraty::Matrix_NxM< T, Nrows, Ncols >::_data, and claraty::Matrix_NxM< T, Nrows, Ncols >::_init().
Here is the call graph for this function:

| claraty::Matrix_NxM< T, Nrows, Ncols >::Matrix_NxM | ( | const Matrix< T > & | m | ) | [inline] |
Definition at line 152 of file matrix_nxm.h.
References claraty::N_2D_Array< T >::_check_size(), claraty::N_2D_Array< T >::_copy(), claraty::Matrix_NxM< T, Nrows, Ncols >::_init(), and claraty::N_2D_Array< T >::begin().
00153 { 00154 _init(); 00155 _check_size(N_2D_Array<T>::EQUALS, m); 00156 _copy(m.begin()); 00157 }
Here is the call graph for this function:

| claraty::Matrix_NxM< T, Nrows, Ncols >::Matrix_NxM | ( | const N_2D_Array< T > & | a | ) | [inline] |
Definition at line 161 of file matrix_nxm.h.
References claraty::N_2D_Array< T >::_check_size(), claraty::N_2D_Array< T >::_copy(), claraty::Matrix_NxM< T, Nrows, Ncols >::_init(), and claraty::N_2D_Array< T >::begin().
00162 { 00163 _init(); 00164 _check_size(N_2D_Array<T>::EQUALS, a); 00165 _copy(a.begin()); 00166 }
Here is the call graph for this function:

| claraty::Matrix_NxM< T, Nrows, Ncols >::~Matrix_NxM | ( | ) | [inline] |
Definition at line 97 of file matrix_nxm.h.
References claraty::N_2D_Array< T >::_drop_memory().
00097 { this->_drop_memory(); }
Here is the call graph for this function:

Member Function Documentation
| const Matrix_NxM& claraty::Matrix_NxM< T, Nrows, Ncols >::operator= | ( | const T & | filler | ) | [inline] |
Reimplemented from claraty::Matrix< T >.
Definition at line 101 of file matrix_nxm.h.
References claraty::N_2D_Array< T >::_copy().
00101 { 00102 _copy(filler); 00103 return *this; 00104 }
Here is the call graph for this function:

| Matrix_NxM< T, Nrows, Ncols > claraty::Matrix_NxM< T, Nrows, Ncols >::operator- | ( | ) | const [inline] |
Reimplemented from claraty::Matrix< T >.
Definition at line 278 of file matrix_nxm.h.
References claraty::Matrix_NxM< T, Nrows, Ncols >::_data.
00279 { 00280 Matrix_NxM tmp(*this); 00281 for (int r = 0; r < Nrows; r++) 00282 for (int c = 0; c < Ncols; c++) 00283 tmp(r,c) = - _data[r][c]; 00284 return tmp; 00285 }
| T& claraty::Matrix_NxM< T, Nrows, Ncols >::operator() | ( | int | r, | |
| int | c | |||
| ) | [inline] |
Reimplemented from claraty::N_2D_Array< T >.
Definition at line 114 of file matrix_nxm.h.
References claraty::Matrix_NxM< T, Nrows, Ncols >::_data.
00114 {return _data[r][c];}
| const T& claraty::Matrix_NxM< T, Nrows, Ncols >::operator() | ( | int | r, | |
| int | c | |||
| ) | const [inline] |
Reimplemented from claraty::N_2D_Array< T >.
Definition at line 115 of file matrix_nxm.h.
References claraty::Matrix_NxM< T, Nrows, Ncols >::_data.
00115 {return _data[r][c];}
| Matrix_NxM< T, Nrows, Ncols > & claraty::Matrix_NxM< T, Nrows, Ncols >::transpose_in_place | ( | ) |
Definition at line 170 of file matrix_nxm.h.
References claraty::Matrix_NxM< T, Nrows, Ncols >::_data, and ERROR.
00171 { 00172 if (this->_check_size(N_2D_Array<T>::SQUARE) == ERROR) { 00173 std::cerr << "Matrix_NxM in-place transpose attempted on non-square matrix" 00174 << std::endl; 00175 return *this; 00176 } 00177 for (int i=0; i<Nrows-1; ++i) 00178 for (int j=i+1; j<Ncols; ++j) { 00179 T tmp = _data[i][j]; 00180 _data[i][j] = _data[j][i]; 00181 _data[j][i] = tmp; 00182 } 00183 return *this; 00184 }
| Matrix_NxM< T, Ncols, Nrows > claraty::Matrix_NxM< T, Nrows, Ncols >::transpose | ( | ) | const |
Reimplemented from claraty::Matrix< T >.
Definition at line 188 of file matrix_nxm.h.
00189 { 00190 Matrix_NxM<T, Ncols, Nrows> ret; 00191 for (int i = 0; i < Nrows; ++i) 00192 for (int j = 0; j < Ncols; ++j) 00193 ret(j, i) = operator()(i, j); 00194 return ret; 00195 }
| void claraty::Matrix_NxM< T, Nrows, Ncols >::resize | ( | int | newNumRows, | |
| int | newNumCols | |||
| ) | [inline] |
| void claraty::Matrix_NxM< T, Nrows, Ncols >::_init | ( | ) | [inline, private] |
Definition at line 143 of file matrix_nxm.h.
References claraty::Matrix_NxM< T, Nrows, Ncols >::_data, and claraty::N_2D_Array< T >::_init_special().
Referenced by claraty::Matrix_NxM< T, Nrows, Ncols >::Matrix_NxM().
00144 { 00145 // Set up the superclass variables correctly. 00146 _init_special(Nrows, Ncols, &_data[0][0], Ncols); 00147 }
Here is the call graph for this function:

| void claraty::Matrix< T >::copy_into_columns | ( | const Vector< T > * | columns[] | ) | [inherited] |
Definition at line 446 of file matrix.h.
References claraty::N_2D_Array< T >::get_num_of_cols(), and claraty::N_2D_Array< T >::get_num_of_rows().
Referenced by claraty::Matrix< uint16_t >::Matrix(), and claraty::Matrix_NxM< T, Nrows, Ncols >::Matrix_NxM().
00447 { 00448 for (int i = 0; i < this->get_num_of_cols(); i++) 00449 for (int j = 0; j < this->get_num_of_rows(); j++) 00450 this->operator()(j, i) = (*columns[i])[j]; 00451 }
Here is the call graph for this function:

| claraty::Matrix< T >::operator vnl_matrix_ref | ( | ) | [inline, inherited] |
| Matrix& claraty::Matrix< T >::operator+= | ( | const T & | rhs | ) | [inline, inherited] |
Definition at line 137 of file matrix.h.
00137 { 00138 return scalar_apply(cl_plus<T>(), rhs); 00139 }
| Matrix& claraty::Matrix< T >::operator+= | ( | const Matrix< rhsType > & | rhs | ) | [inline, inherited] |
Definition at line 156 of file matrix.h.
00156 { 00157 if (_check_size(N_2D_Array<T>::EQUALS, rhs) == OK) 00158 cl_transform(rhs.begin(), rhs.end(), this->begin(), this->begin(), cl_plus<T>()); 00159 return *this; 00160 }
| Matrix& claraty::Matrix< T >::operator-= | ( | const T & | rhs | ) | [inline, inherited] |
Definition at line 140 of file matrix.h.
00140 { 00141 return scalar_apply(cl_minus<T>(), rhs); 00142 }
| Matrix& claraty::Matrix< T >::operator-= | ( | const Matrix< rhsType > & | rhs | ) | [inline, inherited] |
Definition at line 164 of file matrix.h.
00164 { 00165 if (_check_size(N_2D_Array<T>::EQUALS, rhs) == OK) 00166 cl_transform(this->begin(), this->end(), rhs.begin(), this->begin(), cl_minus<T>()); 00167 return *this; 00168 }
| Matrix& claraty::Matrix< T >::operator *= | ( | const T & | rhs | ) | [inline, inherited] |
Definition at line 143 of file matrix.h.
00143 { 00144 return scalar_apply(cl_multiplies<T>(), rhs); 00145 }
| Matrix& claraty::Matrix< T >::operator/= | ( | const T & | rhs | ) | [inline, inherited] |
Definition at line 146 of file matrix.h.
00146 { 00147 return scalar_apply(cl_divides<T>(), rhs); 00148 }
| T claraty::Matrix< T >::sum_of_squares | ( | ) | const [inherited] |
Definition at line 324 of file matrix.h.
References claraty::N_2D_Array< T >::begin(), and claraty::N_2D_Array< T >::end().
00325 { 00326 N_2D_Array_const_Iterator<T> it = this->begin(), last = this->end(); 00327 double f = 0.0; 00328 for (; it != last; ++it) 00329 f += (*it)*(*it); 00330 return static_cast<T>(f); 00331 }
Here is the call graph for this function:

| Matrix< T > claraty::Matrix< T >::transpose_times | ( | const Matrix< T > & | B | ) | const [inherited] |
Definition at line 383 of file matrix.h.
References claraty::N_2D_Array< T >::get_num_of_cols(), and claraty::N_2D_Array< T >::get_num_of_rows().
00384 { 00385 // For A'*B, A and B must have the same number of rows 00386 if (this->get_num_of_rows() != B.get_num_of_rows()){ 00387 // size mismatch 00388 std::cerr << "matrix::transpose_times: size mismatch" << std::endl; 00389 } else { 00390 // Multiply A' times B 00391 Matrix<T> result(this->get_num_of_cols(), B.get_num_of_cols()); 00392 00393 for (int i=0; i<this->get_num_of_cols(); i++){ 00394 for (int j=0; j<B.get_num_of_cols(); j++){ 00395 result(i,j) = 0.0; 00396 for (int k=0; k<this->get_num_of_rows(); k++){ 00397 result(i,j) += (*this)(k,i) * B(k,j); 00398 } 00399 } 00400 } 00401 return result; 00402 } 00403 Matrix<T> result; 00404 return result; 00405 }
Here is the call graph for this function:

| Vector<T> claraty::Matrix< T >::row | ( | int | r | ) | const [inline, inherited] |
Definition at line 174 of file matrix.h.
00174 { 00175 assert(r < this->nrows()); 00176 return Vector<T>(this->ncols(), this->get_row_pointer(r)); 00177 }
| Vector<T> claraty::Matrix< T >::column | ( | int | c | ) | const [inline, inherited] |
Definition at line 179 of file matrix.h.
00179 { 00180 assert(c < this->ncols()); 00181 return Vector<T>(this->nrows(), this->column_iterator(c), COL_VECTOR); 00182 }
| T claraty::Matrix< T >::min_value | ( | int * | min_row = NULL, |
|
| int * | min_col = NULL | |||
| ) | const [inline, inherited] |
Definition at line 234 of file matrix.h.
References claraty::N_2D_Array< T >::begin(), claraty::N_2D_Array< T >::end(), and claraty::N_2D_Array< T >::get_num_of_cols().
Referenced by claraty::Rescale_Op< T >::filter().
00235 { 00236 int min_index = 0; 00237 N_2D_Array_const_Iterator<T> it = this->begin(), last = this->end(); 00238 T min_value = *it; 00239 ++it; 00240 for (int i = 1; it != last; ++it, ++i) 00241 if (min_value > *it) { 00242 min_value = *it; 00243 min_index = i; 00244 } 00245 if (min_row != NULL) 00246 *min_row = min_index / this->get_num_of_cols(); 00247 if (min_col != NULL) 00248 *min_col = min_index % this->get_num_of_cols(); 00249 return min_value; 00250 }
Here is the call graph for this function:

| T claraty::Matrix< T >::max_value | ( | int * | max_row = NULL, |
|
| int * | max_col = NULL | |||
| ) | const [inline, inherited] |
Definition at line 253 of file matrix.h.
References claraty::N_2D_Array< T >::end(), claraty::N_2D_Array< T >::get_num_of_cols(), and claraty::N_2D_Array< T >::get_num_of_rows().
Referenced by claraty::Image_IO_Factory::compute_sigbits(), and claraty::Rescale_Op< T >::filter().
00254 { 00255 int max_index = 0; 00256 T max_value = 0; 00257 00258 // If non-zero size iterate over values to find the max, otherwise return 0 00259 if(this->get_num_of_cols() > 0 && this->get_num_of_rows() > 0) { 00260 N_2D_Array_const_Iterator<T> it = this->begin(), last = this->end(); 00261 max_value = *it; 00262 ++it; 00263 for (int i = 1; it != last; ++it, ++i) 00264 if (max_value < *it) { 00265 max_value = *it; 00266 max_index = i; 00267 } 00268 if (max_row != NULL) 00269 *max_row = max_index / this->get_num_of_cols(); 00270 if (max_col != NULL) 00271 *max_col = max_index % this->get_num_of_cols(); 00272 return max_value; 00273 } 00274 else { 00275 // Zero size 00276 if (max_row != NULL) 00277 *max_row = 0; 00278 if (max_col != NULL) 00279 *max_col = 0; 00280 return(0); 00281 } 00282 00283 }
Here is the call graph for this function:

| Matrix< T > claraty::Matrix< T >::abs | ( | ) | const [inline, inherited] |
Definition at line 287 of file matrix.h.
References claraty::cl_transform(), claraty::N_2D_Array< T >::end(), and claraty::N_2D_Array< T >::get_num_of_cols().
00288 { 00289 Matrix<T> tmp(this->get_num_of_rows(), this->get_num_of_cols()); 00290 cl_transform(this->begin(), this->end(), tmp.begin(), cl_abs_op<T>()); 00291 return tmp; 00292 }
Here is the call graph for this function:

| T claraty::Matrix< T >::average | ( | ) | const [inherited] |
Definition at line 296 of file matrix.h.
References claraty::cl_accumulate(), claraty::N_2D_Array< T >::end(), and claraty::Matrix< T >::sum().
00297 { 00298 T sum = 0; 00299 return cl_accumulate(this->begin(), this->end(), sum) / this->get_size(); 00300 }
Here is the call graph for this function:

| T claraty::Matrix< T >::sum | ( | ) | const [inherited] |
Definition at line 304 of file matrix.h.
References claraty::cl_accumulate(), and claraty::N_2D_Array< T >::end().
Referenced by claraty::Matrix< T >::average().
00305 { 00306 T sum = 0; 00307 return cl_accumulate(this->begin(), this->end(), sum); 00308 }
Here is the call graph for this function:

| Matrix& claraty::Matrix< T >::scalar_apply | ( | BinOp | op, | |
| const T & | rhs | |||
| ) | [inline, protected, inherited] |
Definition at line 194 of file matrix.h.
Referenced by claraty::Matrix< uint16_t >::operator *=(), claraty::Matrix< uint16_t >::operator+=(), claraty::Matrix< uint16_t >::operator-=(), and claraty::Matrix< uint16_t >::operator/=().
00194 { 00195 if (this->is_subarray()) 00196 cl_apply(*this, cl_bind2nd(op, rhs)); 00197 else 00198 cl_transform(this->get_data(), this->get_data() + this->get_size(), 00199 this->get_data(), cl_bind2nd(op, rhs)); 00200 return *this; 00201 }
| N_2D_Array< T > & claraty::N_2D_Array< T >::set_diagonal | ( | int | size, | |
| In | start | |||
| ) | [inherited] |
Definition at line 516 of file 2d_array.h.
References claraty::N_2D_Array< T >::_num_of_cols, and claraty::N_2D_Array< T >::is_square().
Referenced by claraty::Matrix< uint16_t >::Matrix(), and claraty::N_2D_Array< uint16_t >::set_diagonal().
00517 { 00518 if (!is_square()) 00519 std::cerr << "matrix error: cannot set diagonal on a non-square matrix" 00520 << std::endl; 00521 else if (size!=_num_of_cols) 00522 std::cerr << "matrix error: number of diagonal elements (" << size << ") " 00523 << "is not the same as matrix dimension of " << _num_of_cols 00524 << std::endl; 00525 else 00526 for (int i = 0; i < _num_of_cols; ++i, ++start) 00527 operator()(i, i) = *start; 00528 return *this; 00529 }
Here is the call graph for this function:

| N_2D_Array& claraty::N_2D_Array< T >::set_diagonal | ( | const N_2D_Array< T > & | a | ) | [inline, inherited] |
Definition at line 143 of file 2d_array.h.
00143 { 00144 return set_diagonal(a.get_size(), a.begin()); 00145 }
| int claraty::N_2D_Array< T >::get_size | ( | ) | const [inline, inherited] |
Definition at line 149 of file 2d_array.h.
Referenced by claraty::match_orientations(), claraty::operator *(), claraty::N_2D_Array< T >::operator==(), claraty::N_2D_Array< uint16_t >::resize(), claraty::Matrix< uint16_t >::scalar_apply(), and claraty::N_2D_Array< uint16_t >::set_diagonal().
00149 { return _num_of_rows*_num_of_cols; }
| int claraty::N_2D_Array< T >::ncols | ( | ) | const [inline, inherited] |
Definition at line 152 of file 2d_array.h.
Referenced by claraty::Matrix< uint16_t >::column(), claraty::N_2D_Array< uint16_t >::dissociate(), claraty::N_2D_Array< T >::io(), claraty::match_orientations(), claraty::Image_IO_Factory::move_raster_to_image(), claraty::operator *(), claraty::Matrix< uint16_t >::operator vnl_matrix_ref(), claraty::Matrix< T >::operator-(), claraty::Image_IO_Factory::rasterize_image(), claraty::RGB_Image< T >::RGB_Image(), claraty::Matrix< uint16_t >::row(), and claraty::Image_IO_Factory::save_image().
00152 { return _num_of_cols; }
| int claraty::N_2D_Array< T >::get_num_of_cols | ( | ) | const [inline, inherited] |
Definition at line 153 of file 2d_array.h.
Referenced by claraty::N_2D_Array< T >::_check_size(), claraty::Matrix< T >::abs(), claraty::cat_col(), claraty::cat_row(), claraty::Stereovision::compute_point_image(), claraty::Matrix< T >::copy_into_columns(), claraty::Transform_Op< T >::filter(), claraty::Non_Maxima_Sup_Op::filter(), claraty::Convolve_Op< TEMPLATE_REFS >::filter(), claraty::Image< uint16_t >::get_width(), claraty::Resample_Op::halfsample(), claraty::inverse(), claraty::matrix_cholesky(), claraty::matrix_cholesky_backsubstitute(), claraty::Matrix< T >::max_value(), claraty::Matrix< T >::min_value(), claraty::operator *(), claraty::N_2D_Array< T >::operator=(), claraty::Resample_Op::resample(), claraty::RMatrix< T >::RMatrix(), claraty::to_float(), claraty::Matrix< T >::transpose(), claraty::Matrix< T >::transpose_times(), and claraty::N_2D_Array< T >::write().
00153 { return _num_of_cols; }
| int claraty::N_2D_Array< T >::nrows | ( | ) | const [inline, inherited] |
Definition at line 156 of file 2d_array.h.
Referenced by claraty::Matrix< uint16_t >::column(), claraty::N_2D_Array< uint16_t >::dissociate(), claraty::N_2D_Array< T >::io(), claraty::match_orientations(), claraty::Image_IO_Factory::move_raster_to_image(), claraty::operator *(), claraty::Matrix< uint16_t >::operator vnl_matrix_ref(), claraty::Matrix< T >::operator-(), claraty::Image_IO_Factory::rasterize_image(), claraty::RGB_Image< T >::RGB_Image(), claraty::Matrix< uint16_t >::row(), and claraty::Image_IO_Factory::save_image().
00156 { return _num_of_rows; }
| int claraty::N_2D_Array< T >::get_num_of_rows | ( | ) | const [inline, inherited] |
Definition at line 157 of file 2d_array.h.
Referenced by claraty::N_2D_Array< T >::_check_size(), claraty::cat_col(), claraty::cat_row(), claraty::Stereovision::compute_point_image(), claraty::Matrix< T >::copy_into_columns(), claraty::Transform_Op< T >::filter(), claraty::Non_Maxima_Sup_Op::filter(), claraty::Convolve_Op< TEMPLATE_REFS >::filter(), claraty::Image< uint16_t >::get_height(), claraty::Resample_Op::halfsample(), claraty::matrix_cholesky(), claraty::matrix_cholesky_backsubstitute(), claraty::Matrix< T >::max_value(), claraty::operator *(), claraty::N_2D_Array< T >::operator=(), claraty::Resample_Op::resample(), claraty::RMatrix< T >::RMatrix(), claraty::to_float(), claraty::Matrix< T >::transpose(), claraty::Matrix< T >::transpose_times(), and claraty::N_2D_Array< T >::write().
00157 { return _num_of_rows; }
| bool claraty::N_2D_Array< T >::is_square | ( | ) | const [inline, inherited] |
Definition at line 159 of file 2d_array.h.
Referenced by claraty::det(), claraty::inverse(), and claraty::N_2D_Array< T >::set_diagonal().
00159 { return _num_of_rows == _num_of_cols; }
| bool claraty::N_2D_Array< T >::is_subarray | ( | ) | const [inline, inherited] |
Definition at line 198 of file 2d_array.h.
Referenced by claraty::N_2D_Array< T >::_copy(), claraty::N_2D_Array< uint16_t >::get_data(), claraty::N_2D_Array< T >::N_2D_Array(), claraty::Image_IO_Factory::rasterize_image(), claraty::RGB_Image< T >::RGB_Image(), and claraty::Image_IO_Pgm_Simple::save().
00198 { return _isSubarray; }
| iterator claraty::N_2D_Array< T >::begin | ( | ) | [inline, inherited] |
Definition at line 201 of file 2d_array.h.
Referenced by claraty::N_2D_Array< T >::_copy(), claraty::Tsai_Camera_Model::io(), claraty::Matrix_NxM< T, Nrows, Ncols >::Matrix_NxM(), claraty::Matrix< T >::min_value(), claraty::N_2D_Array< T >::N_2D_Array(), claraty::N_2D_Array< T >::operator void *(), claraty::operator+(), claraty::Matrix< uint16_t >::operator+=(), claraty::operator-(), claraty::Matrix< uint16_t >::operator-=(), claraty::N_2D_Array< T >::operator=(), claraty::N_2D_Array< T >::operator==(), claraty::N_2D_Array< uint16_t >::set_diagonal(), claraty::Matrix< T >::sum_of_squares(), claraty::to_float(), and claraty::N_2D_Array< T >::transpose().
00201 { 00202 return iterator(_elements, _is_noncontiguous(), _num_of_cols, _mem_width); 00203 }
| const_iterator claraty::N_2D_Array< T >::begin | ( | ) | const [inline, inherited] |
Definition at line 204 of file 2d_array.h.
00204 { 00205 return const_iterator(_elements, _is_noncontiguous(), _num_of_cols, 00206 _mem_width); 00207 }
| iterator claraty::N_2D_Array< T >::end | ( | ) | [inline, inherited] |
Definition at line 208 of file 2d_array.h.
Referenced by claraty::N_2D_Array< T >::_copy(), claraty::Matrix< T >::abs(), claraty::Matrix< T >::average(), claraty::Matrix< T >::max_value(), claraty::Matrix< T >::min_value(), claraty::N_2D_Array< T >::operator void *(), claraty::Matrix< uint16_t >::operator+=(), claraty::operator-(), claraty::Matrix< uint16_t >::operator-=(), claraty::Matrix< T >::sum(), claraty::Matrix< T >::sum_of_squares(), and claraty::to_float().
00208 { 00209 return iterator(_elements + _num_of_rows * _mem_width, 00210 _is_noncontiguous(), _num_of_cols, _mem_width); 00211 }
| const_iterator claraty::N_2D_Array< T >::end | ( | ) | const [inline, inherited] |
Definition at line 212 of file 2d_array.h.
00212 { 00213 return const_iterator(_elements + _num_of_rows * _mem_width, 00214 _is_noncontiguous(), _num_of_cols, _mem_width); 00215 }
| N_2D_Array< T > & claraty::N_2D_Array< T >::displace_subarray | ( | int | delta_x, | |
| int | delta_y | |||
| ) | [inherited] |
Definition at line 534 of file 2d_array.h.
References claraty::N_2D_Array< T >::_elements, claraty::N_2D_Array< T >::_index, claraty::N_2D_Array< T >::_isSubarray, claraty::N_2D_Array< T >::_mem_width, and claraty::N_2D_Array< T >::_num_of_rows.
00535 { 00536 if (!_isSubarray) { // @@ This should throw an exception 00537 std::cerr << "N_2D_Array::displace_subarray requires *this to be a subarray!" 00538 << std::endl; 00539 return *this; 00540 } 00541 size_t offset = delta_y * _mem_width + delta_x; 00542 _elements += offset; 00543 for (int i = 0; i < _num_of_rows; i++) 00544 _index[i] += offset; 00545 return *this; 00546 }
| N_2D_Array< T > & claraty::N_2D_Array< T >::resize_subarray | ( | int | left, | |
| int | top, | |||
| int | width, | |||
| int | height | |||
| ) | [inherited] |
Definition at line 550 of file 2d_array.h.
References claraty::N_2D_Array< T >::_elements, claraty::N_2D_Array< T >::_index, claraty::N_2D_Array< T >::_init_index(), claraty::N_2D_Array< T >::_isSubarray, claraty::N_2D_Array< T >::_mem_base, claraty::N_2D_Array< T >::_mem_width, claraty::N_2D_Array< T >::_num_of_cols, and claraty::N_2D_Array< T >::_num_of_rows.
00552 { 00553 if (!_isSubarray) { // @@ This should throw an exception 00554 std::cerr << "N_2D_Array::resize_subarray requires *this to be a subarray!" 00555 << std::endl; 00556 return *this; 00557 } 00558 _num_of_cols = width; 00559 _elements = _mem_base + top * _mem_width + left; 00560 if (height == _num_of_rows) { 00561 // same number of rows - don't reallocate the _index 00562 _init_index(false); 00563 } else { 00564 _num_of_rows = height; 00565 delete [] _index; 00566 _init_index(); 00567 } 00568 return *this; 00569 }
Here is the call graph for this function:

| N_2D_Array< T > & claraty::N_2D_Array< T >::associate_subarray | ( | const N_2D_Array< T > & | parent, | |
| int | left, | |||
| int | top, | |||
| int | width, | |||
| int | height | |||
| ) | [inherited] |
Definition at line 573 of file 2d_array.h.
References claraty::N_2D_Array< T >::_elements, claraty::N_2D_Array< T >::_index, claraty::N_2D_Array< T >::_init_index(), claraty::N_2D_Array< T >::_isSubarray, claraty::N_2D_Array< T >::_mem_base, claraty::N_2D_Array< T >::_mem_height, claraty::N_2D_Array< T >::_mem_width, claraty::N_2D_Array< T >::_num_of_cols, claraty::N_2D_Array< T >::_num_of_rows, claraty::N_2D_Array< T >::_ref_count, and claraty::Reference_Count::increment().
00576 { 00577 if (_isSubarray || _elements != NULL || _index != NULL) { 00578 std::cerr << "N_2D_Array::associate_subarray: this function can only be used " 00579 "on uninitialized arrays" << std::endl; 00580 return *this; 00581 } 00582 delete _ref_count; 00583 _ref_count = parent._ref_count; 00584 _ref_count->increment(); 00585 _isSubarray = true; 00586 00587 _num_of_rows = height; 00588 _num_of_cols = width; 00589 _mem_width = parent._mem_width; 00590 _mem_height = parent._mem_height; 00591 _mem_base = parent._mem_base; 00592 _elements = parent._elements + top * _mem_width + left; 00593 _init_index(); 00594 return *this; 00595 }
Here is the call graph for this function:

| int claraty::N_2D_Array< T >::get_full_num_cols | ( | ) | const [inline, inherited] |
| int claraty::N_2D_Array< T >::get_full_num_rows | ( | ) | const [inline, inherited] |
| void claraty::N_2D_Array< T >::dissociate | ( | int | new_nrows = -1, |
|
| int | new_ncols = -1 | |||
| ) | [inline, inherited] |
Definition at line 251 of file 2d_array.h.
Referenced by claraty::N_2D_Array< T >::io().
00251 { 00252 int nrows = new_nrows, ncols = new_ncols; 00253 if(nrows < 0) { 00254 nrows = _num_of_rows; 00255 } 00256 if(ncols < 0) { 00257 ncols = _num_of_cols; 00258 } 00259 00260 if (_isSubarray) { 00261 _isSubarray = false; 00262 _num_of_rows = 0; // force re-allocation / compaction 00263 _num_of_cols = 0; 00264 } 00265 if (_ref_count->get_value() != 1) { 00266 _ref_count->decrement(); 00267 _mem_base = 0; // to prevent destruction of shared space on resize 00268 _num_of_rows = 0; // force re-allocation 00269 _num_of_cols = 0; 00270 _ref_count = new Reference_Count(1); // get an independent reference count 00271 } 00272 // Resize if necessary 00273 if((nrows != _num_of_rows) || (ncols != _num_of_cols)) { 00274 resize(nrows, ncols); 00275 } 00276 }
| N_2D_Array< T > claraty::N_2D_Array< T >::get_row | ( | int | row | ) | const [inherited] |
Definition at line 600 of file 2d_array.h.
References claraty::N_2D_Array< T >::_index, claraty::N_2D_Array< T >::_num_of_cols, and claraty::N_2D_Array< T >::_num_of_rows.
00601 { 00602 if (row < 0 || row > _num_of_rows) { 00603 std::cerr << "array error: row " << row << " exceeds matrix number of rows = " 00604 << _num_of_cols << std::endl; 00605 return N_2D_Array<T>(); 00606 } 00607 else 00608 return N_2D_Array<T>(1, _num_of_cols, _index[row]); 00609 }
| N_2D_Array< T > claraty::N_2D_Array< T >::get_col | ( | int | col | ) | const [inherited] |
Definition at line 613 of file 2d_array.h.
References claraty::N_2D_Array< T >::_num_of_cols, and claraty::N_2D_Array< T >::_num_of_rows.
00614 { 00615 if (col < 0 || col > _num_of_cols) { 00616 std::cerr << "array error: col " << col << " exceeds matrix number of columns = " 00617 << _num_of_cols << std::endl; 00618 return N_2D_Array<T>(); 00619 } 00620 else { 00621 N_2D_Array<T> col_array(_num_of_rows, 1); 00622 for (int row = 0; row < _num_of_rows; row++) 00623 col_array(row, 0) = operator()(row, col); 00624 return col_array; 00625 } 00626 }
| const T* claraty::N_2D_Array< T >::get_row_pointer | ( | int | row | ) | const [inline, inherited] |
Definition at line 283 of file 2d_array.h.
Referenced by claraty::operator *(), and claraty::Matrix< uint16_t >::row().
00283 { return _index[row]; }
| iterator claraty::N_2D_Array< T >::column_iterator | ( | int | col | ) | [inline, inherited] |
Definition at line 285 of file 2d_array.h.
Referenced by claraty::Matrix< uint16_t >::column(), and claraty::operator *().
00285 { 00286 return iterator(_elements + col, true, 1, _mem_width); 00287 }
| const_iterator claraty::N_2D_Array< T >::column_iterator | ( | int | col | ) | const [inline, inherited] |
Definition at line 288 of file 2d_array.h.
00288 { 00289 return const_iterator(_elements + col, true, 1, _mem_width); 00290 }
| T& claraty::N_2D_Array< T >::rc | ( | int | row, | |
| int | column | |||
| ) | [inline, inherited] |
Definition at line 301 of file 2d_array.h.
Referenced by claraty::N_2D_Array< T >::write().
00301 { return operator()(row, column); }
| const T& claraty::N_2D_Array< T >::rc | ( | int | row, | |
| int | column | |||
| ) | const [inline, inherited] |
| T& claraty::N_2D_Array< T >::xy | ( | int | x, | |
| int | y | |||
| ) | [inline, inherited] |
Definition at line 304 of file 2d_array.h.
Referenced by claraty::Image< T >::bilinear_xy_ret(), claraty::Image< T >::pixel(), and claraty::N_2D_Array< uint16_t >::xy().
00304 { return operator()(y, x); }
| const T& claraty::N_2D_Array< T >::xy | ( | int | x, | |
| int | y | |||
| ) | const [inline, inherited] |
| T& claraty::N_2D_Array< T >::xy | ( | const N_2D_Point_i & | p | ) | [inline, inherited] |
| const T& claraty::N_2D_Array< T >::xy | ( | const N_2D_Point_i & | p | ) | const [inline, inherited] |
| void claraty::N_2D_Array< T >::write | ( | std::ostream & | os | ) | const [inherited] |
Definition at line 697 of file 2d_array.h.
References claraty::N_2D_Array< T >::get_num_of_cols(), claraty::N_2D_Array< T >::get_num_of_rows(), and claraty::N_2D_Array< T >::rc().
00698 { 00699 std::ios::fmtflags oldBase; 00700 int oldPrecision; 00701 00702 os << "size: (" << get_num_of_rows() << ", " << get_num_of_cols() 00703 << " )" << std::endl; 00704 os.setf(std::ios::showpoint); 00705 00706 if (sizeof(T)==1) { 00707 oldBase = os.setf(std::ios::hex, std::ios::basefield); 00708 } 00709 else { 00710 oldPrecision = os.precision(); 00711 os.precision(4); 00712 } 00713 00714 if (get_num_of_cols() != 0) 00715 for (int i = 0; i < get_num_of_rows(); ++i) { 00716 os << "[ "; 00717 for (int j = 0; j < get_num_of_cols(); ++j) { 00718 const T& el = rc(i, j); 00719 os << " " << std::setw(8) << el; 00720 } 00721 os << " ]" << std::endl; 00722 } 00723 if (sizeof(T)==1) 00724 os.setf(oldBase, std::ios::basefield); 00725 else 00726 os.precision(oldPrecision); 00727 }
Here is the call graph for this function:

| claraty::N_2D_Array< T >::operator void * | ( | ) | const [inherited] |
Definition at line 630 of file 2d_array.h.
References claraty::N_2D_Array< T >::begin(), and claraty::N_2D_Array< T >::end().
00631 { 00632 // Bool operator but using void * instead to avoid direct conversion to int 00633 // so when you type 3*array, you do not get 3, rather you get a compile error 00634 00635 for (const_iterator it = begin(); it != end(); ++it) 00636 if (*it == 0) 00637 return (void *)false; 00638 return (void *)true; 00639 }
Here is the call graph for this function:

| N_2D_Array< T > claraty::N_2D_Array< T >::operator== | ( | const N_2D_Array< T > & | rhs | ) | const [inherited] |
Definition at line 678 of file 2d_array.h.
References claraty::N_2D_Array< T >::_check_size(), claraty::N_2D_Array< T >::_num_of_cols, claraty::N_2D_Array< T >::_num_of_rows, claraty::N_2D_Array< T >::begin(), claraty::N_2D_Array< T >::EQUALS, ERROR, claraty::N_2D_Array< T >::get_size(), and claraty::N_2D_Array< T >::N_2D_Array().
00679 { 00680 if (this == &rhs) return N_2D_Array(_num_of_rows, _num_of_cols, (T)true); 00681 00682 if (_check_size(EQUALS, rhs) == ERROR) { 00683 // MUST THROW AN EXCEPTION HERE, BUT FOR NOW 00684 return N_2D_Array(1, 1, (T)false); 00685 } 00686 00687 N_2D_Array result(_num_of_rows, _num_of_cols); 00688 const_iterator it_lhs = begin(), it_rhs = rhs.begin(); 00689 iterator it_res = result.begin(); 00690 for (int i = 0; i < get_size(); ++i, ++it_lhs, ++it_rhs, ++it_res) 00691 *it_res = (*it_lhs == *it_rhs); 00692 return result; 00693 }
Here is the call graph for this function:

| bool claraty::N_2D_Array< T >::io | ( | FDM_Map | map | ) | [inherited] |
Reimplemented in claraty::Camera_Image< Pixel_Type >, claraty::Camera_Image< float >, and claraty::Camera_Image< uint16_t >.
Definition at line 806 of file 2d_array.h.
References claraty::N_2D_Array< T >::_index, claraty::N_2D_Array< T >::dissociate(), claraty::FDM_Array::element(), claraty::FDM_Map::field(), claraty::FDM_Map::field_node(), claraty::FDM_Map::is_read(), claraty::N_2D_Array< T >::ncols(), and claraty::N_2D_Array< T >::nrows().
Referenced by claraty::io_object().
00807 { 00808 int nr = nrows(), nc = ncols(); 00809 00810 bool ok = true; 00811 00812 ok &= map.field("nrows", nr); 00813 ok &= map.field("ncols", nc); 00814 00815 // If we're reading, dissociate from any sharing and set to the new 00816 // size. If the memory isn't shared and the size hasn't changed, 00817 // this does nothing. 00818 if (map.is_read()) { 00819 dissociate(nr, nc); 00820 } 00821 00822 FDM_Array a = map.field_node("elements"); 00823 00824 for (int r = 0; r < nr; r++) 00825 for (int c = 0; c < nc; c++) 00826 ok &= a.element(_index[r][c]); 00827 00828 return ok; 00829 }
Here is the call graph for this function:

| T& claraty::N_2D_Array< T >::element | ( | int | i | ) | [inline, protected, inherited] |
Definition at line 331 of file 2d_array.h.
Referenced by claraty::N_1D_Array< T >::operator()(), and claraty::N_1D_Array< T >::operator[]().
00331 { return _elements[i]; }
| const T& claraty::N_2D_Array< T >::element | ( | int | i | ) | const [inline, protected, inherited] |
| T* claraty::N_2D_Array< T >::get_data | ( | ) | [inline, protected, inherited] |
Definition at line 336 of file 2d_array.h.
Referenced by claraty::Image< uint16_t >::get_raster(), claraty::Matrix< uint16_t >::operator vnl_matrix_ref(), and claraty::Matrix< uint16_t >::scalar_apply().
00336 { assert(!is_subarray()); return _mem_base; }
| const T* claraty::N_2D_Array< T >::get_data | ( | ) | const [inline, protected, inherited] |
| void claraty::N_2D_Array< T >::_copy | ( | In | start | ) | [protected, inherited] |
Definition at line 448 of file 2d_array.h.
References claraty::N_2D_Array< T >::_elements, claraty::N_2D_Array< T >::_num_of_cols, claraty::N_2D_Array< T >::_num_of_rows, claraty::N_2D_Array< T >::begin(), claraty::N_2D_Array< T >::end(), and claraty::N_2D_Array< T >::is_subarray().
Referenced by claraty::Matrix_NxM< T, Nrows, Ncols >::Matrix_NxM(), claraty::N_2D_Array< T >::N_2D_Array(), claraty::N_2D_Array< uint16_t >::N_2D_Array(), claraty::Matrix_NxM< T, Nrows, Ncols >::operator=(), claraty::Matrix< uint16_t >::operator=(), and claraty::N_2D_Array< T >::operator=().
00449 { 00450 if (is_subarray()) { 00451 iterator it = begin(), last = end(); 00452 for (; it != last; ++it, ++start) 00453 *it = (int)*start; // compiler warning *it is an int 00454 } else { 00455 T *it = _elements, *last = _elements + _num_of_rows * _num_of_cols; 00456 for (; it != last; ++it, ++start) 00457 *it = (int)*start; // compiler waring *it is an int 00458 } 00459 }
Here is the call graph for this function:

| void claraty::N_2D_Array< T >::_copy | ( | T | filler | ) | [protected, inherited] |
Definition at line 463 of file 2d_array.h.
References claraty::N_2D_Array< T >::begin(), and claraty::N_2D_Array< T >::end().
00464 { 00465 iterator it = begin(), last = end(); 00466 for (; it != last; ++it) 00467 *it = filler; 00468 }
Here is the call graph for this function:

| int claraty::N_2D_Array< T >::_check_size | ( | SIZE_TYPE | type, | |
| const N_2D_Array< rhsType > & | rhs | |||
| ) | const [protected, inherited] |
Definition at line 770 of file 2d_array.h.
References claraty::N_2D_Array< T >::_num_of_cols, claraty::N_2D_Array< T >::_num_of_rows, claraty::N_2D_Array< T >::EQUALS, ERROR, claraty::N_2D_Array< T >::get_num_of_cols(), claraty::N_2D_Array< T >::get_num_of_rows(), claraty::N_2D_Array< T >::NCOLS_EQUALS_NROWS, OK, and claraty::N_2D_Array< T >::SQUARE.
Referenced by claraty::Matrix_NxM< T, Nrows, Ncols >::Matrix_NxM(), claraty::Matrix< uint16_t >::operator+=(), claraty::Matrix< uint16_t >::operator-=(), and claraty::N_2D_Array< T >::operator==().
00772 { 00773 int status = ERROR; 00774 00775 switch (operation) { 00776 case EQUALS: 00777 status = ((_num_of_rows == rhs.get_num_of_rows()) && 00778 (_num_of_cols == rhs.get_num_of_cols())) ? OK : ERROR; 00779 break; 00780 case NCOLS_EQUALS_NROWS: 00781 status = (_num_of_cols == rhs.get_num_of_rows()) ? OK : ERROR; 00782 break; 00783 case SQUARE: 00784 status = (_num_of_rows == _num_of_cols) ? OK : ERROR; 00785 break; 00786 } // switch 00787 00788 if (status==ERROR) 00789 std::cerr << "Array 2D error: array dimensions do not match lhs(" << _num_of_rows 00790 << "x" << _num_of_cols << "), rhs (" << rhs.get_num_of_rows() << "x" 00791 << rhs.get_num_of_cols() << ")" << std::endl; 00792 00793 return status; 00794 }
Here is the call graph for this function:

| void claraty::N_2D_Array< T >::_init_special | ( | int | nr, | |
| int | nc, | |||
| T * | data, | |||
| int | memwidth | |||
| ) | [protected, inherited] |
Definition at line 387 of file 2d_array.h.
References claraty::N_2D_Array< T >::_elements, claraty::N_2D_Array< T >::_init_index(), claraty::N_2D_Array< T >::_mem_base, claraty::N_2D_Array< T >::_mem_width, claraty::N_2D_Array< T >::_num_of_cols, and claraty::N_2D_Array< T >::_num_of_rows.
Referenced by claraty::Matrix_NxM< T, Nrows, Ncols >::_init().
00388 { 00389 _num_of_rows = n_rows; 00390 _num_of_cols = n_cols; 00391 _mem_width = memwidth; 00392 00393 _elements = data; 00394 _mem_base = data; 00395 00396 _init_index(); 00397 }
Here is the call graph for this function:

| void claraty::N_2D_Array< T >::_drop_memory | ( | ) | [inline, protected, inherited] |
Definition at line 355 of file 2d_array.h.
Referenced by claraty::Matrix_NxM< T, Nrows, Ncols >::~Matrix_NxM().
| void claraty::N_2D_Array< T >::_init_index | ( | bool | allocate = true |
) | [protected, inherited] |
Definition at line 429 of file 2d_array.h.
References claraty::N_2D_Array< T >::_elements, claraty::N_2D_Array< T >::_index, claraty::N_2D_Array< T >::_mem_width, and claraty::N_2D_Array< T >::_num_of_rows.
Referenced by claraty::N_2D_Array< T >::_init(), claraty::N_2D_Array< T >::_init_special(), claraty::N_2D_Array< T >::associate_subarray(), claraty::N_2D_Array< T >::N_2D_Array(), claraty::N_2D_Array< uint16_t >::resize(), and claraty::N_2D_Array< T >::resize_subarray().
00430 { 00431 // Allocate memory for the row pointers. These are needed to address the 00432 // individual elements of the matrix using the index ** 00433 00434 typedef T* p_T; 00435 00436 if (allocate) 00437 _index = new p_T[_num_of_rows]; 00438 00439 // Initialize index vector that points to the beginning of every row 00440 int i; 00441 T *p_row; 00442 for (i = 0, p_row = _elements; i < _num_of_rows; i++, p_row += _mem_width) 00443 _index[i]= p_row; 00444 }
| bool claraty::N_2D_Array< T >::_is_noncontiguous | ( | ) | const [inline, protected, inherited] |
Definition at line 367 of file 2d_array.h.
Referenced by claraty::N_2D_Array< uint16_t >::begin(), and claraty::N_2D_Array< uint16_t >::end().
00367 { 00368 return _num_of_cols != _mem_width; 00369 }
Member Data Documentation
| T claraty::Matrix_NxM< T, Nrows, Ncols >::_data[Nrows][Ncols] |
Definition at line 47 of file matrix_nxm.h.
Referenced by claraty::Matrix_NxM< T, Nrows, Ncols >::_init(), claraty::Matrix_NxM< T, Nrows, Ncols >::Matrix_NxM(), claraty::Matrix_NxM< T, Nrows, Ncols >::operator()(), claraty::Matrix_NxM< T, Nrows, Ncols >::operator-(), and claraty::Matrix_NxM< T, Nrows, Ncols >::transpose_in_place().
int claraty::N_2D_Array< T >::_num_of_rows [protected, inherited] |
Definition at line 77 of file 2d_array.h.
Referenced by claraty::N_2D_Array< T >::_check_size(), claraty::N_2D_Array< T >::_copy(), claraty::N_2D_Array< T >::_init(), claraty::N_2D_Array< T >::_init_index(), claraty::N_2D_Array< T >::_init_special(), claraty::N_2D_Array< T >::associate_subarray(), claraty::N_2D_Array< T >::displace_subarray(), claraty::N_2D_Array< uint16_t >::dissociate(), claraty::N_2D_Array< uint16_t >::end(), claraty::N_2D_Array< T >::get_col(), claraty::N_2D_Array< uint16_t >::get_num_of_rows(), claraty::N_2D_Array< T >::get_row(), claraty::N_2D_Array< uint16_t >::get_size(), claraty::N_2D_Array< uint16_t >::is_square(), claraty::N_2D_Array< T >::N_2D_Array(), claraty::N_2D_Array< uint16_t >::nrows(), claraty::N_2D_Array< T >::operator==(), claraty::N_2D_Array< uint16_t >::resize(), claraty::N_2D_Array< T >::resize_subarray(), and claraty::N_2D_Array< T >::transpose().
int claraty::N_2D_Array< T >::_num_of_cols [protected, inherited] |
Definition at line 77 of file 2d_array.h.
Referenced by claraty::N_2D_Array< T >::_check_size(), claraty::N_2D_Array< T >::_copy(), claraty::N_2D_Array< T >::_init(), claraty::N_2D_Array< T >::_init_special(), claraty::N_2D_Array< uint16_t >::_is_noncontiguous(), claraty::N_2D_Array< T >::associate_subarray(), claraty::N_2D_Array< uint16_t >::begin(), claraty::N_2D_Array< uint16_t >::dissociate(), claraty::N_2D_Array< uint16_t >::end(), claraty::N_2D_Array< T >::get_col(), claraty::N_2D_Array< uint16_t >::get_num_of_cols(), claraty::N_2D_Array< T >::get_row(), claraty::N_2D_Array< uint16_t >::get_size(), claraty::N_2D_Array< uint16_t >::is_square(), claraty::N_2D_Array< T >::N_2D_Array(), claraty::N_2D_Array< uint16_t >::ncols(), claraty::N_2D_Array< T >::operator==(), claraty::N_2D_Array< uint16_t >::resize(), claraty::N_2D_Array< T >::resize_subarray(), claraty::N_2D_Array< T >::set_diagonal(), and claraty::N_2D_Array< T >::transpose().
int claraty::N_2D_Array< T >::_mem_width [protected, inherited] |
Definition at line 77 of file 2d_array.h.
Referenced by claraty::N_2D_Array< T >::_init(), claraty::N_2D_Array< T >::_init_index(), claraty::N_2D_Array< T >::_init_special(), claraty::N_2D_Array< uint16_t >::_is_noncontiguous(), claraty::N_2D_Array< T >::associate_subarray(), claraty::N_2D_Array< uint16_t >::begin(), claraty::N_2D_Array< uint16_t >::column_iterator(), claraty::N_2D_Array< T >::displace_subarray(), claraty::N_2D_Array< uint16_t >::end(), claraty::N_2D_Array< uint16_t >::get_full_num_cols(), claraty::N_2D_Array< T >::N_2D_Array(), claraty::N_2D_Array< uint16_t >::resize(), and claraty::N_2D_Array< T >::resize_subarray().
int claraty::N_2D_Array< T >::_mem_height [protected, inherited] |
Definition at line 77 of file 2d_array.h.
Referenced by claraty::N_2D_Array< T >::_init(), claraty::N_2D_Array< T >::associate_subarray(), claraty::N_2D_Array< uint16_t >::get_full_num_rows(), and claraty::N_2D_Array< uint16_t >::resize().
T* claraty::N_2D_Array< T >::_elements [protected, inherited] |
Definition at line 79 of file 2d_array.h.
Referenced by claraty::N_2D_Array< T >::_copy(), claraty::N_2D_Array< uint16_t >::_drop_memory(), claraty::N_2D_Array< T >::_init(), claraty::N_2D_Array< T >::_init_index(), claraty::N_2D_Array< T >::_init_special(), claraty::N_2D_Array< T >::associate_subarray(), claraty::N_2D_Array< uint16_t >::begin(), claraty::N_2D_Array< uint16_t >::column_iterator(), claraty::N_2D_Array< T >::displace_subarray(), claraty::N_2D_Array< uint16_t >::element(), claraty::N_2D_Array< uint16_t >::end(), claraty::N_2D_Array< T >::N_2D_Array(), and claraty::N_2D_Array< T >::resize_subarray().
T** claraty::N_2D_Array< T >::_index [protected, inherited] |
Definition at line 80 of file 2d_array.h.
Referenced by claraty::N_2D_Array< T >::_init(), claraty::N_2D_Array< T >::_init_index(), claraty::N_2D_Array< T >::associate_subarray(), claraty::N_2D_Array< T >::displace_subarray(), claraty::N_2D_Array< T >::get_row(), claraty::N_2D_Array< uint16_t >::get_row_pointer(), claraty::N_2D_Array< T >::io(), claraty::N_2D_Array< uint16_t >::operator()(), claraty::N_2D_Array< uint16_t >::resize(), claraty::N_2D_Array< T >::resize_subarray(), and claraty::N_2D_Array< uint16_t >::~N_2D_Array().
T* claraty::N_2D_Array< T >::_mem_base [protected, inherited] |
Definition at line 82 of file 2d_array.h.
Referenced by claraty::N_2D_Array< uint16_t >::_drop_memory(), claraty::N_2D_Array< T >::_init(), claraty::N_2D_Array< T >::_init_special(), claraty::N_2D_Array< T >::associate_subarray(), claraty::N_2D_Array< uint16_t >::dissociate(), claraty::N_2D_Array< uint16_t >::get_data(), claraty::N_2D_Array< uint16_t >::resize(), claraty::N_2D_Array< T >::resize_subarray(), and claraty::N_2D_Array< uint16_t >::~N_2D_Array().
Reference_Count* claraty::N_2D_Array< T >::_ref_count [protected, inherited] |
Definition at line 83 of file 2d_array.h.
Referenced by claraty::N_2D_Array< T >::associate_subarray(), claraty::N_2D_Array< uint16_t >::dissociate(), claraty::N_2D_Array< T >::N_2D_Array(), claraty::N_2D_Array< uint16_t >::N_2D_Array(), claraty::N_2D_Array< uint16_t >::resize(), and claraty::N_2D_Array< uint16_t >::~N_2D_Array().
bool claraty::N_2D_Array< T >::_isSubarray [protected, inherited] |
Definition at line 85 of file 2d_array.h.
Referenced by claraty::N_2D_Array< T >::_init(), claraty::N_2D_Array< T >::associate_subarray(), claraty::N_2D_Array< T >::displace_subarray(), claraty::N_2D_Array< uint16_t >::dissociate(), claraty::N_2D_Array< uint16_t >::is_subarray(), claraty::N_2D_Array< T >::N_2D_Array(), claraty::N_2D_Array< uint16_t >::N_2D_Array(), claraty::N_2D_Array< uint16_t >::resize(), and claraty::N_2D_Array< T >::resize_subarray().
The documentation for this class was generated from the following file: