33 #ifndef SCALAR_SUBMATRIX_ADAPTER_HH_
34 #define SCALAR_SUBMATRIX_ADAPTER_HH_
52 template<
class AT,
class ST,
int R,
int C>
63 : m_src(mat), m_const(mat) {};
67 {
return m_src.resize_and_clear(newRows, newCols);}
70 {
return m_src.resize_and_keep_values(newRows, newCols);}
75 return BlockRef(m_src(r, c), m_subr, m_subc);
79 return BlockRef(m_src(r, c), m_subr, m_subc);
84 {
return m_src.num_rows(); }
88 {
return m_src.num_cols(); }
91 {
return m_src.is_isolated(i); }
93 bool scale(
double d) {
return m_src.scale(d);}
98 {
return m_src.total_num_connections(); }
101 void print(
const char *text)
const {m_src.print(text);}
104 void printrow(
size_t row)
const {m_src.printrow(row);}
109 typename encapsulated_matrix_type::row_iterator
iter;
111 inline void check()
const {iter.check(); }
118 void operator += (
int nr) { iter+=nr; }
120 size_t index()
const {
return iter.index(); }
126 typename encapsulated_matrix_type::const_row_iterator
iter;
128 inline void check()
const {iter.check(); }
135 void operator += (
int nr) { iter+=nr; }
137 size_t index()
const {
return iter.index(); }
154 {
return m_src.has_connection(r,c); }
157 {
return row_iterator(m_src.get_iterator_or_next(r,c));}
169 {m_src.defragment();}
176 const static int m_subr=R;
177 const static int m_subc=C;
Definition: scalar_submatrix_adapter.hh:125
const_row_iterator(typename encapsulated_matrix_type::const_row_iterator _iter)
Definition: scalar_submatrix_adapter.hh:129
void check() const
Definition: scalar_submatrix_adapter.hh:128
size_t index() const
Definition: scalar_submatrix_adapter.hh:137
const value_type & value() const
Definition: scalar_submatrix_adapter.hh:138
encapsulated_matrix_type::const_row_iterator iter
Definition: scalar_submatrix_adapter.hh:126
~const_row_iterator()
Definition: scalar_submatrix_adapter.hh:131
Definition: scalar_submatrix_adapter.hh:108
void check() const
Definition: scalar_submatrix_adapter.hh:111
size_t index() const
Definition: scalar_submatrix_adapter.hh:120
encapsulated_matrix_type::row_iterator iter
Definition: scalar_submatrix_adapter.hh:109
value_type & value()
Definition: scalar_submatrix_adapter.hh:121
row_iterator(typename encapsulated_matrix_type::row_iterator _iter)
Definition: scalar_submatrix_adapter.hh:112
~row_iterator()
Definition: scalar_submatrix_adapter.hh:114
Definition: scalar_submatrix_adapter.hh:53
const_row_iterator get_connection(size_t r, size_t c, bool &bFound) const
Definition: scalar_submatrix_adapter.hh:159
const_row_iterator get_connection(size_t r, size_t c) const
Definition: scalar_submatrix_adapter.hh:162
AT::matrix_type encapsulated_matrix_type
Definition: scalar_submatrix_adapter.hh:57
size_t num_rows() const
returns number of rows
Definition: scalar_submatrix_adapter.hh:83
const encapsulated_matrix_type & m_const
Definition: scalar_submatrix_adapter.hh:175
size_t num_cols() const
returns the number of cols
Definition: scalar_submatrix_adapter.hh:87
void printrow(size_t row) const
print (block) row of (underlying) matrix
Definition: scalar_submatrix_adapter.hh:104
row_iterator get_iterator_or_next(size_t r, size_t c)
Definition: scalar_submatrix_adapter.hh:156
bool has_connection(size_t r, size_t c) const
Definition: scalar_submatrix_adapter.hh:153
void print(const char *text) const
print (underlying) matrix
Definition: scalar_submatrix_adapter.hh:101
size_t total_num_connections() const
returns the total number of connections
Definition: scalar_submatrix_adapter.hh:97
encapsulated_matrix_type & m_src
Definition: scalar_submatrix_adapter.hh:174
row_iterator end_row(size_t r)
Definition: scalar_submatrix_adapter.hh:144
ST::matrix_type::value_type value_type
Definition: scalar_submatrix_adapter.hh:58
row_iterator get_connection(size_t r, size_t c)
Definition: scalar_submatrix_adapter.hh:165
ScalarSubMatrixAdapter(encapsulated_matrix_type &mat)
Definition: scalar_submatrix_adapter.hh:62
const_row_iterator end_row(size_t r) const
Definition: scalar_submatrix_adapter.hh:149
const_row_iterator begin_row(size_t r) const
Definition: scalar_submatrix_adapter.hh:147
row_iterator begin_row(size_t r)
Definition: scalar_submatrix_adapter.hh:142
bool resize_and_clear(size_t newRows, size_t newCols)
Definition: scalar_submatrix_adapter.hh:66
bool resize_and_keep_values(size_t newRows, size_t newCols)
Definition: scalar_submatrix_adapter.hh:69
bool scale(double d)
Definition: scalar_submatrix_adapter.hh:93
void defragment()
Definition: scalar_submatrix_adapter.hh:168
bool is_isolated(size_t i) const
Definition: scalar_submatrix_adapter.hh:90
bool operator==(const MathVector< N, T > &v, const MathVector< N, T > &w)
Definition: math_vector.h:523
bool operator!=(const MathVector< N, T > &v, const MathVector< N, T > &w)
Definition: math_vector.h:552
double & BlockRef(T &vec, size_t i)
Definition: blocks.h:66
ReferenceObjectID operator++(ReferenceObjectID &roid, int)
Definition: grid_base_objects.h:89
T value_type
Definition: sparsematrix_interface.h:2
value_type & operator()(size_t r, size_t c)