Ignore:
Timestamp:
Jan 20, 2009, 2:58:44 AM (12 years ago)
Author:
Peter
Message:

added support for creation of an qQuantileNormalizer from a weighted range. Addresses #478

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/yat/normalizer/qQuantileNormalizer.h

    r1737 r1738  
    146146    void build(Iterator first, Iterator last, unsigned int N,
    147147               utility::unweighted_iterator_tag);
     148    // weighted "constructor"
     149    template<typename Iterator>
     150    void build(Iterator first, Iterator last, unsigned int N,
     151               utility::weighted_iterator_tag);
    148152    void init(const utility::VectorBase&, unsigned int N);
     153    void init(const std::vector<utility::DataWeight>&, unsigned int N);
    149154
    150155    utility::Vector average_;
     
    256261
    257262
     263  template<typename Iterator>
     264  void qQuantileNormalizer::Partitioner::build(Iterator first,
     265                                               Iterator last, unsigned int N,
     266                                               utility::weighted_iterator_tag)
     267  {
     268    std::vector<utility::DataWeight> vec;
     269    vec.reserve(std::distance(first, last));
     270    std::back_insert_iterator<std::vector<utility::DataWeight> > inserter(vec);
     271    std::copy(first, last, inserter);
     272    std::sort(vec.begin(), vec.end());
     273    init(vec, N);
     274  }
     275
     276
    258277}}} // end of namespace normalizer, yat and thep
    259278
Note: See TracChangeset for help on using the changeset viewer.