Changeset 1404 for trunk/yat/utility


Ignore:
Timestamp:
Aug 8, 2008, 12:47:18 AM (13 years ago)
Author:
Peter
Message:

refs #366 - weighted percentile
Added a class Percentile that can calculate the percentile for both
unweighted and weighted ranges. In order to make sense of the weighted
case, I had to modify the definition of percentile (slightly). The old
function percentile is using the old definition, but a new function,
percentile2, is using the new function and is simply calling the
Percentile class. The median is the same for the two definitions and
therefore it makes no difference which function to call, but to enable
calculation of weighted median percentile2 is called.

Location:
trunk/yat/utility
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/yat/utility/DataIterator.h

    r1377 r1404  
    4242    DataIterator<Base>               // Derived
    4343    , Base                          // Base
    44     , boost::remove_reference<typename iterator_traits<Base>::data_reference>
     44    , typename boost::remove_reference<typename iterator_traits<Base>::data_reference>::type
    4545    , boost::forward_traversal_tag    // CategoryOrTraversal
    4646    , typename iterator_traits<Base>::data_reference // Reference
     
    8484   */
    8585  template<typename Base>
    86   DataIterator<Base> make_data_iterator(Base base)
     86  DataIterator<Base> data_iterator(Base base)
    8787  {
    8888    return DataIterator<Base>(base);
  • trunk/yat/utility/MatrixWeighted.cc

    r1384 r1404  
    124124    columns_ = data.columns();
    125125    resize(data.columns(), data.rows());
    126     std::copy(data.begin(), data.end(), make_data_iterator(vec_.begin()));
    127     std::copy(weight.begin(), weight.end(), make_weight_iterator(vec_.begin()));
     126    std::copy(data.begin(), data.end(), data_iterator(vec_.begin()));
     127    std::copy(weight.begin(), weight.end(), weight_iterator(vec_.begin()));
    128128  }
    129129
  • trunk/yat/utility/WeightIterator.h

    r1377 r1404  
    4040    WeightIterator<Base>               // Derived
    4141    , Base                          // Base
    42     , boost::remove_reference<typename iterator_traits<Base>::weight_reference>
     42    , typename boost::remove_reference<typename iterator_traits<Base>::weight_reference>::type
    4343    , boost::forward_traversal_tag    // CategoryOrTraversal
    4444    , typename iterator_traits<Base>::weight_reference // Reference
     
    8383   */
    8484  template<typename Base>
    85   WeightIterator<Base> make_weight_iterator(Base base)
     85  WeightIterator<Base> weight_iterator(Base base)
    8686  {
    8787    return WeightIterator<Base>(base);
Note: See TracChangeset for help on using the changeset viewer.