20 #ifndef KJB_M_CPP_MAT_VIEW
21 #define KJB_M_CPP_MAT_VIEW
54 template <
class Matrix_type>
60 typedef typename Matrix_type::Vec_type
Vec_type;
118 return mat_.at(row, col);
128 return mat_.at(row,col);
176 return assign(Matrix_type(mat));
189 return assign(Matrix_type(mat));
202 for(
int row = 0; row < NUM_ROWS; row++)
203 for(
int col = 0; col < NUM_COLS; col++)
254 for(
int row = 0; row < NUM_ROWS; row++)
255 for(
int col = 0; col < NUM_COLS; col++)
256 operator()(row, col) *= s;
272 for(
int row = 0; row < NUM_ROWS; row++)
273 for(
int col = 0; col < NUM_COLS; col++)
274 operator()(row, col) /= s;
342 template <
class Generic_matrix>
347 if(mat.get_num_rows() != NUM_ROWS ||
348 mat.get_num_cols() != NUM_COLS )
357 if(
operator()(row, col) != mat(row, col))
371 template <
class Generic_matrix>
376 if(mat.get_num_rows() != NUM_ROWS ||
377 mat.get_num_cols() != NUM_COLS )
400 bool transpose =
false;
417 if(v.size() != NUM_ROWS)
424 if(v.size() != NUM_COLS)
430 for(
int i = 0;
i < v.size();
i++)
450 template <
class Generic_matrix>
455 if(NUM_ROWS != mat.get_num_rows() ||
456 NUM_COLS != mat.get_num_cols())
461 for(
int row = 0; row < NUM_ROWS; row++)
463 for(
int col = 0; col < NUM_COLS; col++)
478 template <
class Generic_matrix>
483 if(NUM_ROWS != mat.get_num_rows() ||
484 NUM_COLS != mat.get_num_cols())
489 for(
int row = 0; row < NUM_ROWS; row++)
491 for(
int col = 0; col < NUM_COLS; col++)
510 template <
class Matrix_type>
Size_type get_num_rows() const
Definition: m_mat_view.h:156
Self & operator-=(const Self &s)
Definition: m_mat_view.h:296
Value_type & operator()(int r, int c)
Definition: m_mat_view.h:114
Self & operator=(const Self &mat)
Definition: m_mat_view.h:182
int Size_type
Definition: m_mat_view.h:61
Generic_matrix_view(Matrix_type &mat)
Definition: m_mat_view.h:73
Object thrown when an argument is of the wrong size or dimensions.
Definition: l_exception.h:426
Self & minus_equals(const Generic_matrix &mat)
Definition: m_mat_view.h:479
Matrix_type & mat_
Definition: m_mat_view.h:504
Value_type & operator[](int i)
Definition: m_mat_view.h:146
size_t size() const
Definition: l_index.h:273
Size_type get_num_cols() const
Definition: m_mat_view.h:163
Definition: m_mat_view.h:511
r
Definition: APPgetLargeConnectedEdges.m:127
#define KJB_THROW(ex)
Definition: l_exception.h:46
bool all() const
Definition: l_index.h:290
Index_range col_indices_
Definition: m_mat_view.h:503
Matrix_type::Value_type Value_type
Definition: m_mat_view.h:59
Self & operator=(const Vec_type &v)
Definition: m_mat_view.h:214
bool operator!=(const Self &other)
Definition: m_mat_view.h:101
Value_type operator()(int r, int c) const
Definition: m_mat_view.h:124
Definition: m_mat_view.h:55
void compute_row_col(int index, int *row, int *col) const
This quickly computes row and column indices, assuming the Matrix has at least one column...
Definition: m_mat_view.h:327
Self & operator=(const Matrix_type &mat)
Definition: m_mat_view.h:170
Value_type operator[](int i) const
Definition: m_mat_view.h:151
Index_range row_indices_
Definition: m_mat_view.h:502
const Generic_matrix_view< const Matrix_type > Type
Definition: m_mat_view.h:513
Self & assign_from_vector(const T &v)
Definition: m_mat_view.h:398
bool operator!=(const Matrix_type &other)
Definition: m_mat_view.h:106
Self & operator=(const std::vector< double > &v)
Definition: m_mat_view.h:223
Matrix_type::Vec_type Vec_type
Definition: m_mat_view.h:60
Value_type & operator()(int i)
Definition: m_mat_view.h:131
Self & operator+=(const Matrix_type &s)
Definition: m_mat_view.h:291
bool operator==(const Self &other)
Definition: m_mat_view.h:91
Generic_matrix_view(Matrix_type &mat, const Index_range &row_indices, const Index_range &col_indices)
Definition: m_mat_view.h:63
Value_type operator()(int i) const
Definition: m_mat_view.h:138
Self & operator-=(const Matrix_type &s)
Definition: m_mat_view.h:308
get the indices of edges in each direction for i
Definition: APPgetLargeConnectedEdges.m:48
bool equality(const Generic_matrix &mat)
Definition: m_mat_view.h:343
Generic_matrix_view Self
Definition: m_mat_view.h:58
Generic_matrix_view(const Generic_matrix_view &src)
Definition: m_mat_view.h:80
Support for error handling exception classes in libKJB.
bool operator==(const Matrix_type &other)
Definition: m_mat_view.h:96
Self & operator=(const Value_type &s)
Definition: m_mat_view.h:197
Self & operator/=(Value_type s)
Definition: m_mat_view.h:268
Self & operator=(const std::vector< float > &v)
Definition: m_mat_view.h:232
Self & operator+=(const Self &s)
Definition: m_mat_view.h:279
Self & plus_equals(const Generic_matrix &mat)
Definition: m_mat_view.h:451
Self & operator*=(Value_type s)
Definition: m_mat_view.h:250
Self & assign(const Generic_matrix &mat)
Definition: m_mat_view.h:372