00001 // This may look like C code, but it is really -*- C++ -*- 00002 /* 00003 Copyright (C) 1988 Free Software Foundation 00004 written by Dirk Grunwald (grunwald@cs.uiuc.edu) 00005 00006 This file is part of the GNU C++ Library. This library is free 00007 software; you can redistribute it and/or modify it under the terms of 00008 the GNU Library General Public License as published by the Free 00009 Software Foundation; either version 2 of the License, or (at your 00010 option) any later version. This library is distributed in the hope 00011 that it will be useful, but WITHOUT ANY WARRANTY; without even the 00012 implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00013 PURPOSE. See the GNU Library General Public License for more details. 00014 You should have received a copy of the GNU Library General Public 00015 License along with this library; if not, write to the Free Software 00016 Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 00017 */ 00018 #ifndef SampleStatistic_h 00019 #ifdef __GNUG__ 00020 #pragma interface 00021 #endif 00022 #define SampleStatistic_h 1 00023 00024 //#include <builtin.h> 00025 // following put in by THB: couldn't find it 00026 //#ifndef HUGE 00027 //#define HUGE 1.e30 00028 //#endif 00029 00030 class SampleStatistic { 00031 protected: 00032 long unsigned n; 00033 double x; 00034 double x2; 00035 double minValue, maxValue; 00036 00037 public : 00038 00039 SampleStatistic(); 00040 virtual ~SampleStatistic(); 00041 virtual void reset(); 00042 00043 virtual void operator+=(double); 00044 long samples(); 00045 double mean(); 00046 double stdDev(); 00047 double var(); 00048 double min(); 00049 double max(); 00050 double confidence(int p_percentage); 00051 double confidence(double p_value); 00052 00053 // void error(const char* msg); 00054 }; 00055 00056 // error handlers 00057 /* 00058 extern void default_SampleStatistic_error_handler(const char*); 00059 extern one_arg_error_handler_t SampleStatistic_error_handler; 00060 00061 extern one_arg_error_handler_t 00062 set_SampleStatistic_error_handler(one_arg_error_handler_t f); 00063 */ 00064 inline SampleStatistic:: SampleStatistic(){ reset();} 00065 inline long SampleStatistic:: samples() {return long(n);} 00066 inline double SampleStatistic:: min() {return(minValue);} 00067 inline double SampleStatistic:: max() {return(maxValue);} 00068 inline SampleStatistic::~SampleStatistic() {} 00069 00070 #endif 00071
1.2.3 written by Dimitri van Heesch,
© 1997-2000