Table of Contents

Name

ft_open, ft_spline, ft_close - function table processing routines

Synopsis


#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);

Description

A FunctionTable is a data structure, defined in <funtab.h>, with which ASCII tables can be used to interpolate values from. The FunctionTable can be considered an opaque pointer: it should be of no concern to the applications programmer what’s inside.

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.

Function-table Structure


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.

Bugs

Files larger than MAXLINES (see table(3NEMO) and stdinc.h) may have problems being fully processed.

Linear interpolation isn’t even working.

See Also

spline(3NEMO)

Author

Peter Teuben

Files


~/src/kernel/tab    funtab.c

Update History


4-oct-93    Created       PJT
5-mar-94    Documented    PJT


Table of Contents