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) {
219 value = JMATH::getZero<T>();
228 template<
class JElement_t,
class JDistance_t>
233 for (iterator i = collection.begin(); i != collection.end(); ++i) {
246 inline void copy(
const T& input, T& output)
258 template<
class JElement_t,
class JDistance_t,
class JKey_t,
class JValue_t>
265 for (const_iterator i = input.begin(); i != input.end(); ++i) {
266 copy(i->getY(), output.
get(i->getX()));
280 template<
class T,
class JAbscissa_t>
292 template<
class JElement_t,
class JDistance_t>
302 for (iterator i = collection.begin(); i != collection.end(); ++i) {
327 template<
class JElement_t,
class JDistance_t>
333 for (iterator i = collection.begin(); i != collection.end(); ++i) {
337 if (collection.
getSize() > 1) {
339 for (iterator j = collection.begin(), i = j++; j != collection.end(); ++i, ++j) {
340 j->getY() += i->getY();
The elements in a collection are sorted according to their abscissa values and a given distance opera...
void reset(JCLBInput &data, size_t size)
Reset CLB buffers.
static const JZero zero
Function object to assign zero value.
Definition of zero value for any class.
Auxiliary template class for type bool.
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.