%description: Basic weighted cStdDev test: for integer weights it should yield the same results as unweighted cStdDev with collect() called those many times. Note: there might be a small difference in getStddev() values between the two for smaller N's, because unweighted uses the "N-1" formula, while weighted uses the "N" formula (N-1 gets nasty in the weighted case). %global: void print(cStdDev& s) { EV << "n=" << s.getCount() << " w=" << s.getSumWeights() << " min=" << s.getMin() << " max=" << s.getMax() << " mean=" << s.getMean() << " stddev=" << s.getStddev() << " var=" << s.getVariance() << endl; } %activity: cStdDev s("unweighted"); cStdDev ws("weighted", true); for (int i=0; i<100000; i++) { double d = dblrand() - 0.2; int weight = intuniform(0,5); for (int j=0; j