quad_intp Class Template Reference

#include <quad_intp.h>


Detailed Description

template<class vec_t, class mat_t>
class quad_intp< vec_t, mat_t >

Interpolate a function of two independent variables with a quadratic polynomial.

This is a "conic-section" interpolation for two dimensions, using the function

\[ z(x,y) = a_1 x^2 + a_2 x y + a_3 y^2 + a_4 x + a_5 y + a_6 \]

For a set of data ${x_i,y_i,z_i}$, 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().

Bug:
This class doesn't seem to work at present.

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

Member Function Documentation

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.


The documentation for this class was generated from the following file:

Documentation generated with Doxygen and provided under the GNU Free Documentation License. See License Information for details.

Project hosting provided by SourceForge.net Logo, O2scl Sourceforge Project Page