Changeset 1083 for trunk/yat


Ignore:
Timestamp:
Feb 13, 2008, 2:13:18 PM (14 years ago)
Author:
Peter
Message:

working on #247

Location:
trunk/yat
Files:
5 edited

Legend:

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

    r1080 r1083  
    5151    /// 'Read Only' iterator
    5252    typedef utility::StrideIterator<
    53     utility::Iterator<const DataLookup2D, utility::unweighted_type, const double,
    54                       void, const double> >
     53    utility::Iterator<const DataLookup2D, const double, void, const double> >
    5554    const_iterator;
    5655
  • trunk/yat/classifier/KernelLookup.h

    r1080 r1083  
    7272    /// 'Read Only' iterator
    7373    typedef utility::StrideIterator<
    74     utility::Iterator<const KernelLookup, utility::unweighted_type, const double,
    75                       void, const double> >
     74    utility::Iterator<const KernelLookup, const double, void, const double> >
    7675    const_iterator;
    7776
  • trunk/yat/classifier/MatrixLookup.h

    r1080 r1083  
    7575    /// 'Read Only' iterator
    7676    typedef utility::StrideIterator<
    77     utility::Iterator<const MatrixLookup, utility::unweighted_type, const double,
    78                       void, const double> >
     77    utility::Iterator<const MatrixLookup, const double, void, const double> >
    7978    const_iterator;
    8079
  • trunk/yat/utility/Iterator.h

    r1082 r1083  
    4040     @brief Iterator
    4141  */
    42   template<typename Container, typename weighted_tag, typename value,
     42  template<typename Container, typename value,
    4343           typename pointer = value*, typename reference = value&,
    4444           class Policy = IteratorPolicy<Container, reference, value> >
     
    4848  {
    4949  public:
    50     typedef weighted_tag weighted_iterator_type;
     50    typedef typename Policy::weighted_iterator_type weighted_iterator_type;
    5151
    5252  private:
    53     typedef Iterator<Container, weighted_tag, value, pointer, reference,
    54                      Policy> self;
     53    typedef Iterator<Container, value, pointer, reference, Policy> self;
    5554
    5655  public:
  • trunk/yat/utility/IteratorPolicy.h

    r1082 r1083  
    2525*/
    2626
     27#include "iterator_traits.h"
     28
    2729namespace theplu {
    2830namespace yat {
     
    3739    typedef reference data_type;
    3840    typedef weight_t weight_type;
     41    typedef unweighted_type weighted_iterator_type;
    3942
    4043    data_type data(const Container& c, size_t row, size_t column) const
     
    5457   
    5558  };
     59
     60
     61  /**
     62     \brief policy for weighted Iterator
     63  */
     64  template<class Container, typename data_t, typename weight_t>
     65  struct IteratorPolicyWeighted
     66  {
     67    typedef std::pair<data_t, weight_t> reference;
     68    typedef data_t data_type;
     69    typedef weight_t weight_type;
     70    typedef weighted_type weighted_iterator_type;
     71
     72    data_type data(const Container& c, size_t row, size_t column) const
     73    {
     74      return c.data(row, column);
     75    }
     76
     77    reference dereference(const Container& c, size_t row, size_t column) const
     78    {
     79      return reference(this->data(c, row, column),this->weight(c, row, column));
     80    }
     81
     82    weight_type weight(const Container& c, size_t row, size_t column) const
     83    {
     84      return c.weight(row, column);
     85    }
     86   
     87  };
    5688}}} // of namespace utility, yat, and theplu
    5789
Note: See TracChangeset for help on using the changeset viewer.