kml_?_interp_eval_integ
Return the integral of the interpolation function at a given point (x). The interpolation object interp, data arrays xarr and yarr, and accelerator xacc are used in the calculation. If x is outside the range of xarr, an error message is returned.
Interface Definition
int kml_float_interp_eval_integ_e(const kml_float_interp *interp, const float xa[], const float ya[],
float a, float b, kml_interp_accel *acc, float *result)
float kml_float_interp_eval_integ(const kml_float_interp *interp, const float xa[], const float ya[],
float a, float b, kml_interp_accel *acc)
int kml_double_interp_eval_integ_e(const kml_double_interp *interp, const double xa[], const double ya[], double a,
double b, kml_interp_accel *acc, double *result);
double kml_double_interp_eval_integ(const kml_double_interp *interp, const double xa[], const double ya[], double a,
double b, kml_interp_accel *acc);
Parameters
Parameter |
Type |
Description |
Input/Output |
|---|---|---|---|
interp |
kml_float_interp*, kml_double_interp* |
Pointer to an interpolation object. |
Input |
xa |
float, double |
Array that stores the value of x. |
Input |
ya |
float, double |
Array that stores the value of y. |
Input |
x |
float, double |
Value of the solution point x. |
Input |
a |
kml_interp_accel * |
Pointer to an accelerator object. |
Input |
dydx |
float, double |
Second-order differential at the fixed point x. |
Input |
Dependencies
#include "kipl.h"
Examples
const size_t xMin = 4;
const size_t xMax = 2048;
const size_t xSize = 4;
const float xValLo = 1;
const float xValHi = 2;
float xArr[4] = {1,1.33,1.67,2};
float* yArr = (float*)malloc(xSize * sizeof(float));
float x = 1;
float y = 0;
kml_float_interp *interp = kml_float_interp_alloc(kml_float_interp_cspline, xSize);
kml_interp_accel *xacc = kml_interp_accel_alloc();
kml_float_interp_init(interp, xSize, xArr, yArr);
y = kml_float_interp_eval_integ(interp, xArr, yArr, x, xacc);
kml_float_interp_free(interp);
kml_interp_accel_free(xacc);