Ignore:
Timestamp:
Sep 19, 2014, 8:59:59 AM (9 years ago)
Author:
Peter
Message:

fixes bug #815

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/0.12-stable/yat/normalizer/QuantileNormalizer.cc

    r2992 r3321  
    44  Copyright (C) 2005, 2006 Jari Häkkinen, Markus Ringnér
    55  Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
    6   Copyright (C) 2012 Peter Johansson
     6  Copyright (C) 2012, 2014 Peter Johansson
    77
    88  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    4343    assert(data.columns()==result.columns());
    4444
    45     std::vector<std::vector<size_t> > index(data.rows());
    46     for (size_t column=0; column<data.columns(); ++column)
     45    std::vector<std::vector<size_t> > index(data.columns());
     46    for (size_t column=0; column<data.columns(); ++column) {
     47      assert(column<index.size());
    4748      utility::sort_index(index[column], data.column_const_view(column));
    48      
     49    }
     50
    4951    for (size_t rank=0; rank<data.rows(); ++rank) {
    5052      statistics::Averager a;
    51       for (size_t column=0; column<data.columns(); ++column)
     53      for (size_t column=0; column<data.columns(); ++column) {
     54        assert(column<index.size());
     55        assert(rank<index[column].size());
    5256        a.add(data(index[column][rank], column));
     57      }
    5358      double mean = a.mean();
    54       for (size_t column=0; column<data.columns(); ++column)
     59      for (size_t column=0; column<data.columns(); ++column) {
     60        assert(column<index.size());
    5561        result(index[column][rank], column) = mean;
     62      }
    5663    }
    5764  }
Note: See TracChangeset for help on using the changeset viewer.