#include <quad_intp.h>
This is a "conic-section" interpolation for two dimensions, using the function
For a set of data , a value of z is predicted given a value of x and y. This is done by finding the conic section obeying the above relation that goes through six closest points in the data set.
This procedure does not always succeed. It fails when the 6 closest points are somehow degenerate, for example, if they are all colinear.
The vector and matrix types can be any types which have suitably defined functions operator[]
.
There is no caching so the numeric values of the data may be freely changed between calls to interp().
Definition at line 64 of file quad_intp.h.
Public Member Functions | |
quad_intp () | |
int | compare (const void *x, const void *y) |
int | set_data (size_t n_points, vec_t &x, vec_t &y, size_t n_dat, mat_t &dat) |
Initialize the data for the quad interpolation. | |
int | interp (double x, double y, vec_t &ip) |
Perform the quadratic interpolation. | |
Protected Member Functions | |
int | swap (int &i1, double &c1, int &i2, double &c2) |
Protected Attributes | |
int | np |
The number of grid points. | |
int | nd |
The number of functions. | |
vec_t * | ux |
The x-values. | |
vec_t * | uy |
The y-values. | |
mat_t * | udat |
The data. | |
bool | data_set |
True if the data has been given by the user. | |
Data Structures | |
struct | point |
int interp | ( | double | x, | |
double | y, | |||
vec_t & | ip | |||
) | [inline] |
Perform the quadratic interpolation.
It is assumed that ip
is properly allocated beforehand.
Definition at line 105 of file quad_intp.h.