Ignore:
Timestamp:
Apr 15, 2010, 3:05:18 PM (15 years ago)
Author:
Frederik Heber <heber@…>
Children:
ce0de8
Parents:
e34098
Message:

BUGFIX: Extended AverageColumnsUnitTest, found one bug in AverageColumns.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • util/src/average.cpp

    re34098 r37ec1b  
    1010#include <iostream>
    1111#include <iomanip>
     12#include <math.h>
    1213#include <string>
    1314#include <sstream>
     
    5960      }
    6061      // skip to next desired column
     62      tmp = 0.;
    6163      for(;cols!=*ColRunner;++cols)
    6264        if (!line.eof()) // check for end of line
     
    113115    lines++;
    114116    // go through the columns
    115     cols = 0;
     117    cols = -1;
    116118    for (IndexSet::const_iterator ColRunner = Columns.begin(); ColRunner != Columns.end(); ++ColRunner) {
    117119      // skip to next desired column
     120      tmp = 0.;
    118121      for(;cols!=*ColRunner;++cols)
    119122        if (!line.eof()) // check for end of line
     
    132135  // go through each value in Results and take std deviation
    133136  for (MeanErrorMap::iterator Runner = Values->begin(); Runner != Values->end(); ++Runner)
    134     if (CountMap[Runner->first] != 0)
    135       Runner->second.second /= CountMap[Runner->first];
    136     else
     137    if (CountMap[Runner->first] != 0) {
     138      tmp = Runner->second.second;
     139      Runner->second.second = sqrt(tmp)/CountMap[Runner->first];
     140    } else
    137141      cerr << "For column " << CountMap[Runner->first] << " no entries have been found." << endl;
    138142
Note: See TracChangeset for help on using the changeset viewer.