Changeset 1552


Ignore:
Timestamp:
Oct 6, 2008, 4:36:56 PM (13 years ago)
Author:
Peter
Message:

using DataWeight? rather than std::pair<double, double>

Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/iterator_test.cc

    r1538 r1552  
    143143  classifier::MatrixLookupWeighted mw(m,w);
    144144  classifier::DataLookupWeighted1D aw(mw,0,true);
    145   size_t nof1=std::count(aw.begin(),aw.end(),
    146                          std::pair<double, double>(1.0, 1.0));
     145  size_t nof1=std::count(aw.begin(),aw.end(),utility::DataWeight(1.0, 1.0));
    147146  if(nof1!=2) {
    148147    suite.err() << "std algoritm with IteratorWeighted failed" << std::endl;
  • trunk/yat/classifier/DataLookup1D.h

    r1525 r1552  
    4444  {
    4545  public:
     46    /**
     47       value_type is double
     48
     49       \since New in yat 0.5
     50     */
     51    typedef MatrixLookup::value_type value_type;
     52
     53    /**
     54       const_reference type is const double&
     55
     56       \since New in yat 0.5
     57     */
     58    typedef MatrixLookup::const_reference const_reference;
     59
    4660    /// 'Read Only' iterator
    4761    typedef MatrixLookup::const_row_iterator const_iterator;
  • trunk/yat/classifier/DataLookupWeighted1D.cc

    r1526 r1552  
    110110
    111111
    112   std::pair<double,double> DataLookupWeighted1D::operator()(const size_t i) const
     112  DataLookupWeighted1D::const_reference
     113  DataLookupWeighted1D::operator()(const size_t i) const
    113114  {
    114115    return column_vector_ ? (*matrix_)(i,index_) : (*matrix_)(index_,i);
  • trunk/yat/classifier/DataLookupWeighted1D.h

    r1526 r1552  
    4747 
    4848  public:
     49    /**
     50       value_type is DataWeight
     51
     52       \since New in yat 0.5
     53     */
     54    typedef utility::DataWeight value_type;
     55
     56    /**
     57       const_reference type is const DataWeight
     58
     59       \since New in yat 0.5
     60     */
     61    typedef const utility::DataWeight const_reference;
     62
    4963    /// 'Read Only' iterator
    5064    typedef MatrixLookupWeighted::const_row_iterator const_iterator;
     
    102116    double weight(const size_t i) const;
    103117
    104     ///
    105     /// @return data(i) * weight(i)
    106     ///
    107     std::pair<double, double> operator()(const size_t i) const;
     118    /**
     119       \brief access operator
     120     */
     121    const_reference operator()(const size_t i) const;
    108122
    109123  private:
  • trunk/yat/classifier/KernelLookup.h

    r1549 r1552  
    6868
    6969  public:
     70    /**
     71       value_type is double
     72
     73       \since New in yat 0.5
     74     */
     75    typedef double value_type;
     76
    7077    /**
    7178       const_reference type is const double
  • trunk/yat/classifier/MatrixLookupWeighted.cc

    r1487 r1552  
    315315
    316316
    317   std::pair<double, double>
     317  MatrixLookupWeighted::const_reference
    318318  MatrixLookupWeighted::operator()(const size_t row, const size_t column) const
    319319  {
    320     return std::make_pair(data(row, column), weight(row,column));
     320    return utility::DataWeight(data(row, column), weight(row,column));
    321321  }
    322322
  • trunk/yat/classifier/MatrixLookupWeighted.h

    r1549 r1552  
    8989    typedef utility::StrideIterator<
    9090    utility::Container2DIterator<const MatrixLookupWeighted,
    91                                  const std::pair<double, double>, void,
    92                                  const std::pair<double, double>,
     91                                 value_type, void, 
     92                                 const_reference,
    9393             utility::IteratorPolicyWeighted<const MatrixLookupWeighted,
    9494                                             const double,
     
    343343    /// @return data-weight pair (@a row, @a column)
    344344    ///
    345     std::pair<double, double>
    346     operator()(const size_t row, const size_t column) const;
     345    const_reference operator()(const size_t row, const size_t column) const;
    347346
    348347    ///
Note: See TracChangeset for help on using the changeset viewer.