DGtal 1.3.0
Loading...
Searching...
No Matches
MultiStatistics.h
1
17#pragma once
18
32#if defined(MultiStatistics_RECURSES)
33#error Recursive header files inclusion detected in MultiStatistics.h
34#else // defined(MultiStatistics_RECURSES)
36#define MultiStatistics_RECURSES
37
38#if !defined MultiStatistics_h
40#define MultiStatistics_h
41
43// Inclusions
44#include <iostream>
45#include "DGtal/base/Common.h"
47
48namespace DGtal
49{
50
52// class MultiStatistics
67{
68 // ----------------------- Standard services ------------------------------
69public:
70
71
76
77
78
86 MultiStatistics( const unsigned int size, const bool storeSamples = false );
87
88
89
101 static void read( std::istream & in, MultiStatistics & samples,
102 const std::vector<unsigned int> & indices );
103
104
105
106 // ----------------------- Accessors ------------------------------
107 public:
108
112 inline unsigned int nb() const;
113
114
120 inline unsigned int samples( const unsigned int k ) const;
121
129 inline double mean( const unsigned int k ) const;
130
138 inline double variance( const unsigned int k ) const;
139
147 inline double unbiasedVariance( const unsigned int k ) const;
148
156 inline double max( const unsigned int k ) const;
157
158
166 inline unsigned int maxIndice( unsigned int k ) const;
167
168
169
177 inline double min( const unsigned int k ) const;
178
179
180
188 inline unsigned int minIndice(const unsigned int k ) const;
189
190
191
204 inline double value( const unsigned int k, const unsigned int i ) const;
205
206
207
214 void addValue( unsigned int k, double v );
215
216
232 template <class Iter>
233 void addValues(const unsigned int k, Iter b, Iter e );
234
242 void terminate();
243
244
256 void init( unsigned int size, bool storeSamples );
257
258
263 void clear();
264
265
272 void erase();
273
286 double covariance( const unsigned int x, const unsigned int y,
287 const unsigned int s = 0, unsigned int e = 0 ) const;
288
299 std::pair<double,double> linearRegression( const unsigned int x,
300 const unsigned int y ) const;
301
302
303
313 double median( const unsigned int k );
314
315
316
317
318
319 // ----------------------- Interface --------------------------------------
320public:
321
326 void selfDisplay ( std::ostream & out ) const;
327
332 bool isValid() const;
333
334 // ------------------------- Protected Datas ------------------------------
335private:
336
337 // ------------------------- Private Datas --------------------------------
338private:
339
343 unsigned int myNb;
344
348 unsigned int* mySamples;
349
354 double* myExp;
355
360 double* myExp2;
361
365 double* myVar;
366
371
375 double* myMax;
376
380 unsigned int* myIndiceMax;
381
385 double* myMin;
386
390 unsigned int* myIndiceMin;
391
396
401 std::vector<double>* myValues;
402
408
409 // ------------------------- Hidden services ------------------------------
410protected:
411
417
418private:
419
426
434
435 // ------------------------- Internals ------------------------------------
436private:
437
438}; // end of class MultiStatistics
439
440
447std::ostream&
448operator<< ( std::ostream & out, const MultiStatistics & object );
449
450
451} // namespace DGtal
452
453
455// Includes inline functions.
456#if !defined(BUILD_INLINE)
457#include "DGtal/math/MultiStatistics.ih"
458#endif
459
460
461// //
463
464#endif // !defined MultiStatistics_h
465
466#undef MultiStatistics_RECURSES
467#endif // else defined(MultiStatistics_RECURSES)
Aim: This class stores a set of sample values for several variables and can then compute different st...
double variance(const unsigned int k) const
static void read(std::istream &in, MultiStatistics &samples, const std::vector< unsigned int > &indices)
double max(const unsigned int k) const
MultiStatistics(const unsigned int size, const bool storeSamples=false)
double mean(const unsigned int k) const
void addValue(unsigned int k, double v)
void addValues(const unsigned int k, Iter b, Iter e)
void init(unsigned int size, bool storeSamples)
double median(const unsigned int k)
void selfDisplay(std::ostream &out) const
unsigned int maxIndice(unsigned int k) const
double min(const unsigned int k) const
unsigned int nb() const
MultiStatistics & operator=(const MultiStatistics &other)
unsigned int * mySamples
double covariance(const unsigned int x, const unsigned int y, const unsigned int s=0, unsigned int e=0) const
std::pair< double, double > linearRegression(const unsigned int x, const unsigned int y) const
unsigned int minIndice(const unsigned int k) const
unsigned int samples(const unsigned int k) const
unsigned int * myIndiceMax
unsigned int * myIndiceMin
std::vector< double > * myValues
MultiStatistics(const MultiStatistics &other)
double value(const unsigned int k, const unsigned int i) const
double unbiasedVariance(const unsigned int k) const
DGtal is the top-level namespace which contains all DGtal functions and types.
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)