Changeset 1709


Ignore:
Timestamp:
Jan 13, 2009, 11:48:07 AM (12 years ago)
Author:
Jari Häkkinen
Message:

Addresses #425. Changed partition function.

Location:
trunk/yat/normalizer
Files:
2 edited

Legend:

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

    r1708 r1709  
    3737  Partitioner::Partitioner(const utility::VectorConstView& vec,
    3838                           unsigned int N)
    39     : average_(utility::Vector(N+1)), index_(utility::Vector(N+1))
     39    : average_(utility::Vector(N)), index_(utility::Vector(N))
    4040  {
    4141    assert(N>1);
     
    4646    utility::Vector sortedvec(vec);
    4747    std::sort(sortedvec.begin(),sortedvec.end());
    48     for (unsigned int i=0; i<=N; ++i) {
    49       unsigned int first = ( i    ? (i-0.5)*range : 0 );
    50       unsigned int end   = ( i!=N ? (i+0.5)*range : sortedvec.size() );
     48    unsigned int first=0;
     49    for (unsigned int i=0; i<N; ++i) {
     50      unsigned int end   = ( i==(N-1) ? sortedvec.size() : first+range );
    5151      statistics::Averager av;
    5252      for (unsigned int r=first; r<end; ++r)
    5353        av.add(sortedvec(r));
    5454      average_(i)=av.mean();
    55       index_(i)=end;
     55      index_(i)= (i+0.5)*range;
     56      first=end;
    5657    }
    5758  }
     
    7273  size_t Partitioner::size(void) const
    7374  {
    74     return average_.size()-1;
     75    return average_.size();
    7576  }
    7677
  • trunk/yat/normalizer/qQuantileNormalizer.h

    r1708 r1709  
    5353
    5454    /**
    55        \brief The number of equal sized partitions, i.e., number of
    56        internal parts minus 1.
    57 
    58        \note The end partitions are paired together to make part since
    59        they are only half size as compared to the other parts.
     55       \brief The number of parts.
    6056    */
    6157    size_t size(void) const;
Note: See TracChangeset for help on using the changeset viewer.