37 #ifndef EGS_INTERPOLATOR_
38 #define EGS_INTERPOLATOR_
42 typedef EGS_Float(*EGS_InterpolatorFuncion)(EGS_Float,
void *);
62 const EGS_Float *values);
72 EGS_InterpolatorFuncion func,
84 EGS_InterpolatorFuncion func,
void *data,
85 int nmax = 1024, EGS_Float accu = 1e-4);
96 EGS_Float *a, EGS_Float *b);
108 void initialize(
int nbin, EGS_Float Xmin, EGS_Float Xmax,
109 const EGS_Float *values);
118 void initialize(
int nbin, EGS_Float Xmin, EGS_Float Xmax,
119 EGS_InterpolatorFuncion func,
128 void initialize(EGS_Float Xmin, EGS_Float Xmax,
129 EGS_InterpolatorFuncion func,
void *data,
130 int nmax = 1024, EGS_Float accu = 1e-4);
139 void initialize(
int nbin, EGS_Float Xmin, EGS_Float Xmax,
140 EGS_Float *a, EGS_Float *b);
151 if (x > xmin && x < xmax) {
152 int i = (int)(ax + bx*x);
156 return a[i] + b[i]*x;
158 else if (x <= xmin) {
174 int i = (int)(ax + bx*x);
175 return a[i] + b[i]*x;
183 if (x > xmin && x < xmax) {
184 return (
int)(ax + bx*x);
186 else if (x <= xmin) {
202 return (
int)(ax + bx*x);
222 return a[i] + b[i]*x;
234 inline EGS_Float
get_a(
int i)
const {
238 inline EGS_Float
get_b(
int i)
const {
253 void check(
int nbin, EGS_Float Xmin, EGS_Float Xmax);
EGS_Float interpolateFast(EGS_Float x) const
Interpolate the function value at x.
#define EGS_EXPORT
Export symbols from the egspp library.
int getIndex(EGS_Float x) const
Get the interpolation index corresponding to x.
int getIndexFast(EGS_Float x) const
Get the interpolation index corresponding to x.
EGS_Float get_b(int i) const
Get i-th interval interpolation parameter b[i].
EGS_Float interpolate(EGS_Float x) const
Interpolate the function value at x.
EGS_Float getXmax() const
Get the upper interpolation interval limit.
A class for fast run-time interpolations.
Defines the EGS_EXPORT and EGS_LOCAL macros.
EGS_Float getXmin() const
Get the lower interpolation interval limit.
EGS_Float interpolateFast(int i, EGS_Float x) const
Interpolate the function value at x assuming that belongs to the interpolation interval i...
EGS_Float get_a(int i) const
Get i-th interval interpolation parameter a[i].