|
Go to the documentation of this file. 1 #ifndef NPSTAT_ARRAYSTATS_HH_
2 #define NPSTAT_ARRAYSTATS_HH_
30 template< typename Numeric>
31 void arrayStats( const Numeric* arr, unsigned long arrLen,
32 double* mean, double* stdev,
33 double* skewness=0, double* kurtosis=0);
36 template< typename Numeric>
37 long double arrayMoment( const Numeric* arr, unsigned long arrLen,
38 long double center, unsigned order);
45 template< typename Numeric>
47 long double center, unsigned maxOrder,
48 long double* moments);
58 template< typename Numeric>
60 unsigned maxOrder, long double* cumulants);
75 template< typename Numeric>
77 unsigned maxOrder, long double* moments,
78 long double* momentUncertainties = 0);
93 double* mean, unsigned lengthMean);
99 template< class Array, unsigned Len>
111 template< class Array>
113 double* mean, double* stdev,
114 double* skewness, double* kurtosis);
130 template< class Numeric>
132 double xmin, double xmax, const double* qvalues,
133 double* quantiles, unsigned nqvalues);
143 template< class Numeric>
145 bool normalize = false);
153 template< typename Real, typename Numeric>
158 inline void arrayStats_2( const double* arr, unsigned long arrLen,
159 double* mean, double* stdev,
160 double* skewness, double* kurtosis)
162 arrayStats(arr, arrLen, mean, stdev, skewness, kurtosis);
165 inline std::vector<double> arrayCumulants_2(
166 const double* arr, unsigned long arrLen, unsigned maxOrder)
168 std::vector<long double> vec(maxOrder+1U);
170 return std::vector<double>(vec.begin(), vec.end());
173 inline std::vector<double> arrayMoments_2(
174 const double* arr, unsigned long arrLen,
175 double center, unsigned maxOrder)
177 std::vector<long double> vec(maxOrder+1U);
179 return std::vector<double>(vec.begin(), vec.end());
182 inline std::vector<std::pair<double,double> > arrayCentralMoments_2(
183 const double* arr, unsigned long arrLen, unsigned maxOrder)
185 std::vector<long double> buffer(2U*maxOrder+2U);
186 long double* moments = &buffer[0];
187 long double* uncerts = moments + (maxOrder + 1U);
189 std::vector<std::pair<double,double> > result(maxOrder + 1U);
190 for ( unsigned i=0; i<=maxOrder; ++i)
191 result[i] = std::pair<double,double>(moments[i], uncerts[i]);
195 double poissonLogLikelihood_2(
196 const double* means, unsigned long meansLen,
197 const double* counts, unsigned long len)
199 if (meansLen != len) throw std::invalid_argument(
200 "In npstat::poissonLogLikelihood_2: incompatible input arrays");
206 #include "npstat/stat/arrayStats.icc"
Template to represent rectangles, boxes, and hyperboxes.
Definition: AbsArrayProjector.hh:14
double poissonLogLikelihood(const Real *means, const Numeric *counts, unsigned long len)
void arrayCoordMean(const Array &a, const BoxND< double > &limits, double *mean, unsigned lengthMean)
void arrayStats(const Numeric *arr, unsigned long arrLen, double *mean, double *stdev, double *skewness=0, double *kurtosis=0)
double arrayEntropy(const Numeric *p, unsigned long len, bool normalize=false)
void arrayMoments(const Numeric *arr, unsigned long arrLen, long double center, unsigned maxOrder, long double *moments)
void arrayCoordCovariance(const Array &a, const BoxND< double > &limits, Matrix< double, Len > *covarianceMatrix)
void arrayCentralMoments(const Numeric *arr, unsigned long arrLen, unsigned maxOrder, long double *moments, long double *momentUncertainties=0)
void arrayCumulants(const Numeric *arr, unsigned long arrLen, unsigned maxOrder, long double *cumulants)
void arrayShape1D(const Array &a, double xmin, double xmax, double *mean, double *stdev, double *skewness, double *kurtosis)
long double arrayMoment(const Numeric *arr, unsigned long arrLen, long double center, unsigned order)
void arrayQuantiles1D(const Numeric *data, unsigned long len, double xmin, double xmax, const double *qvalues, double *quantiles, unsigned nqvalues)
|