1 #ifndef NPSTAT_HISTONDCDF_HH_
2 #define NPSTAT_HISTONDCDF_HH_
47 template <
typename Numeric>
49 const double* iniScales,
const unsigned lenScales,
50 const double eps=1.0e-12)
51 : cdf_(
ArrayND<double>(histo.binContents()).template
52 cdfArray<long double>()),
54 startBox_(
BoxND<double>::sizeTwoBox(lenScales)),
59 if (histo.
dim() == 0)
throw std::invalid_argument(
60 "In npstat::HistoNDCdf constructor: "
61 "can not use zero-dimensional histograms");
63 "In npstat::HistoNDCdf constructor: histogram is not a density");
64 if (lenScales != histo.
dim())
throw std::invalid_argument(
65 "In npstat::HistoNDCdf constructor: incompatible number of scales");
67 for (
unsigned i=0; i<dim_; ++i)
69 if (iniScales[i] <= 0.0)
throw std::invalid_argument(
70 "In npstat::HistoNDCdf constructor: all scales must be positive");
71 startBox_[i].
expand(iniScales[i]);
79 inline unsigned dim()
const {
return dim_;}
85 double cdf(
const double* x,
unsigned dim)
const;
94 void coveringBox(
double coveredFraction,
const double* boxCenter,
100 std::vector<HistoAxis> axes_;
102 mutable std::vector<double> buf_;
Arbitrary-dimensional histogram template.
Definition: ArrayND.hh:93
unsigned long length() const
Definition: ArrayND.hh:320
Numeric & linearValue(unsigned long index)
Definition: HistoNDCdf.hh:26
unsigned dim() const
Definition: HistoNDCdf.hh:79
BoxND< double > boundingBox() const
void coveringBox(double coveredFraction, const double *boxCenter, unsigned dimCenter, BoxND< double > *coverBox) const
double boxCoverage(const BoxND< double > &box) const
HistoNDCdf(const HistoND< Numeric > &histo, const double *iniScales, const unsigned lenScales, const double eps=1.0e-12)
Definition: HistoNDCdf.hh:48
double cdf(const double *x, unsigned dim) const
Definition: HistoND.hh:46
const ArrayND< Numeric > & binContents() const
Definition: HistoND.hh:197
unsigned dim() const
Definition: HistoND.hh:187
Definition: AbsArrayProjector.hh:14
bool arrayIsDensity(const Arr &arr)