33 #include "DGtal/math/Statistic.h"
34 #include "DGtal/math/Histogram.h"
39 using namespace DGtal;
50 double v = ((double)rand()) / (
double) RAND_MAX;
51 return v * ( last - first ) + first;
56 unsigned int nbok = 0;
60 for(
unsigned int k=0; k < 1000; k++)
67 for (
unsigned int i = 0; i < hist.
size(); ++i )
68 std::cout << i <<
" " << hist.
pdf( i ) <<
" " << hist.
cdf( i ) << std::endl;
69 ++nb; nbok += hist.
cdf( hist.
size()-1 ) > 0.9999 ? 1 : 0;
75 unsigned int nbok = 0;
79 for(
unsigned int k=0; k < 1000; k++)
86 for (
unsigned int i = 0; i < hist.
size(); ++i )
87 std::cout << i <<
" " << hist.
pdf( i ) <<
" " << hist.
cdf( i ) << std::endl;
88 ++nb; nbok += hist.
cdf( hist.
size()-1 ) > 0.9999 ? 1 : 0;
94 unsigned int nbok = 0;
98 for(
unsigned int k=0; k < 1000; k++)
106 for (
unsigned int i = 0; i < hist.
size(); ++i )
107 std::cout << i <<
" " << hist.
pdf( i ) <<
" " << hist.
cdf( i ) << std::endl;
108 ++nb; nbok += hist.
cdf( hist.
size()-1 ) > 0.9999 ? 1 : 0;
123 trace.
emphase() << ( res ?
"Passed." :
"Error." ) << endl;
Aim: Represents a typical histogram in statistics, which is a discrete estimate of the probability di...
void addValues(TInputIterator it, TInputIterator itE)
void init(Clone< Binner > binner)
Aim: This class processes a set of sample values for one variable and can then compute different stat...
ConstIterator end() const
ConstIterator begin() const
void addValue(Quantity v)
void beginBlock(const std::string &keyword="")
DGtal is the top-level namespace which contains all DGtal functions and types.
bool testHistogramUniform()
bool testHistogramGaussian()
bool testHistogramGaussian2()
double getRandomNumber(double first, double last)