Rate This Document
Findability
Accuracy
Completeness
Readability

kml_?_interp_init

Initialize interpolation object interp. For data (xarr, yarr), xarr is an array of size xsize, and yarr is a function result array of size xsize. The interpolation object (kml_float_interp or kml_double_interp) does not store xarr and yarr. Instead, it only stores the static states calculated from the data. xarr must be strictly sorted in ascending order.

Interface Definition

int kml_float_interp_init(kml_float_interp *interp, const float xarr[], const float yarr[], const size_t size)

int kml_double_interp_init(kml_double_interp *interp, const double xarr[], const double yarr[], size_t size);

Parameters

Parameter

Type

Description

Input/Output

interp

kml_float_interp* / kml_double_interp*

Pointer to an interpolation object.

Output

xarr

Float/Double array

Array that stores the value of x.

Input

yarr

Float/Double array

Array that stores the value of y.

Input

size

size_t

Length of the x array.

Input

Dependencies

#include "kipl.h"

Examples

const size_t xSize = 4;
float xArr[4] = {1,1.33,1.67,2};
float* yArr = (float*)malloc(xSize * sizeof(float));
kml_float_interp *interp = kml_float_interp_alloc(kml_float_interp_cspline, xSize);
kml_float_interp_init(interp, xArr, yArr, xSize);