Changeset 1066 for trunk/yat/classifier
- Timestamp:
- Feb 10, 2008, 11:48:19 PM (15 years ago)
- Location:
- trunk/yat/classifier
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/yat/classifier/KernelLookup.cc
r1000 r1066 117 117 118 118 119 KernelLookup::const_iterator KernelLookup::begin(void) const 120 { 121 return const_iterator(const_iterator::iterator_type(*this, 0, 0), 1); 122 } 123 124 125 KernelLookup::const_iterator KernelLookup::begin_column(size_t i) const 126 { 127 return const_iterator(const_iterator::iterator_type(*this, 0, i), columns()); 128 } 129 130 131 KernelLookup::const_iterator KernelLookup::begin_row(size_t i) const 132 { 133 return const_iterator(const_iterator::iterator_type(*this, i, 0), 1); 134 } 135 136 119 137 const DataLookup2D* KernelLookup::data(void) const 120 138 { … … 132 150 { 133 151 return kernel_->element(vec, row_index_[i]); 152 } 153 154 155 KernelLookup::const_iterator KernelLookup::end(void) const 156 { 157 return const_iterator(const_iterator::iterator_type(*this, rows(), 0), 1); 158 } 159 160 161 KernelLookup::const_iterator KernelLookup::end_column(size_t i) const 162 { 163 return const_iterator(const_iterator::iterator_type(*this, this->rows(), i), 164 this->columns()); 165 } 166 167 168 KernelLookup::const_iterator KernelLookup::end_row(size_t i) const 169 { 170 return const_iterator(const_iterator::iterator_type(*this, i+1, 0), 1); 134 171 } 135 172 -
trunk/yat/classifier/KernelLookup.h
r1000 r1066 7 7 Copyright (C) 2005 Jari Häkkinen, Peter Johansson 8 8 Copyright (C) 2006 Jari Häkkinen, Markus Ringnér, Peter Johansson 9 Copyright (C) 2007 Peter Johansson9 Copyright (C) 2007, 2008 Peter Johansson 10 10 11 11 This file is part of the yat library, http://trac.thep.lu.se/yat … … 30 30 #include "DataLookup2D.h" 31 31 #include "MatrixLookup.h" 32 #include "yat/utility/Iterator.h" 33 #include "yat/utility/StrideIterator.h" 34 32 35 33 36 #include <vector> … … 66 69 67 70 public: 71 /// 'Read Only' iterator 72 typedef utility::StrideIterator<utility::Iterator<const KernelLookup, 73 const double> > 74 const_iterator; 68 75 69 76 /// … … 158 165 virtual ~KernelLookup(void); 159 166 167 /** 168 Iterator iterates along a row. When end of row is reached it 169 jumps to beginning of next row. 170 171 \return const_iterator pointing to upper-left element. 172 */ 173 const_iterator begin(void) const; 174 175 /** 176 Iterator iterates along a column. 177 178 \return iterator pointing to first element of column \a i. 179 */ 180 const_iterator begin_column(size_t) const; 181 182 /** 183 Iterator iterates along a column. 184 185 \return const_iterator pointing to first element of column \a i. 186 */ 187 const_iterator begin_row(size_t) const; 188 160 189 /// 161 190 /// Each column in returned DataLookup corresponds to the column … … 187 216 */ 188 217 double element(const DataLookupWeighted1D& vec, size_t i) const; 218 219 /** 220 \return const_iterator pointing to end of matrix 221 */ 222 const_iterator end(void) const; 223 224 /** 225 \return const_iterator pointing to end of column \a i 226 */ 227 const_iterator end_column(size_t) const; 228 229 /** 230 \return const_iterator pointing to end of row \a i 231 */ 232 const_iterator end_row(size_t) const; 189 233 190 234 /** -
trunk/yat/classifier/MatrixLookup.cc
r1063 r1066 163 163 MatrixLookup::const_iterator MatrixLookup::begin(void) const 164 164 { 165 return const_iterator( normal_iter(*this, 0, 0), 1);165 return const_iterator(const_iterator::iterator_type(*this, 0, 0), 1); 166 166 } 167 167 … … 169 169 MatrixLookup::const_iterator MatrixLookup::begin_column(size_t i) const 170 170 { 171 return const_iterator( normal_iter(*this, 0, i),this->columns());171 return const_iterator(const_iterator::iterator_type(*this, 0, i),columns()); 172 172 } 173 173 … … 175 175 MatrixLookup::const_iterator MatrixLookup::begin_row(size_t i) const 176 176 { 177 return const_iterator( normal_iter(*this, i, 0), 1);177 return const_iterator(const_iterator::iterator_type(*this, i, 0), 1); 178 178 } 179 179 … … 181 181 MatrixLookup::const_iterator MatrixLookup::end(void) const 182 182 { 183 return const_iterator( normal_iter(*this, this->rows(), 0), 1);183 return const_iterator(const_iterator::iterator_type(*this, rows(), 0), 1); 184 184 } 185 185 … … 187 187 MatrixLookup::const_iterator MatrixLookup::end_column(size_t i) const 188 188 { 189 return const_iterator(normal_iter(*this, this->rows(), i), this->columns()); 189 return const_iterator(const_iterator::iterator_type(*this, rows(), i), 190 columns()); 190 191 } 191 192 … … 193 194 MatrixLookup::const_iterator MatrixLookup::end_row(size_t i) const 194 195 { 195 return const_iterator( normal_iter(*this, i+1, 0), 1);196 return const_iterator(const_iterator::iterator_type(*this, i+1, 0), 1); 196 197 } 197 198 -
trunk/yat/classifier/MatrixLookup.h
r1063 r1066 221 221 222 222 /** 223 Iterator iterates along a row. When end of row is reached it 224 jumps to beginning of next row. 225 226 \return const_iterator pointing to upper-left element. 223 227 */ 224 228 const_iterator begin(void) const; 225 229 226 230 /** 231 Iterator iterates along a column. 232 233 \return iterator pointing to first element of column \a i. 227 234 */ 228 235 const_iterator begin_column(size_t) const; 229 236 230 237 /** 238 Iterator iterates along a column. 239 240 \return const_iterator pointing to first element of column \a i. 231 241 */ 232 242 const_iterator begin_row(size_t) const; 233 243 234 244 /** 245 \return const_iterator pointing to end of matrix 235 246 */ 236 247 const_iterator end(void) const; 237 248 238 249 /** 250 \return const_iterator pointing to end of column \a i 239 251 */ 240 252 const_iterator end_column(size_t) const; 241 253 242 254 /** 255 \return const_iterator pointing to end of row \a i 243 256 */ 244 257 const_iterator end_row(size_t) const; … … 310 323 311 324 private: 312 typedef utility::Iterator<const MatrixLookup, const double> normal_iter;313 325 friend class MatrixLookupWeighted; 314 326
Note: See TracChangeset
for help on using the changeset viewer.