1 #ifndef __JTOOLS__JQUANTILES__
2 #define __JTOOLS__JQUANTILES__
20 namespace JPP {
using namespace JTOOLS; }
47 template<
class JFunction1D_t>
51 const JFunction1D_t&
f,
53 const double eps = 1.0e-6)
55 static const double R = 0.61803399;
56 static const double C = 1.0 -
R;
62 if (fabs(xc-xb) > fabs(xb-xa)) {
73 while (fabs(x3-x0) > eps*(fabs(x1)+fabs(x2))) {
131 template<
class JFunction1D_t>
133 const double Q = 1.0,
134 const double eps = 1.0e-6) :
152 template<
class JFunction1D_t>
154 const JFunction1D_t& f1,
155 const double Q = 1.0,
156 const double eps = 1.0e-6) :
162 set(abscissa, f1,
Q, eps);
173 template<
class JFunction1D_t>
174 void set(
const JFunction1D_t& f1,
175 const double Q = 1.0,
176 const double eps = 1.0e-6)
178 typedef typename JFunction1D_t::const_iterator const_iterator;
187 const_iterator p = f1.begin();
189 for (const_iterator i = f1.begin(); i != f1.end(); ++i) {
190 if (i->getY() > p->getY()) {
200 if (p != f1.begin()) {
202 const double xa = (--p)->
getX();
203 const double xb = (++p)->
getX();
205 if (++p != f1.end()) {
207 const double xc = p->getX();
218 if (
Q > 0.0 &&
Q <= 1.0) {
240 }
else if (
Q <= 0.0) {
251 for (
double xmin = f1.begin()->getX(), xmax =
Xmax,
v = 0.5*
Ymax; ; ) {
253 const double x = 0.5 * (xmin + xmax);
256 if (fabs(y - v) < eps*v || xmax - xmin < eps) {
267 for (
double xmin =
Xmax, xmax = f1.rbegin()->getX(), v = 0.5*
Ymax; ; ) {
269 const double x = 0.5 * (xmin + xmax);
272 if (fabs(y - v) < eps*v || xmax - xmin < eps) {
293 template<
class JFunction1D_t>
295 const JFunction1D_t& f1,
296 const double Q = 1.0,
297 const double eps = 1.0e-6)
301 buffer.configure(abscissa, f1);
Q(UTCMax_s-UTCMin_s)-livetime_s
The elements in a collection are sorted according to their abscissa values and a given distance opera...
This include file containes various data structures that can be used as specific return types for the...
static const double C
Physics constants.
then echo Variable JPP_DIR undefined exit fi source $JPP_DIR setenv sh $JPP_DIR set_variable NORTH set_variable EAST set_variable SOUTH set_variable WEST set_variable WORKDIR tmp set_variable R set_variable CT set_variable YMAX set_variable YMIN if do_usage *then usage $script[distance] fi case set_variable R
Auxiliary class to define a range between two values.
Exception for an empty collection.