Changeset 2032


Ignore:
Timestamp:
Aug 19, 2009, 11:41:30 PM (11 years ago)
Author:
Peter
Message:

fixes #555

Location:
trunk
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/Makefile.am

    r1990 r2032  
    5252  data_weight_test data_weight_proxy_test distance_test \
    5353  ensemble_test feature_selection_test fileutil_test \
    54   fisher_test getline_iterator_test \
     54  fisher_test getline_iterator_test histogram_test \
    5555  igp_test index_test inputranker_test interpolation_test \
    5656  iterator_test kernel_lookup_test kernel_test \
     
    102102fisher_test_SOURCES = fisher_test.cc
    103103getline_iterator_test_SOURCES = getline_iterator_test.cc
     104histogram_test_SOURCES = histogram_test.cc
    104105igp_test_SOURCES = igp_test.cc
    105106index_test_SOURCES = index_test.cc
  • trunk/yat/statistics/AveragerWeighted.h

    r1886 r2032  
    182182    double variance(void) const;
    183183
    184 
     184    /**
     185       operator to add an AveragerWeighted
     186
     187       \since New in yat 0.6
     188    */
     189    const AveragerWeighted& operator+=(const AveragerWeighted&);
     190   
    185191  private:
    186192    ///
     
    197203    const Averager& w(void) const;
    198204
    199     ///
    200     /// operator to add a AveragerWeighted
    201     ///
    202     const AveragerWeighted& operator+=(const AveragerWeighted&);
    203    
    204205    Averager w_;
    205206    Averager wx_;
  • trunk/yat/statistics/Histogram.cc

    r1797 r2032  
    2525#include "Histogram.h"
    2626
     27#include <algorithm>
     28#include <cassert>
    2729#include <cmath>
    28 #include <fstream>
     30#include <functional>
     31#include <ostream>
    2932
    3033namespace theplu {
     
    157160    sum_all_=b.sum_all_;
    158161    sum_histogram_=b.sum_histogram_;
     162    return *this;
     163  }
     164
     165
     166  const Histogram& Histogram::operator+=(const Histogram& rhs)
     167  {
     168    assert(histogram_.size()==rhs.histogram_.size());
     169    std::transform(histogram_.begin(), histogram_.end(),
     170                   rhs.histogram_.begin(), histogram_.begin(),
     171                   std::plus<double>());
     172    assert(max_==rhs.max_);
     173    assert(min_==rhs.min_);
     174    sum_all_ += rhs.sum_all_;
     175    sum_histogram_ += rhs.sum_histogram_;
    159176    return *this;
    160177  }
  • trunk/yat/statistics/Histogram.h

    r1888 r2032  
    180180    const Histogram& operator=(const Histogram&);
    181181
     182    /**
     183       \brief Addition operator
     184
     185       \note The bins in lhs and rhs must match, i.e., min, max, and
     186       nof_bins() must be equal in lhs and rhs.
     187
     188       \since New in yat 0.6
     189    */
     190    const Histogram& operator+=(const Histogram& rhs);
     191
    182192  private:
    183193    // Returns zero if outside boundaries
Note: See TracChangeset for help on using the changeset viewer.