naginterfaces.library.fit.dim2_​spline_​ts_​sctr

naginterfaces.library.fit.dim2_spline_ts_sctr(x, y, f, lsminp, lsmaxp, nxcels, nycels, comm)[source]

dim2_spline_ts_sctr computes a spline approximation to a set of scattered data using a two-stage approximation method.

The computational complexity of the method grows linearly with the number of data points; hence large datasets are easily accommodated.

Note: this function uses optional algorithmic parameters, see also: opt_set(), opt_get().

For full information please refer to the NAG Library document for e02jd

https://www.nag.com/numeric/nl/nagdoc_28.5/flhtml/e02/e02jdf.html

Parameters
xfloat, array-like, shape

The data values to be fitted.

yfloat, array-like, shape

The data values to be fitted.

ffloat, array-like, shape

The data values to be fitted.

lsminpint

and are control parameters for the local approximations.

Each local approximation is computed on a local domain containing one of the triangles in the discretization of the bounding box.

The size of each local domain will be adaptively chosen such that if it contains fewer than sample points it is expanded, else if it contains greater than sample points a thinning method is applied. mainly controls computational cost (in that working with a thinned set of points is cheaper and may be appropriate if the input data is densely distributed), while allows handling of different types of scattered data.

Setting , and, therefore, forcing either expansion or thinning, may be useful for computing initial coarse approximations.

In general smaller values for these arguments reduces cost.

A calibration procedure (experimenting with a small subset of the data to be fitted and validating the results) may be needed to choose the most appropriate values for and .

lsmaxpint

and are control parameters for the local approximations.

Each local approximation is computed on a local domain containing one of the triangles in the discretization of the bounding box.

The size of each local domain will be adaptively chosen such that if it contains fewer than sample points it is expanded, else if it contains greater than sample points a thinning method is applied. mainly controls computational cost (in that working with a thinned set of points is cheaper and may be appropriate if the input data is densely distributed), while allows handling of different types of scattered data.

Setting , and, therefore, forcing either expansion or thinning, may be useful for computing initial coarse approximations.

In general smaller values for these arguments reduces cost.

A calibration procedure (experimenting with a small subset of the data to be fitted and validating the results) may be needed to choose the most appropriate values for and .

nxcelsint

(respectively ) is the number of cells in the (respectively ) direction that will be used to create the triangulation of the bounding box of the domain of the function to be fitted.

Greater efficiency generally comes when and are chosen to be of the same order of magnitude and are such that is .

Thus for a ‘square’ triangulation — when — the quantities and should be of the same order of magnitude.

See also Further Comments.

nycelsint

(respectively ) is the number of cells in the (respectively ) direction that will be used to create the triangulation of the bounding box of the domain of the function to be fitted.

Greater efficiency generally comes when and are chosen to be of the same order of magnitude and are such that is .

Thus for a ‘square’ triangulation — when — the quantities and should be of the same order of magnitude.

See also Further Comments.

commdict, communication object, modified in place

Communication structure.

This argument must have been initialized by a prior call to opt_set().

Other Parameters
‘Averaged Spline’str

Default

When the bounding box is triangulated there are equivalent configurations of the mesh. Setting will use the averaged value of the possible local polynomial approximations over each triangle in the mesh. This usually gives better results but at (about 8 times) higher computational cost.

Constraint: or .

‘Global Smoothing Level’int

Default

The smoothness level for the global spline approximation.

Will use piecewise cubics.

Will use piecewise sextics.

‘Interpolation Only RBF’str

Default

If , each local RBF approximation is computed by interpolation.

If , each local RBF approximation is computed by a discrete least squares approach. This is likely to be more accurate and more expensive than interpolation.

If or , this option setting is ignored.

‘Local Method’str

Default

The local approximation scheme to use.

Uses least squares polynomial approximations.

Uses hybrid polynomial and RBF approximations.

Uses pure RBF approximations.

In general is less computationally expensive than is less computationally expensive than with the reverse ordering holding for accuracy of results.

‘Minimum Singular Value LHA’float

Default

A tolerance measure for accepting or rejecting a local hybrid approximation (LHA) as reliable.

The solution of a local least squares problem solved on each triangle subdomain is accepted as reliable if the minimum singular value of the collocation matrix (of polynomial and radial basis function terms) associated with the least squares problem satisfies .

In general the approximation power will be reduced as ‘Minimum Singular Value LHA’ is reduced. (A small indicates that the local data has hidden redundancies which prevent it from carrying enough information for a good approximation to be made.) Setting ‘Minimum Singular Value LHA’ very large may have the detrimental effect that only approximations of low degree are deemed reliable.

A calibration procedure (experimenting with a small subset of the data to be fitted and validating the results) may be needed to choose the most appropriate value for this parameter.

If or , this option setting is ignored.

‘Minimum Singular Value LPA’float

Default

A tolerance measure for accepting or rejecting a local polynomial approximation (LPA) as reliable. Clearly this setting is relevant when , but it also may be used when (see Further Comments.)

The solution of a local least squares problem solved on each triangle subdomain is accepted as reliable if the minimum singular value of the matrix (of Bernstein polynomial values) associated with the least squares problem satisfies .

In general the approximation power will be reduced as ‘Minimum Singular Value LPA’ is reduced. (A small indicates that the local data has hidden redundancies which prevent it from carrying enough information for a good approximation to be made.) Setting ‘Minimum Singular Value LPA’ very large may have the detrimental effect that only approximations of low degree are deemed reliable.

‘Minimum Singular Value LPA’ will have no effect if , and it will have little effect if the input data is ‘smooth’ (e.g., from a known function).

A calibration procedure (experimenting with a small subset of the data to be fitted and validating the results) may be needed to choose the most appropriate value for this parameter.

