DGtal
2.2.0
Toggle main menu visibility
Loading...
Searching...
No Matches
Statistic.h
1
16
17
#pragma once
18
31
32
#if defined(Statistics_RECURSES)
33
#error Recursive header files inclusion detected in Statistics.h
34
#else
// defined(Statistics_RECURSES)
36
#define Statistics_RECURSES
37
38
#if !defined Statistics_h
40
#define Statistics_h
41
43
// Inclusions
44
#include <iostream>
45
#include "DGtal/base/Common.h"
46
#include "DGtal/kernel/CCommutativeRing.h"
47
#include "DGtal/kernel/NumberTraits.h"
48
#include <utility>
49
#include <vector>
51
52
namespace
DGtal
53
{
68
template
<
typename
TQuantity>
69
class
Statistic
70
{
71
72
// ----------------------- public types -----------------------------------
73
public
:
74
typedef
TQuantity
Quantity
;
75
BOOST_CONCEPT_ASSERT
((
concepts::CCommutativeRing<Quantity>
) );
76
typedef
std::vector< Quantity >
Container
;
77
typedef
typename
Container::const_iterator
ConstIterator
;
78
79
// ----------------------- Standard services ------------------------------
80
public
:
81
85
~Statistic
();
86
90
Statistic
(
bool
storeSample=
false
);
91
96
Statistic
(
const
Statistic
& other );
97
103
Statistic
&
operator=
(
const
Statistic
& other );
104
112
Statistic
&
operator+=
(
const
Statistic
& other );
113
120
Statistic
operator+
(
const
Statistic
& other )
const
;
121
125
ConstIterator
begin
()
const
;
126
130
ConstIterator
end
()
const
;
131
132
// ----------------------- Accessors ------------------------------
133
public
:
134
135
139
unsigned
int
samples
()
const
;
140
144
unsigned
int
size
()
const
;
145
149
double
mean
()
const
;
150
154
double
variance
()
const
;
155
159
double
unbiasedVariance
()
const
;
160
164
Quantity
max
()
const
;
165
169
Quantity
min
()
const
;
170
171
180
Quantity
median
();
181
184
Quantity
operator[]
(
unsigned
int
i )
const
;
185
191
void
addValue
(
Quantity
v );
192
207
template
<
class
Iter>
208
void
addValues
( Iter b, Iter e );
209
213
void
clear
();
214
223
void
terminate
();
224
225
226
227
// ----------------------- Interface --------------------------------------
228
public
:
229
234
void
selfDisplay
( std::ostream & that_stream )
const
;
235
240
bool
OK
()
const
;
241
242
243
// ------------------------- Data ----------------------------------------
244
private
:
245
246
247
// ------------------------- Data ----------------------------------------
248
private
:
249
253
unsigned
int
mySamples
;
254
258
Quantity
myExp
;
259
264
Quantity
myExp2
;
265
269
Quantity
myMax
;
270
274
Quantity
myMin
;
275
276
280
Quantity
myMedian
;
281
282
287
Container
myValues
;
288
289
293
bool
myStoreSamples
;
294
295
302
bool
myIsTerminated
;
303
304
};
305
312
template
<
typename
TQuantity>
313
std::ostream&
314
operator<<
( std::ostream & thatStream,
315
const
Statistic<TQuantity>
& that_object_to_display );
316
317
318
}
// namespace DGtal
319
320
322
// Includes inline functions/methods if necessary.
323
#include "DGtal/math/Statistic.ih"
324
325
// //
327
328
#endif
// !defined Statistic_h
329
330
#undef Statistic_RECURSES
331
#endif
// else defined(Statistic_RECURSES)
DGtal::Statistic
Aim: This class processes a set of sample values for one variable and can then compute different stat...
Definition
Statistic.h:70
DGtal::Statistic< Quantity >::myMax
Quantity myMax
Definition
Statistic.h:269
DGtal::Statistic::end
ConstIterator end() const
DGtal::Statistic< Quantity >::Quantity
Quantity Quantity
Definition
Statistic.h:74
DGtal::Statistic< Quantity >::ConstIterator
Container::const_iterator ConstIterator
Definition
Statistic.h:77
DGtal::Statistic::operator+
Statistic operator+(const Statistic &other) const
DGtal::Statistic::OK
bool OK() const
DGtal::Statistic::variance
double variance() const
DGtal::Statistic::terminate
void terminate()
DGtal::Statistic< Quantity >::myStoreSamples
bool myStoreSamples
Definition
Statistic.h:293
DGtal::Statistic< Quantity >::myExp2
Quantity myExp2
Definition
Statistic.h:264
DGtal::Statistic< Quantity >::myExp
Quantity myExp
Definition
Statistic.h:258
DGtal::Statistic::median
Quantity median()
DGtal::Statistic::size
unsigned int size() const
DGtal::Statistic::samples
unsigned int samples() const
DGtal::Statistic< Quantity >::myMedian
Quantity myMedian
Definition
Statistic.h:280
DGtal::Statistic::begin
ConstIterator begin() const
DGtal::Statistic::clear
void clear()
DGtal::Statistic::mean
double mean() const
DGtal::Statistic< Quantity >::myValues
Container myValues
Definition
Statistic.h:287
DGtal::Statistic::Statistic
Statistic(bool storeSample=false)
DGtal::Statistic::operator+=
Statistic & operator+=(const Statistic &other)
DGtal::Statistic::~Statistic
~Statistic()
DGtal::Statistic::Statistic
Statistic(const Statistic &other)
DGtal::Statistic::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((concepts::CCommutativeRing< Quantity >))
DGtal::Statistic< Quantity >::myMin
Quantity myMin
Definition
Statistic.h:274
DGtal::Statistic::operator=
Statistic & operator=(const Statistic &other)
DGtal::Statistic::unbiasedVariance
double unbiasedVariance() const
DGtal::Statistic< Quantity >::mySamples
unsigned int mySamples
Definition
Statistic.h:253
DGtal::Statistic::max
Quantity max() const
DGtal::Statistic< Quantity >::Container
std::vector< Quantity > Container
Definition
Statistic.h:76
DGtal::Statistic::operator[]
Quantity operator[](unsigned int i) const
DGtal::Statistic< Quantity >::myIsTerminated
bool myIsTerminated
Definition
Statistic.h:302
DGtal::Statistic::selfDisplay
void selfDisplay(std::ostream &that_stream) const
DGtal::Statistic::addValues
void addValues(Iter b, Iter e)
DGtal::Statistic::min
Quantity min() const
DGtal::Statistic::addValue
void addValue(Quantity v)
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
Definition
ClosedIntegerHalfPlane.h:49
DGtal::operator<<
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)
DGtal::concepts::CCommutativeRing
Aim: Defines the mathematical concept equivalent to a unitary commutative ring.
Definition
CCommutativeRing.h:101
src
DGtal
math
Statistic.h
Generated on
for DGtal by
1.18.0