Changeset 3572


Ignore:
Timestamp:
Jan 12, 2017, 4:01:48 AM (5 years ago)
Author:
Peter
Message:

fixes #874

File:
1 edited

Legend:

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

    r3571 r3572  
    44/*
    55  Copyright (C) 2009 Jari Häkkinen, Peter Johansson
    6   Copyright (C) 2010, 2016 Peter Johansson
     6  Copyright (C) 2010, 2016, 2017 Peter Johansson
    77
    88  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    251251
    252252    Partitioner source(first, last, target_.size());
    253     typename utility::weighted_if_any2<RandomAccessIterator1, RandomAccessIterator2>::type tag;
     253    typename utility::weighted_iterator_traits<RandomAccessIterator1>::type tag;
    254254    normalize(source, first, last, result, tag);
    255255  }
     
    265265  {
    266266    utility::check_iterator_is_unweighted(first);
    267     utility::check_iterator_is_unweighted(result);
     267    // copy the weights if needed
     268    detail::copy_weight_if_weighted(first, last, result);
     269
    268270    size_t N = last-first;
    269271    YAT_ASSERT(N >= target_.size());
     
    283285    // take care of limiting case number of parts approximately equal
    284286    // to the number of elements in range.
     287    utility::iterator_traits<RandomAccessIterator1> traits1;
     288    utility::iterator_traits<RandomAccessIterator2> traits2;
    285289    if (end==0)
    286290      ++end;
    287291    for (size_t i=start; i<end; ++i) {
    288292      size_t si = sorted_index[i];
    289       result[si] = first[si] - diff(0);
     293      traits2.data(result+si) = traits1.data(first+si) - diff(0);
    290294    }
    291295
     
    302306
    303307      YAT_ASSERT((i+0.5)/N>idx(0));
    304       result[si] = first[si] - cspline.evaluate((i+0.5)/N);
     308      traits2.data(result+si) =
     309        traits1.data(first+si) - cspline.evaluate((i+0.5)/N);
    305310    }
    306311
     
    309314    for (size_t i=end ; i<N; ++i) {
    310315      size_t si = sorted_index[i];
    311       result[si] = first[si] - diff(diff.size()-1);
     316      traits2.data(result+si) = traits1.data(first+si) - diff(diff.size()-1);
    312317    }
    313318  }
Note: See TracChangeset for help on using the changeset viewer.