kml_?_interp_eval_deriv
Return the derivative 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_deriv_e(const kml_float_interp *interp, const float xa[], const float ya[], float x,
kml_interp_accel *a, float *dydx)
float kml_float_interp_eval_deriv(const kml_float_interp *interp, const float xa[], const float ya[], float x,
kml_interp_accel *a)
int kml_double_interp_eval_deriv_e(const kml_double_interp *interp, const double xa[], const double ya[], double x,
kml_interp_accel *a, double *dydx);
double kml_double_interp_eval_deriv(const kml_double_interp *interp, const double xa[], const double ya[], double x,
kml_interp_accel *a);
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_deriv(interp, xArr, yArr, x, xacc);
kml_float_interp_free(interp);
kml_interp_accel_free(xacc);