Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/13/09 13:53:29 (15 years ago)
Author:
gkronber
Message:

Fixed #616 (GetMean and GetRange include the last row (parameter 'to') in the calculation).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.DataAnalysis/3.2/Dataset.cs

    r1529 r1784  
    258258
    259259    public double GetMean(int column) {
    260       return GetMean(column, 0, Rows - 1);
     260      return GetMean(column, 0, Rows);
    261261    }
    262262
    263263    public double GetMean(int column, int from, int to) {
    264264      if(!cachedMeans[column].ContainsKey(from) || !cachedMeans[column][from].ContainsKey(to)) {
    265         double[] values = new double[to - from + 1];
    266         for(int sample = from; sample <= to; sample++) {
     265        double[] values = new double[to - from];
     266        for(int sample = from; sample < to; sample++) {
    267267          values[sample - from] = GetValue(sample, column);
    268268        }
     
    277277
    278278    public double GetRange(int column) {
    279       return GetRange(column, 0, Rows - 1);
     279      return GetRange(column, 0, Rows);
    280280    }
    281281
    282282    public double GetRange(int column, int from, int to) {
    283283      if(!cachedRanges[column].ContainsKey(from) || !cachedRanges[column][from].ContainsKey(to)) {
    284         double[] values = new double[to - from + 1];
    285         for(int sample = from; sample <= to; sample++) {
     284        double[] values = new double[to - from];
     285        for(int sample = from; sample < to; sample++) {
    286286          values[sample - from] = GetValue(sample, column);
    287287        }
Note: See TracChangeset for help on using the changeset viewer.