Changeset 1063


Ignore:
Timestamp:
Feb 10, 2008, 10:33:39 PM (16 years ago)
Author:
Peter
Message:

Iterators for MatrixLookup?

Location:
trunk/yat/classifier
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/yat/classifier/MatrixLookup.cc

    r1000 r1063  
    161161
    162162
     163  MatrixLookup::const_iterator MatrixLookup::begin(void) const
     164  {
     165    return const_iterator(normal_iter(*this, 0, 0), 1);
     166  }
     167
     168
     169  MatrixLookup::const_iterator MatrixLookup::begin_column(size_t i) const
     170  {
     171    return const_iterator(normal_iter(*this, 0, i),this->columns());
     172  }
     173
     174
     175  MatrixLookup::const_iterator MatrixLookup::begin_row(size_t i) const
     176  {
     177    return const_iterator(normal_iter(*this, i, 0), 1);
     178  }
     179
     180
     181  MatrixLookup::const_iterator MatrixLookup::end(void) const
     182  {
     183    return const_iterator(normal_iter(*this, this->rows(), 0), 1);
     184  }
     185
     186
     187  MatrixLookup::const_iterator MatrixLookup::end_column(size_t i) const
     188  {
     189    return const_iterator(normal_iter(*this, this->rows(), i), this->columns());
     190  }
     191
     192
     193  MatrixLookup::const_iterator MatrixLookup::end_row(size_t i) const
     194  {
     195    return const_iterator(normal_iter(*this, i+1, 0), 1);
     196  }
     197
     198
    163199  const MatrixLookup*
    164200  MatrixLookup::selected(const std::vector<size_t>& i) const
  • trunk/yat/classifier/MatrixLookup.h

    r1062 r1063  
    2929#include "DataLookup2D.h"
    3030#include "yat/utility/Iterator.h"
     31#include "yat/utility/StrideIterator.h"
    3132
    3233#include <iostream>
     
    7071  class MatrixLookup : public DataLookup2D
    7172  {
    72     typedef utility::Iterator<const MatrixLookup, const double&> const_iterator;
    73 
    74   public:
     73  public:
     74    /// 'Read Only' iterator
     75    typedef utility::StrideIterator<utility::Iterator<const MatrixLookup,
     76                                                      const double> >
     77    const_iterator;
     78
    7579    ///
    7680    /// Constructor creating a lookup into the entire @a matrix.
     
    219223     */
    220224    const_iterator begin(void) const;
     225
     226    /**
     227     */
     228    const_iterator begin_column(size_t) const;
     229
     230    /**
     231     */
    221232    const_iterator begin_row(size_t) const;
    222     const_iterator begin_column(size_t) const;
     233
     234    /**
     235     */
     236    const_iterator end(void) const;
     237
     238    /**
     239     */
     240    const_iterator end_column(size_t) const;
     241
     242    /**
     243     */
     244    const_iterator end_row(size_t) const;
    223245
    224246    /**
     
    288310   
    289311  private:
     312    typedef utility::Iterator<const MatrixLookup, const double> normal_iter;
    290313    friend class MatrixLookupWeighted;
    291314
Note: See TracChangeset for help on using the changeset viewer.