1 #ifndef NPSTAT_LININTERPOLATEDTABLE1D_HH_
2 #define NPSTAT_LININTERPOLATEDTABLE1D_HH_
27 #include "geners/CPP11_auto_ptr.hh"
28 #include "geners/ClassId.hh"
48 template <
typename Real>
50 double x_min,
double x_max,
51 bool leftExtrapolationLinear,
52 bool rightExtrapolationLinear);
61 template <
typename Real>
64 bool leftExtrapolationLinear,
65 bool rightExtrapolationLinear);
85 {
return !(*
this == r);}
90 inline double xmin()
const {
return xmin_;}
91 inline double xmax()
const {
return xmax_;}
92 inline unsigned npoints()
const {
return npoints_;}
93 inline bool leftExtrapolationLinear()
const
94 {
return leftExtrapolationLinear_;}
95 inline bool rightExtrapolationLinear()
const
96 {
return rightExtrapolationLinear_;}
97 inline const double* data()
const {
return &data_[0];}
118 CPP11_auto_ptr<LinInterpolatedTable1D>
inverse(
119 unsigned npoints,
bool leftExtrapolationLinear,
120 bool rightExtrapolationLinear)
const;
124 inline gs::ClassId
classId()
const {
return gs::ClassId(*
this);}
125 bool write(std::ostream& of)
const;
128 static inline const char* classname()
129 {
return "npstat::LinInterpolatedTable1D";}
130 static inline unsigned version() {
return 1;}
134 static inline double interpolateSimple(
135 const double x0,
const double x1,
136 const double y0,
const double y1,
139 return y0 + (y1 - y0)*((x - x0)/(x1 - x0));
142 std::vector<double> data_;
147 bool leftExtrapolationLinear_;
148 bool rightExtrapolationLinear_;
149 mutable bool monotonous_;
150 mutable bool monotonicityKnown_;
155 unsigned npoints,
bool leftExtrapolationLinear,
156 bool rightExtrapolationLinear)
const
158 CPP11_auto_ptr<LinInterpolatedTable1D> ptr =
inverse(
159 npoints, leftExtrapolationLinear, rightExtrapolationLinear);
160 return ptr.release();
166 #include "npstat/nm/LinInterpolatedTable1D.icc"
Definition: LinInterpolatedTable1D.hh:39
LinInterpolatedTable1D(const std::vector< std::pair< Real, Real > > &v, unsigned npoints, bool leftExtrapolationLinear, bool rightExtrapolationLinear)
double operator()(const double &x) const
CPP11_auto_ptr< LinInterpolatedTable1D > inverse(unsigned npoints, bool leftExtrapolationLinear, bool rightExtrapolationLinear) const
gs::ClassId classId() const
Definition: LinInterpolatedTable1D.hh:124
LinInterpolatedTable1D(double c)
bool isMonotonous() const
LinInterpolatedTable1D(const Real *data, unsigned npoints, double x_min, double x_max, bool leftExtrapolationLinear, bool rightExtrapolationLinear)
bool operator==(const LinInterpolatedTable1D &r) const
double xmin() const
Definition: LinInterpolatedTable1D.hh:90
Definition: AbsArrayProjector.hh:14