Basic Image AlgorithmS Library
2.8.0
Main Page
Related Pages
Modules
Classes
Examples
All
Classes
Namespaces
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Groups
Pages
Base
Math
Distribution.hh
1
/*
2
This file is part of the BIAS library (Basic ImageAlgorithmS).
3
4
Copyright (C) 2003-2009 (see file CONTACT for details)
5
Multimediale Systeme der Informationsverarbeitung
6
Institut fuer Informatik
7
Christian-Albrechts-Universitaet Kiel
8
9
10
BIAS is free software; you can redistribute it and/or modify
11
it under the terms of the GNU Lesser General Public License as published by
12
the Free Software Foundation; either version 2.1 of the License, or
13
(at your option) any later version.
14
15
BIAS is distributed in the hope that it will be useful,
16
but WITHOUT ANY WARRANTY; without even the implied warranty of
17
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
GNU Lesser General Public License for more details.
19
20
You should have received a copy of the GNU Lesser General Public License
21
along with BIAS; if not, write to the Free Software
22
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23
*/
24
25
#ifndef __Distribution_hh__
26
#define __Distribution_hh__
27
#include <Base/Common/BIASpragmaStart.hh>
28
29
#include <Base/Debug/Error.hh>
30
#include <vector>
31
#include <cmath>
32
33
34
namespace
BIAS {
35
36
/** @class Distribution
37
* @brief class for calculating mean, variance and possibly other parameters
38
* @author Felix Woelk
39
* @date 08/2005
40
*/
41
class
BIASMathBase_EXPORT
Distribution
42
{
43
public
:
44
Distribution
();
45
46
~
Distribution
();
47
48
void
Reset();
49
50
void
AddData(
const
std::vector<double>& data);
51
52
inline
unsigned
GetCount
()
53
{
return
Count_; }
54
55
inline
double
GetMean
()
56
{ BIASASSERT(Count_!=0);
return
Sum_/(double)Count_; }
57
58
inline
double
GetVariance
()
59
{ BIASASSERT(Count_>0);
60
//double mean = GetMean(); // unused
61
return
(SquaredSum_ - Sum_*Sum_/(
double
)(Count_))/(double)(Count_-1); }
62
63
inline
double
GetSigma
()
64
{
return
sqrt(GetVariance()); }
65
66
protected
:
67
double
Sum_
;
68
double
SquaredSum_
;
69
unsigned
Count_
;
70
71
};
// class
72
73
74
}
// namespace
75
76
#include <Base/Common/BIASpragmaEnd.hh>
77
78
#endif
BIAS::Distribution::GetMean
double GetMean()
Definition:
Distribution.hh:55
BIAS::Distribution
class for calculating mean, variance and possibly other parameters
Definition:
Distribution.hh:41
BIAS::Distribution::GetSigma
double GetSigma()
Definition:
Distribution.hh:63
BIAS::Distribution::Count_
unsigned Count_
Definition:
Distribution.hh:69
BIAS::Distribution::SquaredSum_
double SquaredSum_
Definition:
Distribution.hh:68
BIAS::Distribution::GetVariance
double GetVariance()
Definition:
Distribution.hh:58
BIAS::Distribution::GetCount
unsigned GetCount()
Definition:
Distribution.hh:52
BIAS::Distribution::Sum_
double Sum_
Definition:
Distribution.hh:67
Generated on Tue Feb 6 2018 02:01:33 for Basic Image AlgorithmS Library by
1.8.5