1 #ifndef __JTOOLS__JTOOLSTOOLKIT__
2 #define __JTOOLS__JTOOLSTOOLKIT__
23 namespace JPP {
using namespace JTOOLS; }
47 template<
class JContainer_t,
50 inline typename JContainer_t::ordinate_type
53 const typename JContainer_t::ordinate_type eps =
JMATH::zero)
55 typedef typename JContainer_t::ordinate_type ordinate_type;
56 typedef typename JContainer_t::abscissa_type abscissa_type;
61 if (input.getSize() > 1) {
65 const ordinate_type V =
integrate(input, buffer);
73 typename buffer_type::const_iterator i = buffer.begin();
75 for ( ; i != buffer.end() && i->getY() <= 0.5 * eps * V; ++i) {}
77 if (i != buffer.end()) {
82 JValue_t y = i->getX();
89 for (++i; i != buffer.end(); ++i) {
132 template<
class JContainer_t>
133 inline typename JContainer_t::ordinate_type
getIntegral(
const JContainer_t& input)
147 template<
class JFunction_t,
148 template<
class,
class,
class>
class JMap_t,
150 inline typename JFunction_t::ordinate_type
153 typedef typename JFunction_t::abscissa_type abscissa_type;
154 typedef typename JFunction_t::ordinate_type ordinate_type;
155 typedef typename JFunction_t::distance_type distance_type;
159 distance_type> buffer_type;
162 static buffer_type buffer;
164 buffer.configure(input);
166 typename buffer_type::iterator out = buffer.begin();
168 for (
typename multimap_type::const_iterator
in = input.begin();
in != input.end(); ++
in, ++out) {
184 template<
class JFunction_t,
185 template<
class,
class,
class>
class JMap_t,
187 inline typename JFunction_t::ordinate_type
190 typedef typename JFunction_t::abscissa_type abscissa_type;
191 typedef typename JFunction_t::ordinate_type ordinate_type;
192 typedef typename JFunction_t::distance_type distance_type;
196 distance_type> buffer_type;
201 for (
typename multifunction_type::const_iterator i = input.begin(); i != input.end(); ++i) {
221 value = JMATH::getZero<T>();
230 template<
class JElement_t,
class JDistance_t>
235 for (iterator i = collection.begin(); i != collection.end(); ++i) {
250 inline void copy(
const T& input,
T& output)
262 template<
class JElement_t,
class JDistance_t,
class JKey_t,
class JValue_t>
269 for (const_iterator i = input.begin(); i != input.end(); ++i) {
270 copy(i->getY(), output.
get(i->getX()));
284 template<
class T,
class JAbscissa_t>
296 template<
class JElement_t,
class JDistance_t>
306 for (iterator i = collection.begin(); i != collection.end(); ++i) {
331 template<
class JElement_t,
class JDistance_t>
337 for (iterator i = collection.begin(); i != collection.end(); ++i) {
341 if (collection.
getSize() > 1) {
343 for (iterator
j = collection.begin(), i =
j++;
j != collection.end(); ++i, ++
j) {
344 j->getY() += i->getY();
The elements in a collection are sorted according to their abscissa values and a given distance opera...
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
esac print_variable DETECTOR INPUT_FILE OUTPUT_FILE CDF for TYPE in
static const JZero zero
Function object to assign zero value.
Definition of zero value for any class.
Auxiliary template class for type bool.
do set_variable OUTPUT_DIRECTORY $WORKDIR T
General purpose class for a collection of sorted elements.
Exception for division by zero.
void copy(const Head &from, JHead &to)
Copy header from from to to.
Exception for an empty collection.