#### Description:

This is a fictitious function which does not actually exist. Instead, this description constitutes a template so that you may implement a function with this interface for yourself (and give it any name you wish). A pointer to such a function may be passed via the `"` finterp`"` parameter of the astResample <X > functions (q.v.) in order to perform sub-pixel interpolation during resampling of gridded data (you must also set the `"` interp`"` parameter of astResample <X > to the value AST__UINTERP). This allows you to use your own interpolation algorithm in addition to those which are pre-defined.

The function interpolates an input grid of data (and, optionally, processes associated statistical variance estimates) at a specified set of points.

#### Synopsis

void astUinterp( int ndim_in, const AstDim lbnd_in[], const AstDim ubnd_in[], const <Xtype > in[], const <Xtype > in_var[], AstDim npoint, const AstDim offset[], const double ∗const coords[], const double params[], int flags, <Xtype > badval, <Xtype > out[], <Xtype > out_var[], AstDim ∗nbad )

#### Parameters:

##### ndim_in

The number of dimensions in the input grid. This will be at least one.

##### lbnd_in

Pointer to an array of integers, with `"` ndim_in`"` elements, containing the coordinates of the centre of the first pixel in the input grid along each dimension.

##### ubnd_in

Pointer to an array of integers, with `"` ndim_in`"` elements, containing the coordinates of the centre of the last pixel in the input grid along each dimension.

Note that `"` lbnd_in`"` and `"` ubnd_in`"` together define the shape, size and coordinate system of the input grid in the same way as they do in astResample <X >.

##### in

Pointer to an array, with one element for each pixel in the input grid, containing the input data. This will be the same array as was passed to astResample <X > via the `"` in`"` parameter. The numerical type of this array should match that of the data being processed.

##### in_var

Pointer to an optional second array with the same size and type as the `"` in`"` array. If given, this will contain the set of variance values associated with the input data and will be the same array as was passed to astResample <X > via the `"` in_var`"` parameter.

If no variance values are being processed, this will be a NULL pointer.

##### npoint

The number of points at which the input grid is to be interpolated. This will be at least one.

##### offset

Pointer to an array of integers with `"` npoint`"` elements. For each interpolation point, this will contain the zero-based index in the `"` out`"` (and `"` out_var`"` ) array(s) at which the interpolated value (and its variance, if required) should be stored. For example, the interpolated value for point number `"` point`"` should be stored in `"` out[offset[point]]`"` (assuming the index `"` point`"` is zero-based).

##### coords

An array of pointers to double, with `"` ndim_in`"` elements. Element `"` coords[coord]`"` will point at the first element of an array of double (with `"` npoint`"` elements) which contains the values of coordinate number `"` coord`"` for each interpolation point. The value of coordinate number `"` coord`"` for interpolation point number `"` point`"` is therefore given by `"` coords[coord][point]`"` (assuming both indices are zero-based).

If any interpolation point has any of its coordinates equal to the value AST__BAD (as defined in the `"` ast.h`"` header file), then the corresponding output data (and variance) should either be set to the value given by `"` badval`"` , or left unchanged, depending on whether the AST__NOBAD flag is specified by `"` flags`"` .

##### params

This will be a pointer to the same array as was given via the `"` params`"` parameter of astResample <X >. You may use this to pass any additional parameter values required by your interpolation algorithm.

##### flags

This will be the same value as was given via the `"` flags`"` parameter of astResample <X >. You may test this value to provide additional control over the operation of your resampling algorithm. Note that the special flag values AST__URESAMP1, 2, 3 & 4 are reserved for you to use for your own purposes and will not clash with other pre-defined flag values (see astResample <X >).

##### badval

This will be the same value as was given via the `"` badval`"` parameter of astResample <X >, and will have the same numerical type as the data being processed (i.e. as elements of the `"` in`"` array). It should be used to test for bad pixels in the input grid (but only if the AST__USEBAD flag is set via the `"` flags`"` parameter) and (unless the AST__NOBAD flag is set in `"` flags`"` ) for identifying bad output values in the `"` out`"` (and `"` out_var`"` ) array(s).

##### out

Pointer to an array with the same numerical type as the `"` in`"` array, into which the interpolated data values should be returned. Note that details of the storage order and number of dimensions of this array are not required, since the `"` offset`"` array contains all necessary information about where each returned value should be stored.

In general, not all elements of this array (or the `"` out_var`"` array below) may be used in any particular invocation of the function. Those which are not used should be returned unchanged.

##### out_var

Pointer to an optional array with the same type and size as the `"` out`"` array, into which variance estimates for the resampled values should be returned. This array will only be given if the `"` in_var`"` array has also been given.

If given, it is addressed in exactly the same way (via the `"` offset`"` array) as the `"` out`"` array. The values returned should be estimates of the statistical variance of the corresponding values in the `"` out`"` array, on the assumption that all errors in input data values are statistically independent and that their variance estimates may simply be summed (with appropriate weighting factors).

If no output variance estimates are required, a NULL pointer will be given.

##### nbad

Pointer to an int in which to return the number of interpolation points at which no valid interpolated value could be obtained. The maximum value that should be returned is `"` npoint`"` , and the minimum is zero (indicating that all output values were successfully obtained).

#### Notes:

- The data type <Xtype > indicates the numerical type of the data being processed, as for astResample <X >.

- This function will typically be invoked more than once for each invocation of astResample <X >.

- If an error occurs within this function, it should use astSetStatus to set the AST error status to an error value. This will cause an immediate return from astResample <X >. The error value AST__UINER is available for this purpose, but other values may also be used (e.g. if you wish to distinguish different types of error).

Copyright (C) 2021 East Asian Observatory