1#ifndef __JTOOLS__JQUANTILES__
2#define __JTOOLS__JQUANTILES__
57 template<
class JFunction1D_t>
60 const double eps = 1.0e-6) :
78 template<
class JFunction1D_t>
80 const JFunction1D_t& f1,
82 const double eps = 1.0e-6) :
88 set(abscissa, f1, Q, eps);
99 template<
class JFunction1D_t>
100 void set(
const JFunction1D_t& f1,
101 const double Q = 1.0,
102 const double eps = 1.0e-6)
104 typedef typename JFunction1D_t::const_iterator const_iterator;
113 const_iterator p = f1.begin();
115 for (const_iterator i = f1.begin(); i != f1.end(); ++i) {
116 if (i->getY() > p->getY()) {
126 if (p != f1.begin()) {
128 const double xa = (--p)->
getX();
129 const double xb = (++p)->
getX();
131 if (++p != f1.end()) {
133 const double xc = p->getX();
144 if (Q > 0.0 && Q <= 1.0) {
166 }
else if (Q <= 0.0) {
177 for (
double xmin = f1.begin()->getX(), xmax =
Xmax, v = 0.5*
Ymax; ; ) {
179 const double x = 0.5 * (xmin + xmax);
182 if (fabs(y - v) < eps*v || xmax - xmin < eps) {
193 for (
double xmin =
Xmax, xmax = f1.rbegin()->getX(), v = 0.5*
Ymax; ; ) {
195 const double x = 0.5 * (xmin + xmax);
198 if (fabs(y - v) < eps*v || xmax - xmin < eps) {
219 template<
class JFunction1D_t>
221 const JFunction1D_t& f1,
222 const double Q = 1.0,
223 const double eps = 1.0e-6)
227 buffer.configure(abscissa, f1);
305 template<
class JFunction1D_t>
309 const JFunction1D_t& f,
311 const double eps = 1.0e-6)
313 static const double R = 0.61803399;
314 static const double C = 1.0 - R;
320 if (fabs(xc-xb) > fabs(xb-xa)) {
331 while (fabs(x3-x0) > eps*(fabs(x1)+fabs(x2))) {
The elements in a collection are sorted according to their abscissa values and a given distance opera...
Auxiliary class to define a range between two values.
This include file containes various data structures that can be used as specific return types for the...
Exception for an empty collection.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).