Rate This Document
Findability
Accuracy
Completeness
Readability

kml_?_spline_init

Initialize interpolation object spline. 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_spline or kml_double_spline) 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_spline_init(kml_float_spline *spline, const float xarr[], const float yarr[], const size_t size)

int kml_double_spline_init(kml_double_spline *spline, const double xarr[], const double yarr[], size_t size);

Parameters

Parameter

Type

Description

Input/Output

spline

kml_float_spline* / kml_double_spline*

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_spline *spline = kml_float_spline_alloc(kml_float_interp_cspline, xSize);
kml_float_spline_init(spline, xArr, yArr, xSize);