TabulatedFunctionErrors.h
Go to the documentation of this file.
1 #ifndef _utl_TabulatedFunctionErrors_h_
2 #define _utl_TabulatedFunctionErrors_h_
3 
11 #include <vector>
12 #include <utl/Pair.h>
13 #include <utl/TabulatedFunction.h>
14 
15 
16 namespace utl {
17 
18  /*
19  \class TabulatedFunctionErrors TabulatedFunctionErrors.h "utl/TabulatedFunctionErrors.h"
20  */
21 
23 
24  public:
27 
28  TabulatedFunctionErrors(const unsigned int interpolationOrder = 1,
29  const double borderTolerance = 1e-3)
30  : TabulatedFunction(interpolationOrder, borderTolerance) { }
31 
32  TabulatedFunctionErrors(const std::vector<double>& xValues,
33  const std::vector<double>& xValuesErr,
34  const std::vector<double>& yValues,
35  const std::vector<double>& yValuesErr,
36  const unsigned int interpolationOrder = 1,
37  const double borderTolerance = 1e-3) :
38  TabulatedFunction(interpolationOrder, borderTolerance)
39  { FillTable(xValues, xValuesErr,yValues, yValuesErr); }
40 
41  PairErr operator[](const int idx) const
42  { return PairErr(fX[idx], fXErr[idx], fY[idx], fYErr[idx]); }
43 
44  void Clear();
45 
46  void PushBack(const double x, const double xErr,
47  const double y, const double yErr);
48 
50  { return IteratorErr(fX.begin(), fXErr.begin(), fY.begin(), fYErr.begin()); }
51 
53  { return IteratorErr(fX.end(), fXErr.end(), fY.end(), fYErr.end()); }
54 
56  { return ConstIteratorErr(fX.begin(), fXErr.begin(), fY.begin(), fYErr.begin()); }
57 
59  { return ConstIteratorErr(fX.end(), fXErr.end(), fY.end(), fYErr.end()); }
60 
62 
63 
64  ArrayIterator XErrBegin() { return fXErr.begin(); }
65 
67  ArrayConstIterator XErrBegin() const { return fXErr.begin(); }
68 
70  ArrayIterator YErrBegin() { return fYErr.begin(); }
71 
73  ArrayConstIterator YErrBegin() const { return fYErr.begin(); }
74 
76  ArrayIterator XErrEnd() { return fXErr.end(); }
77 
79  ArrayConstIterator XErrEnd() const { return fXErr.end(); }
80 
82  ArrayIterator YErrEnd() { return fYErr.end(); }
83 
85  ArrayConstIterator YErrEnd() const { return fYErr.end(); }
86 
89 
90  const double& GetXErr(const unsigned int idx) const { return fXErr[idx]; }
91  const double& GetYErr(const unsigned int idx) const { return fYErr[idx]; }
92 
93  double& GetXErr(const unsigned int idx) { return fXErr[idx]; }
94  double& GetYErr(const unsigned int idx) { return fYErr[idx]; }
95 
96  IteratorErr Insert(const IteratorErr& pos,
97  const double x, const double xErr,
98  const double y, const double yErr);
99 
100  //ConstIteratorErr Find(const double x, const double y) const;
101 
102  ConstIteratorErr FindX(const double x) const;
103 
104  ConstIteratorErr FindY(const double y) const;
105 
106  void
108  {
110  std::swap(fXErr, tf.fXErr);
111  std::swap(fYErr, tf.fYErr);
112  }
113 
114  private:
115  void FillTable(const std::vector<double>& xValues,
116  const std::vector<double>& xValuesErr,
117  const std::vector<double>& yValues,
118  const std::vector<double>& yValuesErr);
119 
120  private:
123 
125 
126  };
127 
128 }
129 
130 
131 #endif
ArrayConstIterator YErrEnd() const
end of array of errors Y
void swap(utl::Trace< T > &t1, utl::Trace< T > &t2)
Definition: Trace.h:363
#define OFFLINE_MAKE_BOTH_ITERATOR_RANGES(_Iterator_, _ConstIterator_, _NamePrefix_)
Definition: IteratorRange.h:43
#define OFFLINE_MAKE_BOTH_FRIEND_RANGES(_Iterator_, _ConstIterator_, _Class_)
Array::const_iterator ArrayConstIterator
double & GetYErr(const unsigned int idx)
TabulatedFunctionErrIterator IteratorErr
A pair of graph points (x,y) with errors.
Definition: PairErr.h:17
Class to hold collection (x,y) points and provide interpolation between them.
friend void swap(utl::TabulatedFunctionErrors &t1, utl::TabulatedFunctionErrors &t2)
TabulatedFunctionErrors(const std::vector< double > &xValues, const std::vector< double > &xValuesErr, const std::vector< double > &yValues, const std::vector< double > &yValuesErr, const unsigned int interpolationOrder=1, const double borderTolerance=1e-3)
ArrayIterator XErrEnd()
end of array of errors X
ConstIteratorErr Begin() const
double & GetXErr(const unsigned int idx)
ConstTabulatedFunctionErrIterator ConstIteratorErr
std::vector< double > Array
const double & GetYErr(const unsigned int idx) const
PairErr operator[](const int idx) const
ArrayIterator XErrBegin()
begin of array of errors X
void PushBack(const double x, const double xErr, const double y, const double yErr)
a second level trigger
Definition: XbT2.h:8
const double & GetXErr(const unsigned int idx) const
ArrayConstIterator XErrEnd() const
end of array of errors X
ArrayIterator YErrBegin()
begin of array of errors Y
Array::iterator ArrayIterator
IteratorErr Insert(const IteratorErr &pos, const double x, const double xErr, const double y, const double yErr)
void Swap(TabulatedFunction &tf)
void FillTable(const std::vector< double > &xValues, const std::vector< double > &xValuesErr, const std::vector< double > &yValues, const std::vector< double > &yValuesErr)
ConstIteratorErr End() const
ArrayConstIterator XErrBegin() const
begin of array of errors X
ConstIteratorErr FindX(const double x) const
void Swap(TabulatedFunctionErrors &tf)
TabulatedFunctionErrors(const unsigned int interpolationOrder=1, const double borderTolerance=1e-3)
ConstIteratorErr FindY(const double y) const
ArrayIterator YErrEnd()
end of array of errors Y
ArrayConstIterator YErrBegin() const
begin of array of errors Y

, generated on Tue Sep 26 2023.