1 #ifndef __JTOOLS__JHERMITESPLINE__
2 #define __JTOOLS__JHERMITESPLINE__
22 namespace JPP {
using namespace JTOOLS; }
46 template<
class JElement_t,
template<
class,
class>
class JCollection_t,
class JDistance_t>
48 public JCollection_t<JElement_t, JDistance_t>,
62 typedef typename collection_type::iterator
iterator;
77 if (this->size() >= 2
u) {
82 i->setU((j->getY() -
i->getY()) / this->
getDistance(
i->getX(), j->getX()));
88 i->setU((j->getY() -
i->getY()) / this->
getDistance(
i->getX(), j->getX()));
91 for (
iterator k = this->begin(),
i =
k++,
j =
k++;
k != this->end(); ++
i, ++
j, ++
k) {
92 j->setU(0.5 * ((j->getY() -
i->getY()) / this->
getDistance(
i->getX(), j->getX()) +
93 (
k->getY() - j->getY()) / this->
getDistance(j->getX(),
k->getX())));
98 for (
iterator j = this->begin(),
i = j++; j != this->end(); ++
i, ++
j) {
99 if (
i->getY() == j->getY()) {
104 for (
iterator j = this->begin(),
i = j++; j != this->end(); ++
i, ++
j) {
113 i->setU(v*
i->getU());
114 j->setU(v*j->getU());
160 template<
class JElement_t,
161 template<
class,
class>
class JCollection_t,
170 template<
class JElement_t,
template<
class,
class>
class JCollection_t,
class JDistance_t>
176 public virtual JFunction<typename JElement_t::abscissa_type,
177 typename JResultType<typename JElement_t::ordinate_type>::result_type>
190 typedef typename collection_type::iterator
iterator;
218 if (this->size() <= 1
u) {
225 std::ostringstream os;
227 os << __FILE__ <<
':' << __LINE__ <<
" not enough data " <<
STREAM(
"?") <<
x;
235 if ((p == this->begin() && this->
getDistance(x, (p++)->getX()) > distance_type::precision) ||
236 (p == this->end() && this->
getDistance((--p)->getX(), x) > distance_type::precision)) {
243 std::ostringstream os;
245 os << __FILE__ <<
':' << __LINE__ <<
" abscissa out of range "
246 <<
STREAM(
"?") << x <<
" <> "
247 <<
STREAM(
"?") << this->begin() ->getX() <<
' '
248 <<
STREAM(
"?") << this->rbegin()->getX();
256 const double dx = this->
getDistance(p->getX(), q->getX());
259 return h00(t)*p->getY() +
h10(t)*p->getU()*dx +
h01(t)*q->getY() +
h11(t)*q->getU()*dx;
264 using collection_type::h00;
265 using collection_type::h10;
266 using collection_type::h01;
267 using collection_type::h11;
274 template<
class JElement_t,
template<
class,
class>
class JCollection_t,
class JDistance_t>
280 public virtual JFunction<typename JElement_t::abscissa_type,
281 JResultDerivative<typename JResultType<typename JElement_t::ordinate_type>::result_type> >
294 typedef typename collection_type::iterator
iterator;
322 if (this->size() <= 1
u) {
329 std::ostringstream os;
331 os << __FILE__ <<
':' << __LINE__ <<
" not enough data " <<
STREAM(
"?") <<
x;
340 if ((p == this->begin() && this->
getDistance(x, (p++)->getX()) > distance_type::precision) ||
341 (p == this->end() && this->
getDistance((--p)->getX(), x) > distance_type::precision)) {
348 std::ostringstream os;
350 os << __FILE__ <<
':' << __LINE__ <<
" abscissa out of range "
351 <<
STREAM(
"?") << x <<
" <> "
352 <<
STREAM(
"?") << this->begin() ->getX() <<
' '
353 <<
STREAM(
"?") << this->rbegin()->getX();
361 const double dx = this->
getDistance(p->getX(), q->getX());
364 result.f =
h00 (t)*p->getY() +
h10 (t)*p->getU()*dx +
h01 (t)*q->getY() +
h11 (t)*q->getU()*dx;
373 using collection_type::h00;
374 using collection_type::h10;
375 using collection_type::h01;
376 using collection_type::h11;
378 using collection_type::h00p;
379 using collection_type::h10p;
380 using collection_type::h01p;
381 using collection_type::h11p;
398 template<
class JElement_t,
template<
class,
class>
class JCollection_t,
class JDistance_t>
404 public virtual JFunction<typename JElement_t::abscissa_type,
405 JResultPDF<typename JResultType<typename JElement_t::ordinate_type>::result_type> >
418 typedef typename collection_type::iterator
iterator;
446 if (this->size() <= 1
u) {
453 std::ostringstream os;
455 os << __FILE__ <<
':' << __LINE__ <<
" not enough data " <<
STREAM(
"?") <<
x;
463 if (p == this->begin() && this->
getDistance(x, (p++)->getX()) > distance_type::precision) {
472 result.V = this->rbegin()->getIntegral();
476 std::ostringstream os;
478 os << __FILE__ <<
':' << __LINE__ <<
" abscissa out of range " <<
STREAM(
"?") << x <<
" < " <<
STREAM(
"?") << this->begin() ->getX();
485 }
else if (p == this->end() && this->
getDistance((--p)->getX(), x) > distance_type::precision) {
493 result.v = this->rbegin()->getIntegral();
494 result.V = this->rbegin()->getIntegral();
498 std::ostringstream os;
500 os << __FILE__ <<
':' << __LINE__ <<
" abscissa out of range " <<
STREAM(
"?") << x <<
" > " <<
STREAM(
"?") << this->rbegin()->getX();
510 const double dx = this->
getDistance(p->getX(), q->getX());
513 result.f =
h00 (t)*p->getY() +
h10 (t)*p->getU()*dx +
h01 (t)*q->getY() +
h11 (t)*q->getU()*dx;
515 result.v = (p->getIntegral() +
516 (
H00 (t)*p->getY() +
H10 (t)*p->getU()*dx +
H01 (t)*q->getY() +
H11 (t)*q->getU()*dx)*dx);
517 result.V = this->rbegin()->getIntegral();
525 using collection_type::h00;
526 using collection_type::h10;
527 using collection_type::h01;
528 using collection_type::h11;
530 using collection_type::h00p;
531 using collection_type::h10p;
532 using collection_type::h01p;
533 using collection_type::h11p;
535 using collection_type::H00;
536 using collection_type::H10;
537 using collection_type::H01;
538 using collection_type::H11;
545 if (!this->empty()) {
551 for (
iterator j = this->begin(),
i =
j++;
j != this->end(); ++
i, ++
j) {
560 j->setIntegral(
i->getIntegral() + v +
w);
575 template<
class JElement_t,
576 template<
class,
class>
class JCollection_t,
577 class JResult_t =
typename JElement_t::ordinate_type,
581 public virtual JFunction1D<typename JElement_t::abscissa_type, JResult_t>
615 template<
class JKey_t,
617 template<
class,
class,
class>
class JMap_t,
621 public JMap_t<JKey_t, JValue_t, JDistance_t>,
636 typedef typename collection_type::iterator
iterator;
688 for (
iterator i = this->begin();
i != this->end(); ++
i) {
707 template<
class JElement_t,
708 template<
class,
class>
class JCollection_t,
711 inline typename JElement_t::ordinate_type
720 if (input.getSize() > 1) {
722 output.
put(input.begin()->getX(),
V);
724 for (const_iterator
j = input.begin(),
i =
j++;
j != input.end(); ++
i, ++
j) {
726 const double dx = input.getDistance(
i->getX(),
j->getX());
727 const ordinate_type
y =
i->getY() +
j->getY();
728 const ordinate_type z =
i->getU() -
j->getU();
730 const ordinate_type
v = dx * 0.50 *
y;
731 const ordinate_type
w = dx * 1.00 * z*dx/12.0;
735 output.
put(
j->getX(),
V);
752 template<
class JElement_t,
753 template<
class,
class>
class JCollection_t,
755 inline typename JElement_t::ordinate_type
763 if (input.getSize() > 1) {
765 for (const_iterator
i = input.begin();
i != input.end(); ++
i) {
766 output.
put(
i->getX(),
i->getIntegral());
769 return input.rbegin()->getIntegral();
then fatal No hydrophone data file $HYDROPHONE_TXT fi sort gr k
std::vector< event_type > data_type
Exception for a functional operation.
This include file containes various data structures that can be used as specific return types for the...
static const JZero zero
Function object to assign zero value.
V(JDAQEvent-JTriggerReprocessor)*1.0/(JDAQEvent+1.0e-10)
Definition of zero value for any class.
double getDistance(const JFirst_t &first, const JSecond_t &second)
Get distance between objects.
Exception for missing value.
Auxiliary data structure for handling std::ostream.
Exception for division by zero.
Exception for accessing a value in a collection that is outside of its range.