2010-03-09 04:15:10 +00:00
|
|
|
// This file is part of BOINC.
|
|
|
|
// http://boinc.berkeley.edu
|
|
|
|
// Copyright (C) 2010 University of California
|
|
|
|
//
|
|
|
|
// BOINC is free software; you can redistribute it and/or modify it
|
|
|
|
// under the terms of the GNU Lesser General Public License
|
|
|
|
// as published by the Free Software Foundation,
|
|
|
|
// either version 3 of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// BOINC is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
// See the GNU Lesser General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Lesser General Public License
|
|
|
|
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
#include "average.h"
|
|
|
|
|
|
|
|
#if 0
|
2010-03-11 17:49:19 +00:00
|
|
|
#include <stdio.h>
|
2010-03-09 04:15:10 +00:00
|
|
|
#include "util.h"
|
|
|
|
int main() {
|
2010-03-11 17:49:19 +00:00
|
|
|
AVERAGE_VAR avg;
|
2010-03-29 22:28:20 +00:00
|
|
|
avg.clear();
|
2010-03-11 17:49:19 +00:00
|
|
|
avg.init(100, .01, 10);
|
2010-03-09 04:15:10 +00:00
|
|
|
|
|
|
|
for (int i=0; i<1000; i++) {
|
2010-03-11 17:49:19 +00:00
|
|
|
avg.update_var(drand());
|
2010-03-09 04:15:10 +00:00
|
|
|
printf("%d %f %f\n", i, avg.get_avg(), sqrt(avg.get_var()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|