1 #ifndef __JTOOLS__JPOLINT__ 
    2 #define __JTOOLS__JPOLINT__ 
   25 namespace JPP { 
using namespace JTOOLS; }
 
   38   template<
unsigned int N, 
 
   40            template<
class, 
class> 
class JCollection_t,
 
   53   template<
unsigned int N, 
class JElement_t, 
template<
class, 
class> 
class JCollection_t, 
class JDistance_t>
 
   59     public JCollection_t<JElement_t, JDistance_t>,
 
   60     public JFunction<typename JElement_t::abscissa_type,
 
   61                      typename JResultType<typename JElement_t::ordinate_type>::result_type>
 
   74     typedef typename collection_type::iterator                                   
iterator;
 
  102       if (this->size() > 1
u) {
 
  106         if ((p == this->begin() && this->
getDistance(x, (p++)->getX()) > distance_type::precision) ||
 
  107             (p == this->end()   && this->
getDistance((--p)->getX(), x) > distance_type::precision)) {
 
  110                                                                    << 
STREAM(
"?") << x                      << 
" <> "  
  111                                                                    << 
STREAM(
"?") << this->begin() ->getX() << 
' ' 
  112                                                                    << 
STREAM(
"?") << this->rbegin()->getX()));
 
  118         const int n = std::min((
int) (
N + 1), (
int) this->size());         
 
  120         for (
int i = n/2; i != 0 && p != this->end();   --i, ++p) {}       
 
  121         for (
int i = n  ; i != 0 && p != this->begin(); --i, --p) {}
 
  126         for (
int i = 0; i != 
n; ++p, ++i) {
 
  132           if (fabs(
u[i]) < fabs(
u[j])) {
 
  142         for (
int m = 1; m != 
n; ++m) {
 
  144           for (
int i = 0; i != n-m; ++i) {
 
  146             const double ho = 
u[ i ];
 
  147             const double hp = 
u[i+m];
 
  148             const double dx = ho - hp;
 
  166       } 
else if (this->size() == 1
u && this->
getDistance(x, this->begin()->getX()) <= distance_type::precision) {
 
  185     mutable double      u[
N+1];
 
  195   template<
class JElement_t, 
template<
class, 
class> 
class JCollection_t, 
class JDistance_t>
 
  201     public JCollection_t<JElement_t, JDistance_t>,
 
  202     public JFunction<typename JElement_t::abscissa_type,
 
  203                      typename JResultType<typename JElement_t::ordinate_type>::result_type>
 
  216     typedef typename collection_type::iterator                                   
iterator;
 
  244       if (this->size() > 1
u) {
 
  248         if ((p == this->begin() && this->
getDistance(x, (p++)->getX()) > distance_type::precision) ||
 
  249             (p == this->end()   && this->
getDistance((--p)->getX(), x) > distance_type::precision)) {
 
  252                                                                    << 
STREAM(
"?") << x                      << 
" <> "  
  253                                                                    << 
STREAM(
"?") << this->begin() ->getX() << 
' ' 
  254                                                                    << 
STREAM(
"?") << this->rbegin()->getX()));
 
  267       } 
else if (this->size() == 1
u && this->
getDistance(x, this->begin()->getX()) <= distance_type::precision) {
 
  290   template<
class JElement_t, 
template<
class, 
class> 
class JCollection_t, 
class JDistance_t>
 
  296     public JCollection_t<JElement_t, JDistance_t>,
 
  297     public JFunction<typename JElement_t::abscissa_type,
 
  298                      typename JResultType<typename JElement_t::ordinate_type>::result_type>
 
  311     typedef typename collection_type::iterator                                   
iterator;
 
  339       if (this->size() > 1
u) {
 
  343         if ((p == this->begin() && this->
getDistance(x, (p++)->getX()) > distance_type::precision) ||
 
  344             (p == this->end()   && this->
getDistance((--p)->getX(), x) > distance_type::precision)) {
 
  347                                                                    << 
STREAM(
"?") << x                      << 
" <> "  
  348                                                                    << 
STREAM(
"?") << this->begin() ->getX() << 
' ' 
  349                                                                    << 
STREAM(
"?") << this->rbegin()->getX()));
 
  357         const double dx = this->
getDistance(p->getX(), q->getX());
 
  359         const double b  = 1.0 - 
a;
 
  371       } 
else if (this->size() == 1
u && this->
getDistance(x, this->begin()->getX()) <= distance_type::precision) {
 
  405   template<
unsigned int N, 
class JElement_t, 
template<
class, 
class> 
class JCollection_t, 
class JDistance_t>
 
  411     public JCollection_t<JElement_t, JDistance_t>,
 
  412     public JFunction<typename JElement_t::abscissa_type, 
 
  413                      JResultPDF<typename JResultType<typename JElement_t::ordinate_type>::result_type> >
 
  426     typedef typename collection_type::iterator                                   
iterator;
 
  456       if (this->size() <= 1
u) {
 
  462       if        (p == this->begin() && this->
getDistance(x, (p++)->getX()) > distance_type::precision) {
 
  467                                                                        << 
STREAM(
"?") << x << 
" < " << 
STREAM(
"?") << this->begin() ->getX()));
 
  472           result.V = this->rbegin()->getIntegral();
 
  480       } 
else if (p == this->end()   && this->
getDistance((--p)->getX(), x) > distance_type::precision) {
 
  485                                                                        << 
STREAM(
"?") << x << 
" > " << 
STREAM(
"?") << this->rbegin() ->getX()));
 
  489           result.v = this->rbegin()->getIntegral();
 
  490           result.V = this->rbegin()->getIntegral();
 
  502         const int n = std::min((
int) (
N + 1), (
int) this->size());         
 
  504         for (
int i = n/2; i != 0 && p != this->end();   --i, ++p) {}       
 
  505         for (
int i = n  ; i != 0 && p != this->begin(); --i, --p) {}
 
  510         for (
int i = 0; i != 
n; ++p, ++i) {
 
  516           w[i][2] = 
v[i][2] = p->getIntegral();
 
  518           if (fabs(
u[i]) < fabs(
u[j])) {
 
  527         result.V  = this->rbegin()->getIntegral();
 
  531         for (
int m = 1; m != 
n; ++m) {
 
  533           for (
int i = 0; i != n-m; ++i) {
 
  535             const double ho = 
u[ i ];
 
  536             const double hp = 
u[i+m];
 
  537             const double dx = ho - hp;
 
  539             for (
int k = 0; 
k != 3; ++
k) {
 
  540               r[
k] = (
v[i+1][
k] - 
w[i][
k]) / dx;
 
  545             v[i][1] = ho * r[1] - r[0];
 
  546             w[i][1] = hp * r[1] - r[0];
 
  551           if (2*(j+1) < n - m) {
 
  583         this->begin()->setIntegral(V);
 
  585         for (
iterator j = this->begin(), i = 
j++; 
j != this->end(); ++i, ++
j) {
 
  604     mutable double    u[
N+1];
 
  616   template<
unsigned int N,
 
  618            template<
class, 
class> 
class JCollection_t,
 
  629   template<
unsigned int N, 
class JElement_t, 
template<
class, 
class> 
class JCollection_t, 
class JDistance_t, 
unsigned int M>
 
  635     public JCollection_t<JElement_t, JDistance_t>,
 
  641     typedef JCollection_t<JElement_t, JDistance_t>                               collection_type;
 
  643     typedef typename collection_type::abscissa_type                              abscissa_type;
 
  644     typedef typename collection_type::ordinate_type                              ordinate_type;
 
  645     typedef typename collection_type::value_type                                 value_type;
 
  646     typedef typename collection_type::distance_type                              distance_type;
 
  648     typedef typename collection_type::const_iterator                             const_iterator;
 
  649     typedef typename collection_type::const_reverse_iterator                     const_reverse_iterator;
 
  650     typedef typename collection_type::iterator                                   iterator;
 
  651     typedef typename collection_type::reverse_iterator                           reverse_iterator;
 
  653     typedef typename JResultType<ordinate_type>::result_type                     data_type;
 
  654     typedef JFunction<abscissa_type, JResultPolynome<M, data_type> >             function_type;
 
  656     typedef typename function_type::argument_type                                argument_type;
 
  657     typedef typename function_type::result_type                                  result_type;
 
  659     using JFunctional<>::compile;
 
  675     result_type evaluate(const argument_type* pX) const
 
  677       const argument_type x = *pX;
 
  679       if (this->size() <= N) {
 
  680         THROW(JFunctionalException, "not enough data " << STREAM("?") << x);
 
  683       const_iterator p = this->lower_bound(x);
 
  685       if ((p == this->begin() && this->getDistance(x, (p++)->getX()) > distance_type::precision) ||
 
  686           (p == this->end()   && this->
getDistance((--p)->getX(), 
x) > distance_type::precision)) {
 
  690               << 
STREAM(
"?") << this->begin() ->getX() << 
' ' 
  691               << 
STREAM(
"?") << this->rbegin()->getX());
 
  697       const int n = std::min((
int) (
N + 1), (
int) this->size());         
 
  699       for (
int i = 
n/2; i != 0 && p != this->end();   --i, ++p) {}       
 
  700       for (
int i = 
n  ; i != 0 && p != this->begin(); --i, --p) {}
 
  705       for (
int i = 0; i != 
n; ++p, ++i) {
 
  711         for (
unsigned int k = 1; 
k != M+1; ++
k) {
 
  715         if (fabs(
u[i]) < fabs(
u[
j])) {
 
  721       for (
unsigned int k = 0; 
k != M+1; ++
k) {
 
  727       for (
int m = 1; m != 
n; ++m) {
 
  729         for (
int i = 0; i != 
n-m; ++i) {
 
  731           const double ho = 
u[ i ];
 
  732           const double hp = 
u[i+m];
 
  733           const double dx = ho - hp;
 
  735           for (
int k = 0; 
k != M+1; ++
k) {
 
  736             r[
k] = (
v[i+1][
k] - 
w[i][
k]) / dx;
 
  742           for (
int k = 1; 
k != M+1; ++
k) {
 
  743             v[i][
k] = ho * r[
k]  -  
k * r[
k-1];
 
  744             w[i][
k] = hp * r[
k]  -  
k * r[
k-1];
 
  748         if (2*(
j+1) < 
n - m) {
 
  750           for (
int k = 0; 
k != M+1; ++
k) {
 
  756           for (
int k = 0; 
k != M+1; ++
k) {
 
  776     mutable double    u[
N+1];
 
  777     mutable data_type 
v[
N+1][M+1];
 
  778     mutable data_type 
w[
N+1][M+1];
 
  779     mutable data_type 
r[M+1];
 
  781     mutable result_type 
result;
 
  788   template<
unsigned int N, 
class JElement_t, 
template<
class, 
class> 
class JCollection_t, 
class JDistance_t, 
unsigned int M>
 
  797                              JResultPolynome<M, typename JResultType<typename JElement_t::ordinate_type>::result_type>,
 
  799     public JFunction<typename JElement_t::abscissa_type, 
 
  800                      JResultPolynome<N, typename JResultType<typename JElement_t::ordinate_type>::result_type> >
 
  817     typedef typename collection_type::iterator                                   
iterator;
 
  844         return collection_type::evaluate(pX);
 
  847         return this->getExceptionHandler().action(error);
 
  856   template<
unsigned int N, 
class JElement_t, 
template<
class, 
class> 
class JCollection_t, 
class JDistance_t>
 
  865                              JResultPolynome<1, typename JResultType<typename JElement_t::ordinate_type>::result_type>,
 
  867     public JFunction<typename JElement_t::abscissa_type,
 
  868                      JResultDerivative<typename JResultType<typename JElement_t::ordinate_type>::result_type> >
 
  885     typedef typename collection_type::iterator                                   
iterator;
 
  914         return collection_type::evaluate(pX);
 
  917         return this->getExceptionHandler().action(error);
 
  926   template<
unsigned int N, 
class JElement_t, 
template<
class, 
class> 
class JCollection_t, 
class JDistance_t>
 
  935                              JResultPolynome<2, typename JResultType<typename JElement_t::ordinate_type>::result_type>,
 
  937     public JFunction<typename JElement_t::abscissa_type,
 
  938                      JResultHesse<typename JResultType<typename JElement_t::ordinate_type>::result_type> >
 
  955     typedef typename collection_type::iterator                                   
iterator;
 
  984         return collection_type::evaluate(pX);
 
  987         return this->getExceptionHandler().action(error);
 
  998   template<
unsigned int N,
 
 1000            template<
class, 
class> 
class JCollection_t,
 
 1001            class JResult_t   = 
typename JElement_t::ordinate_type,
 
 1004     public JPolintFunction<N, JElement_t, JCollection_t, JResult_t, JDistance_t>,
 
 1005     public JFunction1D<typename JElement_t::abscissa_type, JResult_t> 
 
 1041   template<
class JAbscissa_t, 
class JOrdinate_t>
 
 1044   template<
template<
class, 
class, 
class> 
class JMap_t>
 
 1051   template<
unsigned int N,
 
 1054            template<
class, 
class, 
class> 
class JMap_t,
 
 1059                            JElement2D<JKey_t, JValue_t>, 
 
 1060                            JMapCollection<JMap_t>::template collection_type, 
 
 1105   template<
unsigned int N,
 
 1107            template<
class, 
class> 
class JCollection_t,
 
 1110   inline typename JElement_t::ordinate_type
 
 1129   template<
unsigned int N,
 
 1131            template<
class, 
class> 
class JCollection_t,
 
 1134   inline typename JElement_t::ordinate_type
 
 1139     typedef typename JElement_t::abscissa_type                                                                abscissa_type;
 
 1140     typedef typename JElement_t::ordinate_type                                                                ordinate_type;
 
 1145     if (input.getSize() > 1) {
 
 1147       output.
put(input.begin()->getX(), 
V);
 
 1151       for (const_iterator 
j = input.begin(), i = 
j++; 
j != input.end(); ++i, ++
j) {
 
 1153         const abscissa_type 
xmin = i->getX();
 
 1154         const abscissa_type 
xmax = 
j->getX();
 
 1158           const abscissa_type 
x = 0.5 * (xmax + xmin  +  m->getX() * (xmax - 
xmin));
 
 1159           const ordinate_type 
v = 0.5 * (xmax - 
xmin) *  m->getY() * 
get_value(input(x));
 
 1164         output.
put(xmax, V);
 
 1182   template<
class JElement_t,
 
 1183            template<
class, 
class> 
class JCollection_t,
 
 1186   inline typename JElement_t::ordinate_type
 
 1191     typedef typename JElement_t::ordinate_type                                                                ordinate_type;
 
 1196     if (input.getSize() > 1) {
 
 1198       output.
put(input.begin()->getX(), 
V);
 
 1200       for (const_iterator 
j = input.begin(), i = 
j++; 
j != input.end(); ++i, ++
j) {
 
 1202         V += input.getDistance(i->getX(), 
j->getX()) * 
j->getY();
 
 1204         output.
put(
j->getX(), 
V);
 
 1222   template<
class JElement_t,
 
 1223            template<
class, 
class> 
class JCollection_t,
 
 1226   inline typename JElement_t::ordinate_type
 
 1231     typedef typename JElement_t::ordinate_type                                                                ordinate_type;
 
 1236     if (input.getSize() > 1) {
 
 1238       output.
put(input.begin()->getX(), 
V);
 
 1240       for (const_iterator 
j = input.begin(), i = 
j++; 
j != input.end(); ++i, ++
j) {
 
 1242         V += 0.5 * input.getDistance(i->getX(), 
j->getX()) * (i->getY() + 
j->getY());
 
 1244         output.
put(
j->getX(), 
V);
 
then fatal No hydrophone data file $HYDROPHONE_TXT fi sort gr k
 
double getValue(const JScale_t scale)
Get numerical value corresponding to scale. 
 
Exception for a functional operation. 
 
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...
 
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message. 
 
then JShowerPostfit f $INPUT_FILE o $OUTPUT_FILE N
 
static const JZero zero
Function object to assign zero value. 
 
Generation of compiler error. 
 
V(JDAQEvent-JTriggerReprocessor)*1.0/(JDAQEvent+1.0e-10)
 
size_t getSize(T(&array)[N])
Get size of c-array. 
 
double getDistance(const JFirst_t &first, const JSecond_t &second)
Get distance between objects. 
 
Auxiliary template class for type bool. 
 
Auxiliary data structure for handling std::ostream. 
 
#define MAKE_EXCEPTION(JException_t, A)
Make exception. 
 
Exception for numerical precision error. 
 
Auxiliary classes for numerical integration. 
 
Exception for accessing a value in a collection that is outside of its range.