Linear interpolation
Here linear means that the result depends linearly on the interpolated array. The interpolation functions (or kernels) may be linear or not (e.g., cubic spline).
Unidimensional interpolation
Unidimensional interpolation is done by:
apply(ker, x, src) -> dstwhich interpolates source array src with kernel ker at positions x, the result is an array of same dimensions as x. The destination array can be provided:
apply!(dst, ker, x, src) -> dstwhich overwrites dst with the result of the interpolation of source src with kernel ker at positions specified by x. If x is an array, dst must have the same size as x; otherwise, x may be a fonction which is applied to all indices of dst (as generated by eachindex(dst)) to produce the coordinates where to interpolate the source. The destination dst is returned.
The adjoint/direct operation can be applied:
apply(P, ker, x, src) -> dst
apply!(dst, P, ker, x, src) -> dstwhere P is either Adjoint or Direct. If P is omitted, Direct is assumed.
To linearly combine the result and the contents of the destination array, the following syntax is also implemented:
apply!(α, P, ker, x, src, β, dst) -> dstwhich overwrites dst with β*dst plus α times the result of the operation implied by P (Direct or Adjoint) on source src with kernel ker at positions specified by x.
Separable multi-dimensional interpolation
Separable multi-dimensional interpolation consists in interpolating each dimension of the source array with, possibly, different kernels and at given positions. For instance:
apply(ker1, x1, [ker2=ker1,] x2, src) -> dstyields the 2D separable interpolation of src with kernel ker1 at positions x1 along the first dimension of src and with kernel ker2 at positions x2 along the second dimension of src. Note that, if omitted the second kernel is assumed to be the same as the first one. The above example extends to more dimensions (providing it is implemented). Positions x1, x2, ... must be unidimensional arrays their lengths give the size of the result of the interpolation.
The apply the adjoint and/or linearly combine the result of the interpolation and the contents of the destination array, the same methods as for unidimensional interpolation are supported, it is sufficient to replace arguments ker,x by ker1,x1,[ker2=ker1,]x2.
Nonseparable multi-dimensional interpolation
Nonseparable 2D interpolation is implemented where the coordinates to interpolate are given by an affine transform which converts the indices in the destination array into fractional coordinates in the source array (for the direct operation). The syntax is:
apply!(dst, [P=Direct,] ker1, [ker2=ker1,] R, src) -> dstwhere R is an AffineTransform2D and P is Direct (the default) or Adjoint.