Changeset 1062 for trunk/yat/classifier


Ignore:
Timestamp:
Feb 10, 2008, 7:41:06 PM (13 years ago)
Author:
Peter
Message:

redesigning Iterator class to hold a 2D container rather than 1D as before. refs #267

Location:
trunk/yat/classifier
Files:
3 edited

Legend:

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

    r1018 r1062  
    9595  DataLookup1D::const_iterator DataLookup1D::begin(void) const
    9696  {
    97     return DataLookup1D::const_iterator(*this, 0);
     97    typedef utility::Iterator<const DataLookup2D, const double> Iter;
     98    if (column_vector_)
     99      return const_iterator(Iter(*matrix_, 0, index_), matrix_->columns());
     100    return const_iterator(Iter(*matrix_, index_, 0), 1);
    98101  }
    99102
     
    101104  DataLookup1D::const_iterator DataLookup1D::end(void) const
    102105  {
    103     return DataLookup1D::const_iterator(*this, size());
     106    typedef utility::Iterator<const DataLookup2D, const double> Iter;
     107    if (column_vector_)
     108      return const_iterator(Iter(*matrix_, matrix_->rows(), index_),
     109                            matrix_->columns());
     110    return const_iterator(Iter(*matrix_, index_+1, 0), 1);
    104111  }
    105112
  • trunk/yat/classifier/DataLookup1D.h

    r1040 r1062  
    2727*/
    2828
    29 #include "yat/utility/Functor.h"
     29#include "DataLookup2D.h"
    3030#include "yat/utility/Iterator.h"
     31#include "yat/utility/StrideIterator.h"
    3132
    3233#include <iostream>
     
    4041namespace classifier { 
    4142
    42   class DataLookup2D;
    43 
    4443  ///
    4544  /// @brief Class for general vector view.
    4645  ///
    47 
    4846  class DataLookup1D
    4947  {
     
    5149  public:
    5250    /// 'Read Only' iterator
    53     typedef utility::Iterator<const utility::ContIdentity<const double,
    54                                                           const DataLookup1D> >
     51    typedef utility::StrideIterator<utility::Iterator<const DataLookup2D,
     52                                                      const double> >
    5553    const_iterator;
    5654
  • trunk/yat/classifier/MatrixLookup.h

    r1035 r1062  
    2828
    2929#include "DataLookup2D.h"
     30#include "yat/utility/Iterator.h"
    3031
    3132#include <iostream>
     
    6970  class MatrixLookup : public DataLookup2D
    7071  {
    71  
     72    typedef utility::Iterator<const MatrixLookup, const double&> const_iterator;
     73
    7274  public:
    73 
    74 
    7575    ///
    7676    /// Constructor creating a lookup into the entire @a matrix.
     
    217217
    218218    /**
     219     */
     220    const_iterator begin(void) const;
     221    const_iterator begin_row(size_t) const;
     222    const_iterator begin_column(size_t) const;
     223
     224    /**
    219225       the new MatrixLookup will consist of the rolumn vectors
    220226       defined by @a index. This means that the returned MatrixLookup
Note: See TracChangeset for help on using the changeset viewer.