Jpp test-rotations-old
the software that should make you happy
Loading...
Searching...
No Matches
JSpline.hh
Go to the documentation of this file.
1#ifndef __JTOOLS__JSPLINE__
2#define __JTOOLS__JSPLINE__
3
4#include <utility>
5#include <sstream>
6
7#include "JMath/JZero.hh"
8#include "JLang/JException.hh"
9#include "JLang/JClass.hh"
11#include "JTools/JFunctional.hh"
12#include "JTools/JDistance.hh"
13#include "JTools/JResult.hh"
16
17
18/**
19 * \author mdejong
20 */
21
22namespace JTOOLS {}
23namespace JPP { using namespace JTOOLS; }
24
25namespace JTOOLS {
26
27 using JLANG::JNoValue;
31
32
33 /**
34 * Auxiliary class to define first derivates of the spline function at the two extrema.
35 */
36 template<class JOrdinate_t>
38 public:
39
40 typedef JOrdinate_t ordinate_type;
42
43
44 /**
45 * Default constructor.
46 */
48 fp_at_xmin(false, ordinate_type()),
50 {}
51
52
53 /**
54 * Constructor.
55 *
56 * \param fpAtXmin 1st derivative at minimal abscissa value
57 * \param fpAtXmax 1st derivative at maximal abscissa value
58 */
60 argument_type fpAtXmax) :
61 fp_at_xmin(true, fpAtXmin),
62 fp_at_xmax(true, fpAtXmax)
63 {}
64
65
66 /**
67 * Set first derivative of function at minimal abscissa value.
68 *
69 * \param fp 1st derivative
70 */
72 {
73 fp_at_xmin.first = true;
74 fp_at_xmin.second = fp;
75 }
76
77
78 /**
79 * Set first derivative of function at maximal abscissa value.
80 *
81 * \param fp 1st derivative
82 */
84 {
85 fp_at_xmax.first = true;
86 fp_at_xmax.second = fp;
87 }
88
89
90 /**
91 * Has first derivative of function at minimal abscissa value.
92 *
93 * \return true if 1st derivative is set; else false
94 */
95 const bool& hasFirstDerivativeAtXmin() const
96 {
97 return fp_at_xmin.first;
98 }
99
100
101 /**
102 * Has first derivative of function at maximal abscissa value.
103 *
104 * \return true if 1st derivative is set; else false
105 */
106 const bool& hasFirstDerivativeAtXmax() const
107 {
108 return fp_at_xmax.first;
109 }
110
111
112 /**
113 * Get first derivative of function at minimal abscissa value.
114 *
115 * \return 1st derivative
116 */
118 {
119 if (fp_at_xmin.first)
120 return fp_at_xmin.second;
121 else
122 throw JNoValue("JSplineBounds: missing 1st derivative.");
123 }
124
125
126 /**
127 * Get first derivative of function at maximal abscissa value.
128 *
129 * \return 1st derivative
130 */
132 {
133 if (fp_at_xmax.first)
134 return fp_at_xmax.second;
135 else
136 throw JNoValue("JSplineBounds: missing 1st derivative.");
137 }
138
139 protected:
142 };
143
144
145 /**
146 * Helper method for JSplineBounds.
147 *
148 * \param fpAtXmin 1st derivative at minimal abscissa value
149 * \param fpAtXmax 1st derivative at maximal abscissa value
150 * \return spline bounds
151 */
152 template<class JOrdinate_t>
153 inline JSplineBounds<JOrdinate_t> make_spline_bounds(const JOrdinate_t fpAtXmin,
154 const JOrdinate_t fpAtXmax)
155 {
156 return JSplineBounds<JOrdinate_t>(fpAtXmin, fpAtXmax);
157 }
158
159
160 /**
161 * Template base class for spline interpolations.
162 *
163 * This class partially implements the JFunctional interface.
164 *
165 * Note that the data structure of the elements in the collection should have the additional methods:
166 * <pre>
167 * ordinate_type getU() const;
168 * void setU(ordinate_type u);
169 * </pre>
170 * to get and set the second derivatives, respectively.
171 *
172 * Spline interpolation code is taken from reference:
173 * Numerical Recipes in C++, W.H. Press, S.A. Teukolsky, W.T. Vetterling and B.P. Flannery,
174 * Cambridge University Press.
175 */
176 template<class JElement_t, template<class, class> class JCollection_t, class JDistance_t>
178 public JCollection_t<JElement_t, JDistance_t>,
179 public virtual JFunctional<>
180 {
181 public:
182
183 typedef JCollection_t<JElement_t, JDistance_t> collection_type;
184
185 typedef typename collection_type::abscissa_type abscissa_type;
186 typedef typename collection_type::ordinate_type ordinate_type;
187 typedef typename collection_type::value_type value_type;
188
189 typedef typename collection_type::const_iterator const_iterator;
190 typedef typename collection_type::const_reverse_iterator const_reverse_iterator;
191 typedef typename collection_type::iterator iterator;
192 typedef typename collection_type::reverse_iterator reverse_iterator;
193
194 using JFunctional<>::compile;
195
196
197 /**
198 * Determination of second derivatives with specified bounds.
199 *
200 * \param bounds 1st derivatives at two extrema.
201 */
203 {
204 const int numberOfElements = this->size();
205
206 using namespace std;
207
208 if (numberOfElements > 2) {
209
210 std::vector<double> buffer(numberOfElements);
211
212 if (bounds.hasFirstDerivativeAtXmin()) {
213
214 iterator j = this->begin();
215 iterator i = j++;
216
217 const double dx = this->getDistance(i->getX(), j->getX());
218 const ordinate_type dy = (j->getY() - i->getY());
219
220 buffer[0] = -0.5;
221
222 i->setU((3.0/dx) * (dy/dx - bounds.getFirstDerivativeAtXmin()));
223
224 } else {
225
226 buffer[0] = 0.0;
227
228 this->begin()->setU(JMATH::zero);
229 }
230
231 int index = 1;
232
233 for (iterator k = this->begin(), i = k++, j = k++; k != this->end(); ++i, ++j, ++k, ++index) {
234
235 const abscissa_type x1 = i->getX();
236 const abscissa_type x2 = j->getX();
237 const abscissa_type x3 = k->getX();
238
239 const ordinate_type& y1 = i->getY();
240 const ordinate_type& y2 = j->getY();
241 const ordinate_type& y3 = k->getY();
242
243 const double sig = this->getDistance(x1, x2) / this->getDistance(x1, x3);
244 const double h = sig * buffer[index-1] + 2.0;
245
246 buffer[index] = (sig - 1.0) / h;
247
248 j->setU((y3 - y2) / this->getDistance(x2, x3) -
249 (y2 - y1) / this->getDistance(x1, x2));
250
251 j->setU((6.0 * j->getU() / this->getDistance(x1, x3) - sig * i->getU()) / h);
252 }
253
254
255 if (bounds.hasFirstDerivativeAtXmax()) {
256
257 reverse_iterator j = this->rbegin();
258 reverse_iterator i = j++;
259
260 index = numberOfElements - 2;
261
262 const double dx = this->getDistance(i->getX(), j->getX());
263 const ordinate_type dy = (j->getY() - i->getY());
264
265 i->setU((3.0/dx) * (bounds.getFirstDerivativeAtXmax() - dy/dx));
266
267 i->setU((i->getU() - 0.5*j->getU()) / (0.5*buffer[index] + 1.0));
268
269 } else {
270
271 this->rbegin()->setU(JMATH::zero);
272 }
273
274
275 reverse_iterator j = this->rbegin();
276 reverse_iterator i = j++;
277
278 index = numberOfElements - 2;
279
280 for ( ; j != this->rend(); ++i, ++j, --index) {
281 j->setU(j->getU() + i->getU() * buffer[index]);
282 }
283
284 } else {
285
286 for (iterator i = this->begin(); i != this->end(); ++i) {
287 i->setU(JMATH::zero);
288 }
289 }
290 }
291
292
293 protected:
294 /**
295 * Default constructor.
296 */
299
300
301 /**
302 * Determination of second derivatives with no bounds.
303 */
304 virtual void do_compile() override
305 {
307 }
308 };
309
310
311 /**
312 * Template definition for functional collection with spline interpolation.
313 */
314 template<class JElement_t,
315 template<class, class> class JCollection_t,
316 class JResult_t,
317 class JDistance_t>
319
320
321 /**
322 * Template specialisation for functional collection with spline interpolation.
323 */
324 template<class JElement_t, template<class, class> class JCollection_t, class JDistance_t>
325 class JSplineFunction<JElement_t,
326 JCollection_t,
327 typename JResultType<typename JElement_t::ordinate_type>::result_type,
328 JDistance_t> :
329 public JSplineCollection<JElement_t, JCollection_t, JDistance_t>,
330 public virtual JFunctional<typename JElement_t::abscissa_type,
331 typename JResultType<typename JElement_t::ordinate_type>::result_type>
332 {
333 public:
334
336
340 typedef typename collection_type::distance_type distance_type;
341
346
349
353
354
355 /**
356 * Default constructor.
357 */
360
361
362 /**
363 * Recursive interpolation method implementation.
364 *
365 * \param pX pointer to abscissa values
366 * \return function value
367 */
368 virtual result_type evaluate(const argument_type* pX) const override
369 {
370 const argument_type x = *pX;
371
372 if (this->size() > 1u) {
373
374 const_iterator p = this->lower_bound(x);
375
376 if ((p == this->begin() && this->getDistance(x, (p++)->getX()) > distance_type::precision) ||
377 (p == this->end() && this->getDistance((--p)->getX(), x) > distance_type::precision)) {
378
379 try {
380 return this->getExceptionHandler().action();
381 }
382 catch (const JException& error) {
383
384 std::ostringstream os;
385
386 os << __FILE__ << ':' << __LINE__ << " abscissa out of range "
387 << STREAM("?") << x << " <> "
388 << STREAM("?") << this->begin() ->getX() << ' '
389 << STREAM("?") << this->rbegin()->getX();
390
391 throw JValueOutOfRange(os.str());
392 }
393 }
394
395 const_iterator q = p--;
396
397 const double dx = this->getDistance(p->getX(), q->getX());
398 const double a = this->getDistance(x, q->getX()) / dx;
399 const double b = 1.0 - a;
400
401 return (a * p->getY() + b * q->getY()
402 - a*b * ((a + 1.0)*p->getU() + (b + 1.0)*q->getU()) * dx*dx/6);
403
404 } else if (this->size() == 1u && this->getDistance(x, this->begin()->getX()) <= distance_type::precision) {
405
406 return this->begin()->getY();
407
408 } else {
409
410 try {
411 return this->getExceptionHandler().action();
412 }
413 catch (const JException& error) {
414
415 std::ostringstream os;
416
417 os << __FILE__ << ':' << __LINE__ << " not enough data " << STREAM("?") << x;
418
419 throw JFunctionalException(os.str());
420 }
421 }
422 }
423 };
424
425
426 /**
427 * Template specialisation for spline interpolation method with returning JResultDerivative data structure.
428 */
429 template<class JElement_t, template<class, class> class JCollection_t, class JDistance_t>
430 class JSplineFunction<JElement_t,
431 JCollection_t,
432 JResultDerivative<typename JResultType<typename JElement_t::ordinate_type>::result_type>,
433 JDistance_t> :
434 public JSplineCollection<JElement_t, JCollection_t, JDistance_t>,
435 public virtual JFunctional<typename JElement_t::abscissa_type,
436 JResultDerivative<typename JResultType<typename JElement_t::ordinate_type>::result_type> >
437 {
438 public:
439
441
445 typedef typename collection_type::distance_type distance_type;
446
451
454
458
459 using JFunctional<>::compile;
460
461
462 /**
463 * Default constructor.
464 */
467
468
469 /**
470 * Recursive interpolation method implementation.
471 *
472 * \param pX pointer to abscissa values
473 * \return function value
474 */
475 virtual result_type evaluate(const argument_type* pX) const override
476 {
478
479 const argument_type x = *pX;
480
481 if (this->size() <= 1u) {
482
483 try {
484 return this->getExceptionHandler().action();
485 }
486 catch (const JException& error) {
487
488 std::ostringstream os;
489
490 os << __FILE__ << ':' << __LINE__ << " not enough data " << STREAM("?") << x;
491
492 throw JFunctionalException(os.str());
493 }
494 }
495
496 const_iterator p = this->lower_bound(x);
497
498
499 if ((p == this->begin() && this->getDistance(x, (p++)->getX()) > distance_type::precision) ||
500 (p == this->end() && this->getDistance((--p)->getX(), x) > distance_type::precision)) {
501
502 try {
503 return this->getExceptionHandler().action();
504 }
505 catch (const JException& error) {
506
507 std::ostringstream os;
508
509 os << __FILE__ << ':' << __LINE__ << " abscissa out of range "
510 << STREAM("?") << x << " <> "
511 << STREAM("?") << this->begin() ->getX() << ' '
512 << STREAM("?") << this->rbegin()->getX();
513
514 throw JValueOutOfRange(os.str());
515 }
516 }
517
518 const_iterator q = p--;
519
520 const double dx = this->getDistance(p->getX(), q->getX());
521 const double a = this->getDistance(x, q->getX()) / dx;
522 const double b = 1.0 - a;
523
524 result.f = a * p->getY() + b * q->getY()
525 - a*b * ((a + 1.0)*p->getU() + (b + 1.0)*q->getU()) * dx*dx/6;
526
527 result.fp = (q->getY() - p->getY() + (p->getU()*(1.0 - 3*a*a) -
528 q->getU()*(1.0 - 3*b*b)) * dx*dx/6) / dx;
529
530 return result;
531 }
532 };
533
534
535 /**
536 * Template specialisation for spline interpolation method with returning JResultPDF data structure.
537 *
538 * Note that the data structure of the elements in the collection should have the additional methods:
539 * <pre>
540 * ordinate_type getIntegral() const;
541 * void setIntegral(ordinate_type v);
542 * </pre>
543 * to get and set the integral values, respectively.
544 */
545 template<class JElement_t, template<class, class> class JCollection_t, class JDistance_t>
546 class JSplineFunction<JElement_t,
547 JCollection_t,
548 JResultPDF<typename JResultType<typename JElement_t::ordinate_type>::result_type>,
549 JDistance_t> :
550 public JSplineCollection<JElement_t, JCollection_t, JDistance_t>,
551 public virtual JFunctional<typename JElement_t::abscissa_type,
552 JResultPDF<typename JResultType<typename JElement_t::ordinate_type>::result_type> >
553 {
554 public:
555
557
561 typedef typename collection_type::distance_type distance_type;
562
567
570
574
575 using JFunctional<>::compile;
576
577
578 /**
579 * Default constructor.
580 */
583
584
585 /**
586 * Determination of second derivatives with specified bounds.
587 *
588 * \param bounds 1st derivatives at two extrema.
589 */
591 {
592 if (this->size() >= 2u) {
593
594 collection_type::compile(bounds);
595
596 this->begin()->setIntegral(JMATH::zero);
597
598 for (iterator j = this->begin(), i = j++; j != this->end(); ++i, ++j) {
599
600 const double dx = this->getDistance(i->getX(), j->getX());
601 const ordinate_type y = i->getY() + j->getY();
602 const ordinate_type z = i->getU() + j->getU();
603
604 const ordinate_type v = dx * 0.50 * y;
605 const ordinate_type w = dx * 0.25 * z*dx*dx/6;
606
607 j->setIntegral(i->getIntegral() + v - w);
608 }
609 }
610 }
611
612
613 /**
614 * Recursive interpolation method implementation.
615 *
616 * \param pX pointer to abscissa values
617 * \return function value
618 */
619 virtual result_type evaluate(const argument_type* pX) const override
620 {
622
623 const argument_type x = *pX;
624
625 if (this->size() <= 1u) {
626
627 try {
628 return this->getExceptionHandler().action();
629 }
630 catch (const JException& error) {
631
632 std::ostringstream os;
633
634 os << __FILE__ << ':' << __LINE__ << " not enough data " << STREAM("?") << x;
635
636 throw JFunctionalException(os.str());
637 }
638 }
639
640 const_iterator p = this->lower_bound(x);
641
642 if (p == this->begin() && this->getDistance(x, (p++)->getX()) > distance_type::precision) {
643
644 try {
645
646 result = this->getExceptionHandler().action();
647
648 // overwrite integral values
649
650 result.v = 0;
651 result.V = this->rbegin()->getIntegral();
652
653 } catch(const JException& error) {
654
655 std::ostringstream os;
656
657 os << __FILE__ << ':' << __LINE__ << " abscissa out of range " << STREAM("?") << x << " < " << STREAM("?") << this->begin() ->getX();
658
659 throw JValueOutOfRange(os.str());
660 }
661
662 return result;
663
664 } else if (p == this->end() && this->getDistance((--p)->getX(), x) > distance_type::precision) {
665
666 try {
667
668 result = this->getExceptionHandler().action();
669
670 // overwrite integral values
671
672 result.v = this->rbegin()->getIntegral();
673 result.V = this->rbegin()->getIntegral();
674
675 } catch(const JException& error) {
676
677 std::ostringstream os;
678
679 os << __FILE__ << ':' << __LINE__ << " abscissa out of range " << STREAM("?") << x << " > " << STREAM("?") << this->rbegin()->getX();
680
681 throw JValueOutOfRange(os.str());
682 }
683
684 return result;
685 }
686
687 const_iterator q = p--;
688
689 const double dx = this->getDistance(p->getX(), q->getX());
690 const double a = this->getDistance(x, q->getX()) / dx;
691 const double b = 1.0 - a;
692
693 result.f = a * p->getY() + b * q->getY()
694 - a*b * ((a + 1.0)*p->getU() + (b + 1.0)*q->getU()) * dx*dx/6;
695
696 result.fp = (q->getY() - p->getY() + (p->getU()*(1.0 - 3*a*a) -
697 q->getU()*(1.0 - 3*b*b)) * dx*dx/6) / dx;
698
699 result.v = p->getIntegral()
700 + 0.5*dx * (p->getY() - 0.5*p->getU()*dx*dx/6)
701 - 0.5*dx * ((a*a*p->getY() - b*b*q->getY()) +
702 (p->getU() * a*a*(0.5*a*a - 1.0) -
703 q->getU() * b*b*(0.5*b*b - 1.0)) * dx*dx/6);
704
705 result.V = this->rbegin()->getIntegral();
706
707 return result;
708 }
709
710
711 protected:
712 /**
713 * Determination of second derivatives with no bounds.
714 */
715 virtual void do_compile() override
716 {
718 }
719 };
720
721
722 /**
723 * Template class for spline interpolation in 1D
724 *
725 * This class implements the JFunction1D interface.
726 */
727 template<class JElement_t,
728 template<class, class> class JCollection_t,
729 class JResult_t = typename JElement_t::ordinate_type,
732 public JSplineFunction<JElement_t, JCollection_t, JResult_t, JDistance_t>,
733 public JFunction1D<typename JElement_t::abscissa_type, JResult_t>
734 {
735 public:
736
738
742 typedef typename collection_type::distance_type distance_type;
743
748
750
754
755
756 /**
757 * Default contructor.
758 */
761 };
762
763
764 /**
765 * \cond NEVER
766 * Forward declarations.
767 * \endcond
768 */
769 template<class JAbscissa_t, class JOrdinate_t>
771
772 template<template<class, class, class> class JMap_t>
774
775
776 /**
777 * Functional map with spline interpolation.
778 */
779 template<class JKey_t,
780 class JValue_t,
781 template<class, class, class> class JMap_t,
782 class JResult_t,
783 class JDistance_t = JDistance<JKey_t> >
785 public JMap_t<JKey_t, JValue_t, JDistance_t>,
786 public JFunction<JKey_t, JResult_t>
787 {
788 public:
789
790 typedef JMap_t<JKey_t, JValue_t, JDistance_t> collection_type;
792
793 typedef typename collection_type::abscissa_type abscissa_type;
794 typedef typename collection_type::ordinate_type ordinate_type;
795 typedef typename collection_type::value_type value_type;
796 typedef typename collection_type::distance_type distance_type;
797
798 typedef typename collection_type::const_iterator const_iterator;
799 typedef typename collection_type::const_reverse_iterator const_reverse_iterator;
800 typedef typename collection_type::iterator iterator;
801 typedef typename collection_type::reverse_iterator reverse_iterator;
802
806
811
812
813 /**
814 * Default constructor.
815 */
817 {}
818
819
820 /**
821 * Recursive interpolation method implementation.
822 *
823 * \param pX pointer to abscissa values
824 * \return function value
825 */
826 virtual result_type evaluate(const argument_type* pX) const override
827 {
828 const argument_type x = *pX;
829
830 ++pX; // next argument value
831
832 const_iterator p = this->begin();
833
834 for (typename JSplineFunction1D_t::iterator q = buffer.begin(); q != buffer.end(); ++q, ++p) {
836 }
837
838 buffer.compile();
839
840 return buffer(x);
841 }
842
843
844 private:
845 /**
846 * Function compilation.
847 */
848 virtual void do_compile() override
849 {
850 buffer.clear();
851
852 for (iterator i = this->begin(); i != this->end(); ++i) {
853 buffer.put(i->getX(), data_type());
854 }
855 }
856
857
859 };
860
861
862 /**
863 * Conversion of data points to integral values.
864 *
865 * The integration includes the use of 2nd derivatives of the data points of the input spline interpolating function.
866 *
867 * \param input collection
868 * \param output mappable collection
869 * \return integral
870 */
871 template<class JElement_t,
872 template<class, class> class JCollection_t,
873 class JResult_t,
874 class JDistance_t>
875 inline typename JElement_t::ordinate_type
877 typename JMappable<JElement_t>::map_type& output)
878 {
879 typedef typename JElement_t::ordinate_type ordinate_type;
881
882 ordinate_type V(JMATH::zero);
883
884 if (input.getSize() > 1) {
885
886 output.put(input.begin()->getX(), V);
887
888 for (const_iterator j = input.begin(), i = j++; j != input.end(); ++i, ++j) {
889
890 const double dx = input.getDistance(i->getX(), j->getX());
891 const ordinate_type y = i->getY() + j->getY();
892 const ordinate_type z = i->getU() + j->getU();
893 const ordinate_type v = dx * 0.50 * y;
894 const ordinate_type w = dx * 0.25 * z*dx*dx/6;
895
896 V += v - w;
897
898 output.put(j->getX(), V);
899 }
900 }
901
902 return V;
903 }
904
905
906 /**
907 * Conversion of data points to integral values.
908 *
909 * The integration directly uses the integral values of the input spline interpolating function.
910 *
911 * \param input collection
912 * \param output mappable collection
913 * \return integral
914 */
915 template<class JElement_t,
916 template<class, class> class JCollection_t,
917 class JDistance_t>
918 inline typename JElement_t::ordinate_type
919 integrate(const JSplineFunction1D<JElement_t, JCollection_t, JResultPDF<typename JElement_t::ordinate_type>, JDistance_t>& input,
920 typename JMappable<JElement_t>::map_type& output)
921 {
922 typedef typename JElement_t::ordinate_type ordinate_type;
923 typedef JResultPDF<ordinate_type> result_type;
925
926 if (input.getSize() > 1) {
927
928 for (const_iterator i = input.begin(); i != input.end(); ++i) {
929 output.put(i->getX(), i->getIntegral());
930 }
931
932 return input.rbegin()->getIntegral();
933 }
934
935 return JMATH::zero;
936 }
937}
938
939#endif
Exceptions.
This include file containes various data structures that can be used as specific return types for the...
Definition of zero value for any class.
Exception for division by zero.
General exception.
Definition JException.hh:24
Exception for a functional operation.
Exception for missing value.
Exception for accessing a value in a collection that is outside of its range.
Template definition of function object interface.
JArgument_t argument_type
static result_type getValue(const JFunctional &function, const argument_type *pX)
Recursive function value evaluation.
Auxiliary class to define first derivates of the spline function at the two extrema.
Definition JSpline.hh:37
std::pair< bool, ordinate_type > fp_at_xmin
Definition JSpline.hh:140
JOrdinate_t ordinate_type
Definition JSpline.hh:40
JSplineBounds()
Default constructor.
Definition JSpline.hh:47
const bool & hasFirstDerivativeAtXmin() const
Has first derivative of function at minimal abscissa value.
Definition JSpline.hh:95
void setFirstDerivativeAtXmax(argument_type fp)
Set first derivative of function at maximal abscissa value.
Definition JSpline.hh:83
const bool & hasFirstDerivativeAtXmax() const
Has first derivative of function at maximal abscissa value.
Definition JSpline.hh:106
void setFirstDerivativeAtXmin(argument_type fp)
Set first derivative of function at minimal abscissa value.
Definition JSpline.hh:71
std::pair< bool, ordinate_type > fp_at_xmax
Definition JSpline.hh:141
ordinate_type getFirstDerivativeAtXmin() const
Get first derivative of function at minimal abscissa value.
Definition JSpline.hh:117
ordinate_type getFirstDerivativeAtXmax() const
Get first derivative of function at maximal abscissa value.
Definition JSpline.hh:131
JLANG::JClass< ordinate_type >::argument_type argument_type
Definition JSpline.hh:41
JSplineBounds(argument_type fpAtXmin, argument_type fpAtXmax)
Constructor.
Definition JSpline.hh:59
Template base class for spline interpolations.
Definition JSpline.hh:180
JSplineCollection()
Default constructor.
Definition JSpline.hh:297
void compile(const JSplineBounds< ordinate_type > &bounds)
Determination of second derivatives with specified bounds.
Definition JSpline.hh:202
collection_type::ordinate_type ordinate_type
Definition JSpline.hh:186
collection_type::const_iterator const_iterator
Definition JSpline.hh:189
collection_type::iterator iterator
Definition JSpline.hh:191
collection_type::abscissa_type abscissa_type
Definition JSpline.hh:185
JCollection_t< JElement_t, JDistance_t > collection_type
Definition JSpline.hh:183
virtual void do_compile() override
Determination of second derivatives with no bounds.
Definition JSpline.hh:304
collection_type::reverse_iterator reverse_iterator
Definition JSpline.hh:192
collection_type::value_type value_type
Definition JSpline.hh:187
collection_type::const_reverse_iterator const_reverse_iterator
Definition JSpline.hh:190
Template class for spline interpolation in 1D.
Definition JSpline.hh:734
collection_type::iterator iterator
Definition JSpline.hh:746
function_type::JExceptionHandler exceptionhandler_type
Definition JSpline.hh:753
collection_type::abscissa_type abscissa_type
Definition JSpline.hh:739
JFunction1D< abscissa_type, JResult_t > function_type
Definition JSpline.hh:749
collection_type::ordinate_type ordinate_type
Definition JSpline.hh:740
function_type::argument_type argument_type
Definition JSpline.hh:751
collection_type::reverse_iterator reverse_iterator
Definition JSpline.hh:747
function_type::result_type result_type
Definition JSpline.hh:752
collection_type::const_reverse_iterator const_reverse_iterator
Definition JSpline.hh:745
collection_type::value_type value_type
Definition JSpline.hh:741
collection_type::const_iterator const_iterator
Definition JSpline.hh:744
JSplineCollection< JElement_t, JCollection_t, JDistance_t > collection_type
Definition JSpline.hh:737
collection_type::distance_type distance_type
Definition JSpline.hh:742
JSplineFunction1D()
Default contructor.
Definition JSpline.hh:759
virtual result_type evaluate(const argument_type *pX) const override
Recursive interpolation method implementation.
Definition JSpline.hh:475
virtual result_type evaluate(const argument_type *pX) const override
Recursive interpolation method implementation.
Definition JSpline.hh:619
void compile(const JSplineBounds< ordinate_type > &bounds)
Determination of second derivatives with specified bounds.
Definition JSpline.hh:590
virtual result_type evaluate(const argument_type *pX) const override
Recursive interpolation method implementation.
Definition JSpline.hh:368
Template definition for functional collection with spline interpolation.
Definition JSpline.hh:318
Functional map with spline interpolation.
Definition JSpline.hh:787
collection_type::abscissa_type abscissa_type
Definition JSpline.hh:793
JSplineMap()
Default constructor.
Definition JSpline.hh:816
collection_type::value_type value_type
Definition JSpline.hh:795
collection_type::const_reverse_iterator const_reverse_iterator
Definition JSpline.hh:799
JResultType< ordinate_type >::result_type data_type
Definition JSpline.hh:807
collection_type::distance_type distance_type
Definition JSpline.hh:796
function_type::argument_type argument_type
Definition JSpline.hh:803
JMap_t< JKey_t, JValue_t, JDistance_t > collection_type
Definition JSpline.hh:790
collection_type::ordinate_type ordinate_type
Definition JSpline.hh:794
function_type::result_type result_type
Definition JSpline.hh:804
JSplineFunction1D_t buffer
Definition JSpline.hh:858
collection_type::iterator iterator
Definition JSpline.hh:800
virtual void do_compile() override
Function compilation.
Definition JSpline.hh:848
function_type::JExceptionHandler exceptionhandler_type
Definition JSpline.hh:805
virtual result_type evaluate(const argument_type *pX) const override
Recursive interpolation method implementation.
Definition JSpline.hh:826
collection_type::reverse_iterator reverse_iterator
Definition JSpline.hh:801
JFunction< JKey_t, JResult_t > function_type
Definition JSpline.hh:791
collection_type::const_iterator const_iterator
Definition JSpline.hh:798
JSplineFunction1D< JSplineElement2D< argument_type, data_type >, JMapCollection< JMap_t >::template collection_type, result_type > JSplineFunction1D_t
Definition JSpline.hh:810
static const JZero zero
Function object to assign zero value.
Definition JZero.hh:105
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary classes and methods for multi-dimensional interpolations and histograms.
return result
Definition JPolint.hh:862
JSplineBounds< JOrdinate_t > make_spline_bounds(const JOrdinate_t fpAtXmin, const JOrdinate_t fpAtXmax)
Helper method for JSplineBounds.
Definition JSpline.hh:153
JElement_t::ordinate_type integrate(const JCollection< JElement_t, JDistance_t > &input, typename JMappable< JElement_t >::map_type &output)
Conversion of data points to integral values.
int j
Definition JPolint.hh:801
JArgument< T >::argument_type argument_type
Definition JClass.hh:82
Template class for distance evaluation.
Definition JDistance.hh:24
Template definition of function object interface in one dimension.
functional_type::result_type result_type
functional_type::argument_type argument_type
Template definition of function object interface in multidimensions.
functional_type::result_type result_type
functional_type::argument_type argument_type
functional_type::JExceptionHandler JExceptionHandler
Exception handler for functional object.
Template class to define the corresponding JCollection for a given template JMap.
Definition JSpline.hh:773
Template interface definition for associative collection of elements.
void put(typename JClass< key_type > ::argument_type key, typename JClass< mapped_type >::argument_type value)
Put pair-wise element (key,value) into collection.
Data structure for result including value and first derivative of function.
Definition JResult.hh:45
Data structure for result including value, first derivative and integrals of function.
Definition JResult.hh:339
Auxiliary class to evaluate result type.
2D Element for spline interpolations.
Definition JSpline.hh:770
Auxiliary data structure for handling std::ostream.