annotate armadillo-2.4.4/include/armadillo_bits/subview_bones.hpp @ 18:8d046a9d36aa slimline

Back out rev 13:ac07c60aa798. Like an idiot, I committed a whole pile of unrelated changes in the guise of a single typo fix. Will re-commit in stages
author Chris Cannam
date Thu, 10 May 2012 10:45:44 +0100
parents 8b6102e2a9b0
children
rev   line source
max@0 1 // Copyright (C) 2008-2011 NICTA (www.nicta.com.au)
max@0 2 // Copyright (C) 2008-2011 Conrad Sanderson
max@0 3 // Copyright (C) 2011 James Sanders
max@0 4 //
max@0 5 // This file is part of the Armadillo C++ library.
max@0 6 // It is provided without any warranty of fitness
max@0 7 // for any purpose. You can redistribute this file
max@0 8 // and/or modify it under the terms of the GNU
max@0 9 // Lesser General Public License (LGPL) as published
max@0 10 // by the Free Software Foundation, either version 3
max@0 11 // of the License or (at your option) any later version.
max@0 12 // (see http://www.opensource.org/licenses for more info)
max@0 13
max@0 14
max@0 15 //! \addtogroup subview
max@0 16 //! @{
max@0 17
max@0 18
max@0 19 //! Class for storing data required to construct or apply operations to a submatrix
max@0 20 //! (i.e. where the submatrix starts and ends as well as a reference/pointer to the original matrix),
max@0 21 template<typename eT>
max@0 22 class subview : public Base<eT, subview<eT> >
max@0 23 {
max@0 24 public: arma_aligned const Mat<eT>& m;
max@0 25 protected: arma_aligned Mat<eT>* m_ptr;
max@0 26
max@0 27 public:
max@0 28
max@0 29 typedef eT elem_type;
max@0 30 typedef typename get_pod_type<elem_type>::result pod_type;
max@0 31
max@0 32 const uword aux_row1;
max@0 33 const uword aux_col1;
max@0 34
max@0 35 const uword n_rows;
max@0 36 const uword n_cols;
max@0 37 const uword n_elem;
max@0 38
max@0 39
max@0 40 protected:
max@0 41
max@0 42 arma_inline subview(const Mat<eT>& in_m, const uword in_row1, const uword in_col1, const uword in_n_rows, const uword in_n_cols);
max@0 43 arma_inline subview( Mat<eT>& in_m, const uword in_row1, const uword in_col1, const uword in_n_rows, const uword in_n_cols);
max@0 44
max@0 45
max@0 46 public:
max@0 47
max@0 48 inline ~subview();
max@0 49
max@0 50 inline void operator+= (const eT val);
max@0 51 inline void operator-= (const eT val);
max@0 52 inline void operator*= (const eT val);
max@0 53 inline void operator/= (const eT val);
max@0 54
max@0 55 // deliberately returning void
max@0 56 template<typename T1> inline void operator= (const Base<eT,T1>& x);
max@0 57 template<typename T1> inline void operator+= (const Base<eT,T1>& x);
max@0 58 template<typename T1> inline void operator-= (const Base<eT,T1>& x);
max@0 59 template<typename T1> inline void operator%= (const Base<eT,T1>& x);
max@0 60 template<typename T1> inline void operator/= (const Base<eT,T1>& x);
max@0 61
max@0 62 inline void operator= (const subview& x);
max@0 63 inline void operator+= (const subview& x);
max@0 64 inline void operator-= (const subview& x);
max@0 65 inline void operator%= (const subview& x);
max@0 66 inline void operator/= (const subview& x);
max@0 67
max@0 68 inline static void extract(Mat<eT>& out, const subview& in);
max@0 69
max@0 70 inline static void plus_inplace(Mat<eT>& out, const subview& in);
max@0 71 inline static void minus_inplace(Mat<eT>& out, const subview& in);
max@0 72 inline static void schur_inplace(Mat<eT>& out, const subview& in);
max@0 73 inline static void div_inplace(Mat<eT>& out, const subview& in);
max@0 74
max@0 75 inline void fill(const eT val);
max@0 76 inline void zeros();
max@0 77 inline void ones();
max@0 78 inline void eye();
max@0 79
max@0 80 inline eT& operator[](const uword i);
max@0 81 inline eT operator[](const uword i) const;
max@0 82
max@0 83 inline eT& operator()(const uword i);
max@0 84 inline eT operator()(const uword i) const;
max@0 85
max@0 86 inline eT& operator()(const uword in_row, const uword in_col);
max@0 87 inline eT operator()(const uword in_row, const uword in_col) const;
max@0 88
max@0 89 inline eT& at(const uword in_row, const uword in_col);
max@0 90 inline eT at(const uword in_row, const uword in_col) const;
max@0 91
max@0 92 arma_inline eT* colptr(const uword in_col);
max@0 93 arma_inline const eT* colptr(const uword in_col) const;
max@0 94
max@0 95 inline bool check_overlap(const subview& x) const;
max@0 96
max@0 97 inline bool is_vec() const;
max@0 98
max@0 99 inline subview_row<eT> row(const uword row_num);
max@0 100 inline const subview_row<eT> row(const uword row_num) const;
max@0 101
max@0 102 inline subview_row<eT> operator()(const uword row_num, const span& col_span);
max@0 103 inline const subview_row<eT> operator()(const uword row_num, const span& col_span) const;
max@0 104
max@0 105 inline subview_col<eT> col(const uword col_num);
max@0 106 inline const subview_col<eT> col(const uword col_num) const;
max@0 107
max@0 108 inline subview_col<eT> operator()(const span& row_span, const uword col_num);
max@0 109 inline const subview_col<eT> operator()(const span& row_span, const uword col_num) const;
max@0 110
max@0 111 inline Col<eT> unsafe_col(const uword col_num);
max@0 112 inline const Col<eT> unsafe_col(const uword col_num) const;
max@0 113
max@0 114 inline subview<eT> rows(const uword in_row1, const uword in_row2);
max@0 115 inline const subview<eT> rows(const uword in_row1, const uword in_row2) const;
max@0 116
max@0 117 inline subview<eT> cols(const uword in_col1, const uword in_col2);
max@0 118 inline const subview<eT> cols(const uword in_col1, const uword in_col2) const;
max@0 119
max@0 120 inline subview<eT> submat(const uword in_row1, const uword in_col1, const uword in_row2, const uword in_col2);
max@0 121 inline const subview<eT> submat(const uword in_row1, const uword in_col1, const uword in_row2, const uword in_col2) const;
max@0 122
max@0 123 inline subview<eT> submat (const span& row_span, const span& col_span);
max@0 124 inline const subview<eT> submat (const span& row_span, const span& col_span) const;
max@0 125
max@0 126 inline subview<eT> operator()(const span& row_span, const span& col_span);
max@0 127 inline const subview<eT> operator()(const span& row_span, const span& col_span) const;
max@0 128
max@0 129 inline diagview<eT> diag(const sword in_id = 0);
max@0 130 inline const diagview<eT> diag(const sword in_id = 0) const;
max@0 131
max@0 132 inline void swap_rows(const uword in_row1, const uword in_row2);
max@0 133 inline void swap_cols(const uword in_col1, const uword in_col2);
max@0 134
max@0 135
max@0 136 // // primitive forward iterator
max@0 137 // class iter
max@0 138 // {
max@0 139 // public:
max@0 140 //
max@0 141 // inline iter(const subview<eT>& in_M);
max@0 142 //
max@0 143 // arma_inline eT operator* () const;
max@0 144 //
max@0 145 // inline void operator++();
max@0 146 // inline void operator++(int);
max@0 147 //
max@0 148 //
max@0 149 // private:
max@0 150 //
max@0 151 // arma_aligned const eT* mem;
max@0 152 //
max@0 153 // arma_aligned uword n_rows;
max@0 154 //
max@0 155 // arma_aligned uword row_start;
max@0 156 // arma_aligned uword row_end_p1;
max@0 157 //
max@0 158 // arma_aligned uword row;
max@0 159 // arma_aligned uword col;
max@0 160 // arma_aligned uword i;
max@0 161 // };
max@0 162
max@0 163
max@0 164 private:
max@0 165
max@0 166 friend class Mat<eT>;
max@0 167 subview();
max@0 168 };
max@0 169
max@0 170
max@0 171
max@0 172 template<typename eT>
max@0 173 class subview_col : public subview<eT>
max@0 174 {
max@0 175 public:
max@0 176
max@0 177 typedef eT elem_type;
max@0 178 typedef typename get_pod_type<elem_type>::result pod_type;
max@0 179
max@0 180 inline void operator= (const subview<eT>& x);
max@0 181 inline void operator= (const subview_col& x);
max@0 182
max@0 183 template<typename T1>
max@0 184 inline void operator= (const Base<eT,T1>& x);
max@0 185
max@0 186 inline subview_col<eT> rows(const uword in_row1, const uword in_row2);
max@0 187 inline const subview_col<eT> rows(const uword in_row1, const uword in_row2) const;
max@0 188
max@0 189 inline subview_col<eT> subvec(const uword in_row1, const uword in_row2);
max@0 190 inline const subview_col<eT> subvec(const uword in_row1, const uword in_row2) const;
max@0 191
max@0 192
max@0 193 protected:
max@0 194
max@0 195 inline subview_col(const Mat<eT>& in_m, const uword in_col);
max@0 196 inline subview_col( Mat<eT>& in_m, const uword in_col);
max@0 197
max@0 198 inline subview_col(const Mat<eT>& in_m, const uword in_col, const uword in_row1, const uword in_n_rows);
max@0 199 inline subview_col( Mat<eT>& in_m, const uword in_col, const uword in_row1, const uword in_n_rows);
max@0 200
max@0 201
max@0 202 private:
max@0 203
max@0 204 friend class Mat<eT>;
max@0 205 friend class Col<eT>;
max@0 206 friend class subview<eT>;
max@0 207
max@0 208 subview_col();
max@0 209 };
max@0 210
max@0 211
max@0 212
max@0 213 template<typename eT>
max@0 214 class subview_row : public subview<eT>
max@0 215 {
max@0 216 public:
max@0 217
max@0 218 typedef eT elem_type;
max@0 219 typedef typename get_pod_type<elem_type>::result pod_type;
max@0 220
max@0 221 inline void operator= (const subview<eT>& x);
max@0 222 inline void operator= (const subview_row& x);
max@0 223
max@0 224 template<typename T1>
max@0 225 inline void operator= (const Base<eT,T1>& x);
max@0 226
max@0 227 inline subview_row<eT> cols(const uword in_col1, const uword in_col2);
max@0 228 inline const subview_row<eT> cols(const uword in_col1, const uword in_col2) const;
max@0 229
max@0 230 inline subview_row<eT> subvec(const uword in_col1, const uword in_col2);
max@0 231 inline const subview_row<eT> subvec(const uword in_col1, const uword in_col2) const;
max@0 232
max@0 233
max@0 234 protected:
max@0 235
max@0 236 inline subview_row(const Mat<eT>& in_m, const uword in_row);
max@0 237 inline subview_row( Mat<eT>& in_m, const uword in_row);
max@0 238
max@0 239 inline subview_row(const Mat<eT>& in_m, const uword in_row, const uword in_col1, const uword in_n_cols);
max@0 240 inline subview_row( Mat<eT>& in_m, const uword in_row, const uword in_col1, const uword in_n_cols);
max@0 241
max@0 242
max@0 243 private:
max@0 244
max@0 245 friend class Mat<eT>;
max@0 246 friend class Row<eT>;
max@0 247 friend class subview<eT>;
max@0 248
max@0 249 subview_row();
max@0 250 };
max@0 251
max@0 252
max@0 253
max@0 254 //! @}