ndpolator 1.3.0
fast, n-dimensional linear interpolation and extrapolation on sparse grids
Loading...
Searching...
No Matches
Ndpolator structures

Core data types defined and used by ndpolator. More...

Data Structures

struct  ndp_axis
 Single axis structure containing vertices for one dimension. More...
struct  ndp_axes
 Multi-axis collection with basic and associated axes. More...
struct  ndp_query_pts
 Query points structure with indices, flags and coordinates. More...
struct  ndp_table
 self-contained ndpolation table with axes, grid values and spatial indices. More...
struct  ndp_hypercube
 N-dimensional hypercube containing vertex values for interpolation. More...
struct  ndp_query
 Main query structure containing query points, hypercubes and results. More...

Detailed Description

Core data types defined and used by ndpolator.

These structures define the grid, axes, and query data that ndpolator works with.


Data Structure Documentation

◆ ndp_axis

struct ndp_axis

Single axis structure containing vertices for one dimension.

An axis, in ndpolator language, is an array of length len and vertices val. Axes span ndpolator dimensions: for N-dimensional interpolation and/or extrapolation, there need to be N axes. Note that axes themselves do not have any function values associated to them; they only span the N-dimensional grid.

Data Fields
int len

Axis length (number of vertices)

double * val

Axis vertices array

int owns_data

Flag indicating if ndp_axis owns the val array

◆ ndp_axes

struct ndp_axes

Multi-axis collection with basic and associated axes.

This structure stores all axes that span the ndpolator grid. Each axis must be of the ndp_axis type. Function values are associated to each combination (cartesian product) of axis indices.

There are two types of axes that ndpolator recognizes: basic and associated. Basic axes span the sparse grid: function values can either be defined, or null. Associated axes, on the other hand, are guaranteed to have function values defined for all combinations of basic indices that have function values defined. For example, if (i, j, k) are basic indices that have a defined function value, then (i, j, k, l, m) are guaranteed to be defined as well, where l and m index associated axes.

Data Fields

int len
int nbasic
ndp_axis ** axis

Field Documentation

◆ len

int len

Number of axes

◆ nbasic

int nbasic

Number of basic axes (must precede any associated axes in the axis array)

◆ axis

ndp_axis** axis

Array of ndp_axis pointers

◆ ndp_query_pts

struct ndp_query_pts

Query points structure with indices, flags and coordinates.

Query points (points of interest) are given by n coordinates that correspond to n ndp_axis instances stored in ndp_axes. Their number is given by the nelems field and their dimension by the naxes field. The indices array provides superior corners of the hypercube that contains a query point; the flags array tags each query point component with one of the ndp_vertex_flag flags: NDP_ON_GRID, NDP_ON_VERTEX, or NDP_OUT_OF_BOUNDS. The actual query points (as passed to ndpolator, in axis units) are stored in the requested array, and the unit-hypercube normalized coordinates are stored in the normed array.

Data Fields
int nelems

Number of query points

int naxes

Query point dimension (number of axes)

int * indices

Array of superior hypercube indices

int * flags

Array of flags, one per query point component

double * requested

Array of absolute query points (in axis units)

double * normed

Array of unit-hypercube normalized query points

◆ ndp_table

struct ndp_table

self-contained ndpolation table with axes, grid values and spatial indices.

Ndpolator uses ndp_table to store all relevant parameters for interpolation and/or extrapolation. It stores the axes that span the interpolation hyperspace (in a ndp_axes structure), the function values across the interpolation hyperspace (grid and kdtree), function value length (vdim), and several private fields that further optimize interpolation.

Data Fields

int vdim
ndp_axesaxes
double * grid
int owns_data
struct kdtree * vtree
struct kdtree * hctree

Field Documentation

◆ vdim

int vdim

Vertex dimension (i.e., function value length): 1 for scalars, >1 for arrays

◆ axes

ndp_axes* axes

ndp_axes instance that defines all axes

◆ grid

double* grid

Array holding all function values in C-native order

◆ owns_data

int owns_data

Flag indicating if ndp_table owns the grid array

◆ vtree

struct kdtree* vtree

Vertex k-d tree spatial index for nearest neighbor search

◆ hctree

struct kdtree* hctree

Hypercube k-d tree spatial index for nearest neighbor search

◆ ndp_hypercube

struct ndp_hypercube

N-dimensional hypercube containing vertex values for interpolation.

Hypercubes are subgrids that enclose (or are adjacent to, in the case of extrapolation) the passed query points, one per query point. They are qualified by their dimension (an N-dimensional hypercube has 2N vertices) and their function value length. Note that hypercube dimension can be less than the dimension of the grid itself: if a query point coincides with any of the axes, that will reduce the dimensionality of the hypercube. If all query point components coincide with the axes (i.e, the vertex itself is requested), then the hypercube dimension equals 0, so there is no interpolation at all – only that vertex's function value is returned.

Data Fields
int dim

Dimension of the hypercube

int vdim

Function value length

int fdhc

Flag indicating whether the hypercube is fully defined

double * v

Hypercube vertex function values in C order (last dimension stride-1)

◆ ndp_query

struct ndp_query

Main query structure containing query points, hypercubes and results.

Query is ndpolator's main work structure. It stores the query points (called elements in the structure), the corresponding axis indices, flags, and hypercubes. Once interpolation/extrapolation is done (by calling ndpolate), interpolated values are also stored in it.

Data Fields
int nelems

Number of query points

int extrapolation_method

ndp_extrapolation_method used for this query

int search_algorithm

ndp_search_algorithm used for this query

ndp_hypercube ** hypercubes

Array of hypercubes, one per query point

double * interps

Array of interpolation/extrapolation results

double * dists

Array of distances to nearest fully defined hypercube