#include <funtab.h> FunctionTable *ft_open(string fname, int mode, int xcol, int ycol); real ft_spline(FunctionTable *ft, real x); int ft_close(FunctionTable *ft);
ft_open is used to initialize an interpolation table. Inputs are the filename fname, a mode of interpolation (currently FUNTAB_LINEAR, and FUNTAB_SPLINE have been implemented), and the two columns from the table (1 being the first column) that are used for X and Y.
ft_spline returns a spline interpolated value for a given input value x.
ft_close must be called if you want to free up memory used by these routines.
typedef struct FunctionTable { string name; /* ID or filename */ int mode; /* lookup mode (one of the FUNTAB_xxx modes) */ int n; /* Number of points in table */ real *x; /* pointer to array of X values */ real *y; /* pointer to array of Y values */ real *coeff; /* (spline) coefficients, if used */ int errors; /* cumulative errors in interpolation */ } FunctionTable;from the standard include file funtab.h.
Linear interpolation isn’t even working.
~/src/kernel/tab funtab.c
4-oct-93 Created PJT 5-mar-94 Documented PJT