KJB
|
#include <m_mat_view.h>
Public Types | |
typedef Generic_matrix_view | Self |
typedef Matrix_type::Value_type | Value_type |
typedef Matrix_type::Vec_type | Vec_type |
typedef int | Size_type |
Public Member Functions | |
Generic_matrix_view (Matrix_type &mat, const Index_range &row_indices, const Index_range &col_indices) | |
Generic_matrix_view (Matrix_type &mat) | |
Generic_matrix_view (const Generic_matrix_view &src) | |
bool | operator== (const Self &other) |
bool | operator== (const Matrix_type &other) |
bool | operator!= (const Self &other) |
bool | operator!= (const Matrix_type &other) |
Value_type & | operator() (int r, int c) |
Value_type | operator() (int r, int c) const |
Value_type & | operator() (int i) |
Value_type | operator() (int i) const |
Value_type & | operator[] (int i) |
Value_type | operator[] (int i) const |
Size_type | get_num_rows () const |
Size_type | get_num_cols () const |
Self & | operator= (const Matrix_type &mat) |
Self & | operator= (const Self &mat) |
Self & | operator= (const Value_type &s) |
Self & | operator= (const Vec_type &v) |
Self & | operator= (const std::vector< double > &v) |
Self & | operator= (const std::vector< float > &v) |
Self & | operator*= (Value_type s) |
Self & | operator/= (Value_type s) |
Self & | operator+= (const Self &s) |
Self & | operator+= (const Matrix_type &s) |
Self & | operator-= (const Self &s) |
Self & | operator-= (const Matrix_type &s) |
Protected Member Functions | |
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. More... | |
template<class Generic_matrix > | |
bool | equality (const Generic_matrix &mat) |
template<class Generic_matrix > | |
Self & | assign (const Generic_matrix &mat) |
template<class T > | |
Self & | assign_from_vector (const T &v) |
template<class Generic_matrix > | |
Self & | plus_equals (const Generic_matrix &mat) |
template<class Generic_matrix > | |
Self & | minus_equals (const Generic_matrix &mat) |
Protected Attributes | |
Index_range | row_indices_ |
Index_range | col_indices_ |
Matrix_type & | mat_ |
Represents a filtered "view" of another matrix. This object has the same semantics as a real Matrix, but altering it will alter the "visible" elements of the underlying matrix. Here's an example
Matrix mat = create_identity_matrix(); Matrix_view mat_view = mat(_,3); mat_view *= -1; assert(mat(2,2) == -1);
This may seem like a roundabout way of doing it, but when we put it all on one line, the power of this approach becomes obvous:
mat(_,3) *= -1;
Eventually, we would like to support matlab-like syntax using strings:
mat("2:8", 3) *= -1;
typedef Generic_matrix_view kjb::Generic_matrix_view< Matrix_type >::Self |
typedef int kjb::Generic_matrix_view< Matrix_type >::Size_type |
typedef Matrix_type::Value_type kjb::Generic_matrix_view< Matrix_type >::Value_type |
typedef Matrix_type::Vec_type kjb::Generic_matrix_view< Matrix_type >::Vec_type |
|
inline |
|
inline |
|
inline |
|
inlineprotected |
generic version of operator=(). Made private to avoid unwanted template instantiation.
|
inlineprotected |
generic version of operator=(). Made private to avoid unwanted template instantiation.
|
inlineprotected |
This quickly computes row and column indices, assuming the Matrix has at least one column.
This routine is used for the one-dimensional (row-major) addressing of the matrix WITHOUT bounds checking – for which speed is a priority.
[in] | index | Row-major index of some matrix element |
[out] | row | Ptr to where to store its computed row index |
[out] | col | Ptr to where to store its computed column index |
|
inlineprotected |
generic version of operator=(). Made private to avoid unwanted template instantiation.
|
inline |
|
inline |
|
inlineprotected |
generic version of operator-=(). Made private to avoid unwanted template instantiation
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Set all elements to s
|
inline |
If this object has only 1 column or 1 row, set it equal to v or v', respectively.
|
inline |
If this object has only 1 column or 1 row, set it equal to v or v', respectively.
|
inline |
If this object has only 1 column or 1 row, set it equal to v or v', respectively.
|
inline |
|
inline |
|
inline |
|
inline |
|
inlineprotected |
generic version of operator+=. Made private to avoid unwanted template instantiation
|
protected |
|
protected |
|
protected |