If , this option setting is ignored.

‘Polynomial Starting Degree’int

Default if , Default otherwise

The degree to be used for the polynomial part in the initial step of each local approximation.

At this initial step the method will attempt to fit with a local approximation having polynomial part of degree ‘Polynomial Starting Degree’. If and the approximation is deemed unreliable (according to ‘Minimum Singular Value LPA’), the degree will be decremented by one and a new local approximation computed, ending with a constant approximation if no other is reliable. If and the approximation is deemed unreliable (according to ‘Minimum Singular Value LHA’), a pure polynomial approximation of this degree will be tried instead. The method then proceeds as in the ‘POLYNOMIAL’ case.

‘Polynomial Starting Degree’ is bounded from above by the maximum possible spline degree, which is (when performing global super-smoothing). Note that the best-case approximation error (see Accuracy) for smoothing with is achieved for local polynomials of degree ; that is, for this level of global smoothing no further benefit is gained by setting .

The default value gives a good compromise between efficiency and accuracy. In general the best approximation can be obtained by setting:

If

if , ;

if ;

if , ;

otherwise .

If , ‘Polynomial Starting Degree’ as small as possible.

If , this option setting is ignored.

‘Radial Basis Function’str

Default

‘Radial Basis Function’ selects the RBF to use in each local RBF approximation, while ‘Scaling Coefficient RBF’ selects the scale factor to use in its evaluation, as described below.

A calibration procedure (experimenting with a small subset of the data to be fitted and validating the results) may be needed to choose the most appropriate scale factor and RBF.

If , these option settings are ignored.

If or , the following (conditionally) positive definite functions may be chosen.

Define and .

Gaussian

inverse multiquadric

inverse multiquadric

inverse multiquadric

inverse multiquadric

  1. Wendland’s function

  1. Wendland’s function

  1. Wendland’s function

  1. Buhmann’s function if , otherwise

multiquadric

multiquadric

polyharmonic spline

polyharmonic spline

If the following conditionally positive definite functions may also be chosen.

multiquadric

multiquadric

thin plate spline

polyharmonic spline

thin plate spline

polyharmonic spline

thin plate spline

polyharmonic spline

polyharmonic spline

‘Scaling Coefficient RBF’float

Default

‘Radial Basis Function’ selects the RBF to use in each local RBF approximation, while ‘Scaling Coefficient RBF’ selects the scale factor to use in its evaluation, as described below.

A calibration procedure (experimenting with a small subset of the data to be fitted and validating the results) may be needed to choose the most appropriate scale factor and RBF.

If , these option settings are ignored.

If or , the following (conditionally) positive definite functions may be chosen.

Define and .

Gaussian

inverse multiquadric

inverse multiquadric

inverse multiquadric

inverse multiquadric

  1. Wendland’s function

  1. Wendland’s function

  1. Wendland’s function

  1. Buhmann’s function if , otherwise

multiquadric

multiquadric

polyharmonic spline

polyharmonic spline

If the following conditionally positive definite functions may also be chosen.

multiquadric

multiquadric

thin plate spline

polyharmonic spline

thin plate spline

polyharmonic spline

thin plate spline

polyharmonic spline

polyharmonic spline

‘Separation LRBFA’float

Default

A knot-separation parameter used to control the condition number of the matrix used in each local RBF approximation (LRBFA). A smaller value may mean greater numerical stability but fewer knots.

If or , this option setting is ignored.

‘Supersmooth C2’str

Default

If , the spline is generated using additional smoothness constraints. This usually gives better results but at higher computational cost.

If this option setting is ignored.

Raises
NagValueError
(errno )

On entry, .

Constraint: .

(errno )

On entry, and .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

Option arrays are not initialized or are corrupted.

(errno )

An unexpected algorithmic failure was encountered. Please contact NAG.

(errno )

On entry, all elements of or of are equal.

(errno )

The selected radial basis function cannot be used with the RBF local method.

(errno )

The value of option ‘Polynomial Starting Degree’ was invalid.

Notes

dim2_spline_ts_sctr determines a smooth bivariate spline approximation to a set of data points , for . Here, ‘smooth’ means or . (You may select the degree of smoothing using the option ‘Global Smoothing Level’.)

The approximation domain is the bounding box , where (respectively ) and (respectively ) denote the lowest and highest data values of the (respectively ).

The spline is computed by local approximations on a uniform triangulation of the bounding box. These approximations are extended to a smooth spline representation of the surface over the domain. The local approximation scheme is controlled by the option ‘Local Method’. The schemes provided are: by least squares polynomial approximation (Davydov and Zeilfelder (2004)); by hybrid polynomial and radial basis function (RBF) approximation (Davydov et al. (2006)); or by pure RBF approximation (Davydov et al. (2005)).

The two-stage approximation method employed by dim2_spline_ts_sctr is derived from the TSFIT package of O. Davydov and F. Zeilfelder.

Values of the computed spline can subsequently be computed by calling dim2_spline_ts_evalv() or dim2_spline_ts_evalm().

References

Davydov, O, Morandi, R and Sestini, A, 2006, Local hybrid approximation for scattered data fitting with bivariate splines, Comput. Aided Geom. Design (23), 703–721

Davydov, O, Sestini, A and Morandi, R, 2005, Local RBF approximation for scattered data fitting with bivariate splines, Trends and Applications in Constructive Approximation, M. G. de Bruin, D. H. Mache, and J. Szabados, Eds (ISNM Vol. 151), Birkhauser, 91–102

Davydov, O and Zeilfelder, F, 2004, Scattered data fitting by direct extension of local polynomials to bivariate splines, Advances in Comp. Math. (21), 223–271