1 #ifndef __JTOOLS__JSPLINE__ 
    2 #define __JTOOLS__JSPLINE__ 
   22 namespace JPP { 
using namespace JTOOLS; }
 
   35   template<
class JOrdinate_t>
 
  121         throw JNoValue(
"JSplineBounds: missing 1st derivative.");
 
  135         throw JNoValue(
"JSplineBounds: missing 1st derivative.");
 
  151   template<
class JOrdinate_t>
 
  153                                                        const JOrdinate_t fpAtXmax)
 
  175   template<
class JElement_t, 
template<
class, 
class> 
class JCollection_t, 
class JDistance_t>
 
  177     public JCollection_t<JElement_t, JDistance_t>,
 
  190     typedef typename collection_type::iterator                                   
iterator;
 
  203       const int numberOfElements = this->size();
 
  207       if (numberOfElements > 2) {
 
  216           const double        dx = this->
getDistance(i->getX(),  j->getX());
 
  232         for (
iterator k = this->begin(), 
i = 
k++, 
j = 
k++; 
k != this->end(); ++
i, ++
j, ++
k, ++index) {
 
  243           const double h   = sig * buffer[index-1] + 2.0;
 
  245           buffer[index]    = (sig - 1.0) / h;
 
  250           j->setU((6.0 * j->getU() / this->
getDistance(x1, x3)  -  sig * 
i->getU()) / h);
 
  259           index = numberOfElements - 2;
 
  261           const double        dx = this->
getDistance(i->getX(),  j->getX());
 
  266           i->setU((i->getU() - 0.5*j->getU()) / (0.5*buffer[index] + 1.0));
 
  277         index = numberOfElements - 2;
 
  279         for ( ; j != this->rend(); ++
i, ++
j, --index) {
 
  280           j->setU(j->getU() + i->getU() * buffer[index]);
 
  285         for (
iterator i = this->begin(); 
i != this->end(); ++
i) {
 
  313   template<
class JElement_t, 
 
  314            template<
class, 
class> 
class JCollection_t,
 
  323   template<
class JElement_t, 
template<
class, 
class> 
class JCollection_t, 
class JDistance_t>
 
  329     public virtual JFunction<typename JElement_t::abscissa_type, 
 
  330                              typename JResultType<typename JElement_t::ordinate_type>::result_type>
 
  343     typedef typename collection_type::iterator                                   
iterator;
 
  371       if (this->size() > 1
u) {
 
  375         if ((p == this->begin() && this->
getDistance(x, (p++)->getX()) > distance_type::precision) ||
 
  376             (p == this->end()   && this->
getDistance((--p)->getX(), x) > distance_type::precision)) {
 
  378           std::ostringstream os;
 
  380           os << __FILE__ << 
':' << __LINE__ << 
" abscissa out of range "  
  381              << 
STREAM(
"?") << x                      << 
" <> "  
  382              << 
STREAM(
"?") << this->begin() ->getX() << 
' ' 
  383              << 
STREAM(
"?") << this->rbegin()->getX();
 
  390         const double dx = this->
getDistance(p->getX(), q->getX());
 
  392         const double b  = 1.0 - 
a;
 
  394         return (a * p->getY() + b * q->getY()
 
  395                 - a*b * ((a + 1.0)*p->getU() + (b + 1.0)*q->getU()) * dx*dx/6);
 
  397       } 
else if (this->size() == 1
u && this->
getDistance(x, this->begin()->getX()) <= distance_type::precision) {
 
  399         return this->begin()->getY();
 
  403         std::ostringstream os;
 
  405         os << __FILE__ << 
':' << __LINE__ << 
" not enough data " << 
STREAM(
"?") << 
x;
 
  416   template<
class JElement_t, 
template<
class, 
class> 
class JCollection_t, 
class JDistance_t>
 
  422     public virtual JFunction<typename JElement_t::abscissa_type, 
 
  423                              JResultDerivative<typename JResultType<typename JElement_t::ordinate_type>::result_type> >
 
  436     typedef typename collection_type::iterator                                   
iterator;
 
  466       if (this->size() <= 1
u) {
 
  468         std::ostringstream os;
 
  470         os << __FILE__ << 
':' << __LINE__ << 
" not enough data " << 
STREAM(
"?") << 
x;
 
  478       if ((p == this->begin() && this->
getDistance(x, (p++)->getX()) > distance_type::precision) ||
 
  479           (p == this->end()   && this->
getDistance((--p)->getX(), x) > distance_type::precision)) {
 
  481         std::ostringstream os;
 
  483         os << __FILE__ << 
':' << __LINE__ << 
" abscissa out of range "  
  484            << 
STREAM(
"?") << x                      << 
" <> "  
  485            << 
STREAM(
"?") << this->begin() ->getX() << 
' ' 
  486            << 
STREAM(
"?") << this->rbegin()->getX();
 
  493       const double dx = this->
getDistance(p->getX(), q->getX());
 
  495       const double b  = 1.0 - 
a;
 
  497       result.f   = a * p->getY() + b * q->getY()
 
  498         - a*b * ((a + 1.0)*p->getU() + (b + 1.0)*q->getU()) * dx*dx/6;
 
  500       result.fp  = (q->getY() - p->getY() + (p->getU()*(1.0 - 3*a*
a) -
 
  501                                              q->getU()*(1.0 - 3*b*b)) * dx*dx/6) / dx;
 
  522   template<
class JElement_t, 
template<
class, 
class> 
class JCollection_t, 
class JDistance_t>
 
  528     public virtual JFunction<typename JElement_t::abscissa_type, 
 
  529                              JResultPDF<typename JResultType<typename JElement_t::ordinate_type>::result_type> >
 
  542     typedef typename collection_type::iterator                                   
iterator;
 
  569       if (this->size() >= 2
u) {
 
  571         collection_type::compile(bounds);
 
  575         for (
iterator j = this->begin(), 
i = 
j++; 
j != this->end(); ++
i, ++
j) {
 
  584           j->setIntegral(
i->getIntegral() + v - 
w);
 
  600       if (this->size() <= 1
u) {
 
  602         std::ostringstream os;
 
  604         os << __FILE__ << 
':' << __LINE__ << 
" not enough data " << 
STREAM(
"?") << 
x;
 
  611       if        (p == this->begin() && this->
getDistance(x, (p++)->getX()) > distance_type::precision) {
 
  615           std::ostringstream os;
 
  617           os << __FILE__ << 
':' << __LINE__ << 
" abscissa out of range " << 
STREAM(
"?") << x << 
" < " << 
STREAM(
"?") << this->begin() ->getX();
 
  624           result.V = this->rbegin()->getIntegral();
 
  632       } 
else if (p == this->end()   && this->
getDistance((--p)->getX(), x) > distance_type::precision) {
 
  636           std::ostringstream os;
 
  638           os << __FILE__ << 
':' << __LINE__ << 
" abscissa out of range " << 
STREAM(
"?") << x << 
" > " << 
STREAM(
"?") << this->rbegin()->getX();
 
  644           result.v = this->rbegin()->getIntegral();
 
  645           result.V = this->rbegin()->getIntegral();
 
  656       const double dx = this->
getDistance(p->getX(), q->getX());
 
  658       const double b  = 1.0 - 
a;
 
  660       result.f  = a * p->getY() + b * q->getY()
 
  661         - a*b * ((a + 1.0)*p->getU() + (b + 1.0)*q->getU()) * dx*dx/6;
 
  663       result.fp = (q->getY() - p->getY() + (p->getU()*(1.0 - 3*a*
a) -
 
  664                                             q->getU()*(1.0 - 3*b*b)) * dx*dx/6) / dx;
 
  666       result.v  = p->getIntegral()
 
  667         + 0.5*dx * (p->getY() - 0.5*p->getU()*dx*dx/6)
 
  668         - 0.5*dx * ((a*a*p->getY() - b*b*q->getY()) +
 
  669                     (p->getU() * a*a*(0.5*a*a - 1.0) -
 
  670                      q->getU() * b*b*(0.5*b*b - 1.0)) * dx*dx/6);
 
  672       result.V  = this->rbegin()->getIntegral();
 
  698   template<
class JElement_t,
 
  699            template<
class, 
class> 
class JCollection_t,
 
  700            class JResult_t   = 
typename JElement_t::ordinate_type,
 
  703     public JSplineFunction<JElement_t, JCollection_t, JResult_t, JDistance_t>,
 
  704     public JFunction1D<typename JElement_t::abscissa_type, JResult_t> 
 
  740   template<
class JAbscissa_t, 
class JOrdinate_t>
 
  743   template<
template<
class, 
class, 
class> 
class JMap_t>
 
  750   template<
class JKey_t,
 
  752            template<
class, 
class, 
class> 
class JMap_t,
 
  756     public JMap_t<JKey_t, JValue_t, JDistance_t>,
 
  823       for (
iterator i = this->begin(); 
i != this->end(); ++
i) {
 
  842   template<
class JElement_t,
 
  843            template<
class, 
class> 
class JCollection_t,
 
  846   inline typename JElement_t::ordinate_type 
 
  855     if (input.getSize() > 1) {
 
  857       output.
put(input.begin()->getX(), 
V);
 
  859       for (const_iterator 
j = input.begin(), 
i = 
j++; 
j != input.end(); ++
i, ++
j) {
 
  861         const double        dx = input.getDistance(
i->getX(), 
j->getX());
 
  862         const ordinate_type 
y  = 
i->getY()  +  
j->getY();
 
  863         const ordinate_type z  = 
i->getU()  +  
j->getU();             
 
  864         const ordinate_type 
v  = dx * 0.50 * 
y;
 
  865         const ordinate_type 
w  = dx * 0.25 * z*dx*dx/6;
 
  869         output.
put(
j->getX(), 
V);
 
  886   template<
class JElement_t,
 
  887            template<
class, 
class> 
class JCollection_t,
 
  889   inline typename JElement_t::ordinate_type
 
  897     if (input.getSize() > 1) {
 
  899       for (const_iterator 
i = input.begin(); 
i != input.end(); ++
i) {
 
  900         output.
put(
i->getX(), 
i->getIntegral());
 
  903       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. 
 
JArgument< T >::argument_type argument_type
 
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.