#include <SimStatistic.h>
Public Member Functions | |
SimStatistic () | |
Default Constructor. | |
virtual | ~SimStatistic () |
Default Destructor. | |
double | mean () const |
Get the average. | |
double | rms () const |
Get the root-mean-square of the distribution. | |
void | increment (double x) |
Add an entry. | |
SimStatistic & | operator+= (const DayaBay::SimStatistic &rhs) |
Addition operator. | |
SimStatistic | operator+ (const DayaBay::SimStatistic &rhs) const |
Addition operator. | |
std::ostream & | fillStream (std::ostream &s) const |
Print the collection. | |
double | count () const |
Retrieve const Number of times this stat has been incremented. | |
void | setCount (double value) |
Update Number of times this stat has been incremented. | |
double | sum () const |
Retrieve const Total of x over all counts. | |
void | setSum (double value) |
Update Total of x over all counts. | |
double | squaredsum () const |
Retrieve const Total of x^2 over all counts. | |
void | setSquaredsum (double value) |
Update Total of x^2 over all counts. | |
Static Public Member Functions | |
static void * | operator new (size_t size) |
operator new | |
static void * | operator new (size_t size, void *pObj) |
placement operator new it is needed by libstdc++ 3.2.3 (e.g. | |
static void | operator delete (void *p) |
operator delete | |
static void | operator delete (void *p, void *pObj) |
placement operator delete not sure if really needed, but it does not harm | |
Private Attributes | |
double | m_count |
Number of times this stat has been incremented. | |
double | m_sum |
Total of x over all counts. | |
double | m_squaredsum |
Total of x^2 over all counts. |
Definition at line 42 of file SimStatistic.h.
DayaBay::SimStatistic::SimStatistic | ( | ) | [inline] |
Default Constructor.
Definition at line 47 of file SimStatistic.h.
00047 : m_count(0), 00048 m_sum(0), 00049 m_squaredsum(0) {}
virtual DayaBay::SimStatistic::~SimStatistic | ( | ) | [inline, virtual] |
double DayaBay::SimStatistic::mean | ( | ) | const [inline] |
double DayaBay::SimStatistic::rms | ( | ) | const [inline] |
Get the root-mean-square of the distribution.
Definition at line 189 of file SimStatistic.h.
00190 { 00191 00192 return sqrt((m_squaredsum - m_sum*m_sum/m_count)/(m_count)); 00193 00194 }
void DayaBay::SimStatistic::increment | ( | double | x | ) | [inline] |
Add an entry.
Definition at line 196 of file SimStatistic.h.
00197 { 00198 00199 m_count+=1.0; 00200 m_sum += x; 00201 m_squaredsum += x*x; 00202 00203 }
DayaBay::SimStatistic & DayaBay::SimStatistic::operator+= | ( | const DayaBay::SimStatistic & | rhs | ) | [inline] |
Addition operator.
Definition at line 205 of file SimStatistic.h.
00206 { 00207 00208 m_count+=rhs.m_count; 00209 m_sum += rhs.m_sum; 00210 m_squaredsum += rhs.m_squaredsum; 00211 return *this; 00212 00213 }
DayaBay::SimStatistic DayaBay::SimStatistic::operator+ | ( | const DayaBay::SimStatistic & | rhs | ) | const [inline] |
Addition operator.
Definition at line 215 of file SimStatistic.h.
00216 { 00217 00218 SimStatistic res; 00219 res.m_count = m_count + rhs.m_count; 00220 res.m_sum = m_sum + rhs.m_sum; 00221 res.m_squaredsum = m_squaredsum + rhs.m_squaredsum; 00222 return res; 00223 00224 }
std::ostream & DayaBay::SimStatistic::fillStream | ( | std::ostream & | s | ) | const |
double DayaBay::SimStatistic::count | ( | ) | const [inline] |
Retrieve const Number of times this stat has been incremented.
Definition at line 152 of file SimStatistic.h.
00153 { 00154 return m_count; 00155 }
void DayaBay::SimStatistic::setCount | ( | double | value | ) | [inline] |
Update Number of times this stat has been incremented.
Definition at line 157 of file SimStatistic.h.
00158 { 00159 m_count = value; 00160 }
double DayaBay::SimStatistic::sum | ( | ) | const [inline] |
Retrieve const Total of x over all counts.
Definition at line 162 of file SimStatistic.h.
00163 { 00164 return m_sum; 00165 }
void DayaBay::SimStatistic::setSum | ( | double | value | ) | [inline] |
Update Total of x over all counts.
Definition at line 167 of file SimStatistic.h.
00168 { 00169 m_sum = value; 00170 }
double DayaBay::SimStatistic::squaredsum | ( | ) | const [inline] |
Retrieve const Total of x^2 over all counts.
Definition at line 172 of file SimStatistic.h.
00173 { 00174 return m_squaredsum; 00175 }
void DayaBay::SimStatistic::setSquaredsum | ( | double | value | ) | [inline] |
Update Total of x^2 over all counts.
Definition at line 177 of file SimStatistic.h.
00178 { 00179 m_squaredsum = value; 00180 }
static void* DayaBay::SimStatistic::operator new | ( | size_t | size | ) | [inline, static] |
operator new
Definition at line 99 of file SimStatistic.h.
00100 { 00101 return ( sizeof(SimStatistic) == size ? 00102 boost::singleton_pool<SimStatistic, sizeof(SimStatistic)>::malloc() : 00103 ::operator new(size) ); 00104 }
static void* DayaBay::SimStatistic::operator new | ( | size_t | size, | |
void * | pObj | |||
) | [inline, static] |
placement operator new it is needed by libstdc++ 3.2.3 (e.g.
in std::vector) it is not needed in libstdc++ >= 3.4
Definition at line 109 of file SimStatistic.h.
static void DayaBay::SimStatistic::operator delete | ( | void * | p | ) | [inline, static] |
operator delete
Definition at line 115 of file SimStatistic.h.
00116 { 00117 boost::singleton_pool<SimStatistic, sizeof(SimStatistic)>::is_from(p) ? 00118 boost::singleton_pool<SimStatistic, sizeof(SimStatistic)>::free(p) : 00119 ::operator delete(p); 00120 }
static void DayaBay::SimStatistic::operator delete | ( | void * | p, | |
void * | pObj | |||
) | [inline, static] |
placement operator delete not sure if really needed, but it does not harm
Definition at line 124 of file SimStatistic.h.
00125 { 00126 ::operator delete (p, pObj); 00127 }
double DayaBay::SimStatistic::m_count [private] |
double DayaBay::SimStatistic::m_sum [private] |
double DayaBay::SimStatistic::m_squaredsum [private] |