00001 /// \file CATStats.h 00002 /// \brief Basic statistics class 00003 /// \ingroup CAT 00004 /// 00005 /// Copyright (c) 2002-2008 by Michael Ellison. 00006 /// See COPYING.txt for the \ref gaslicense License (MIT License). 00007 /// 00008 // $Author: mikeellison $ 00009 // $Date: 2008-01-19 19:19:35 -0600 (Sat, 19 Jan 2008) $ 00010 // $Revision: $ 00011 // $NoKeywords: $ 00012 #ifndef _CATStats_H 00013 #define _CATStats_H 00014 00015 #include "CATInternal.h" 00016 00017 /// \class CATStats 00018 /// \brief Basic statistics class 00019 /// \ingroup CAT 00020 class CATStats 00021 { 00022 public: 00023 CATStats(); 00024 virtual ~CATStats(); 00025 00026 bool AddValue(CATFloat64 value); 00027 void Clear(); 00028 00029 00030 CATFloat64 Mean(); // Average 00031 CATFloat64 Median(); // Median 00032 CATFloat64 Min(); // Minimum 00033 CATFloat64 Max(); // Maximum 00034 CATFloat64 Variance(); // Variance 00035 CATFloat64 StdDev(); // Standard Deviation 00036 CATFloat64 AvgDev(); // Average Deviation 00037 CATFloat64 Variance(CATFloat64 sample); // Variance of a sample 00038 CATFloat64 StdDev (CATFloat64 sample); // StdDev of a sample 00039 CATFloat64 GetValue(CATUInt32 index); 00040 CATFloat64 Mode(CATUInt32 steps); 00041 CATUInt32 Size() {return fNumEntries;} 00042 00043 00044 00045 protected: 00046 static bool FloatSortCallback(const CATFloat64 elem1, const CATFloat64 elem2); 00047 00048 CATFloat64 fMin; 00049 CATFloat64 fMax; 00050 CATFloat64 fSum; 00051 CATFloat64 fSumSquares; 00052 CATUInt32 fNumEntries; 00053 std::vector<CATFloat64> fEntryList; 00054 }; 00055 #endif _CATStats_H