hide long namesshow long names
hide short namesshow short names
Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

NAG Toolbox: nag_interp_3d_scat_shep_eval (e01th)

 Contents

    1  Purpose
    2  Syntax
    7  Accuracy
    9  Example

Purpose

nag_interp_3d_scat_shep_eval (e01th) evaluates the three-dimensional interpolating function generated by nag_interp_3d_scat_shep (e01tg) and its first partial derivatives.

Syntax

[q, qx, qy, qz, ifail] = e01th(x, y, z, f, iq, rq, u, v, w, 'm', m, 'n', n)
[q, qx, qy, qz, ifail] = nag_interp_3d_scat_shep_eval(x, y, z, f, iq, rq, u, v, w, 'm', m, 'n', n)

Description

nag_interp_3d_scat_shep_eval (e01th) takes as input the interpolant Qx,y,z of a set of scattered data points xr,yr,zr,fr, for r=1,2,,m, as computed by nag_interp_3d_scat_shep (e01tg), and evaluates the interpolant and its first partial derivatives at the set of points ui,vi,wi, for i=1,2,,n.
nag_interp_3d_scat_shep_eval (e01th) must only be called after a call to nag_interp_3d_scat_shep (e01tg).
This function is derived from the function QS3GRD described by Renka (1988).

References

Renka R J (1988) Algorithm 661: QSHEP3D: Quadratic Shepard method for trivariate interpolation of scattered data ACM Trans. Math. Software 14 151–152

Parameters

Compulsory Input Parameters

1:     xm – double array
2:     ym – double array
3:     zm – double array
4:     fm – double array
m, x, y, z and f must be the same values as were supplied in the preceding call to nag_interp_3d_scat_shep (e01tg).
5:     iqliq int64int32nag_int array
liq, the dimension of the array, must satisfy the constraint liq2×m+1.
Must be unchanged from the value returned from a previous call to nag_interp_3d_scat_shep (e01tg).
6:     rqlrq – double array
lrq, the dimension of the array, must satisfy the constraint lrq10×m+7.
Must be unchanged from the value returned from a previous call to nag_interp_3d_scat_shep (e01tg).
7:     un – double array
8:     vn – double array
9:     wn – double array
ui, vi, wi must be set to the evaluation point ui,vi,wi, for i=1,2,,n.

Optional Input Parameters

1:     m int64int32nag_int scalar
Default: the dimension of the arrays x, y, z, f. (An error is raised if these dimensions are not equal.)
m, x, y, z and f must be the same values as were supplied in the preceding call to nag_interp_3d_scat_shep (e01tg).
2:     n int64int32nag_int scalar
Default: the dimension of the arrays u, v, w. (An error is raised if these dimensions are not equal.)
n, the number of evaluation points.
Constraint: n1.

Output Parameters

1:     qn – double array
qi contains the value of the interpolant, at ui,vi,wi, for i=1,2,,n. If any of these evaluation points lie outside the region of definition of the interpolant the corresponding entries in q are set to the largest machine representable number (see nag_machine_real_largest (x02al)), and nag_interp_3d_scat_shep_eval (e01th) returns with ifail=3.
2:     qxn – double array
3:     qyn – double array
4:     qzn – double array
qxi, qyi, qzi contains the value of the partial derivatives of the interpolant Qx,y,z at ui,vi,wi, for i=1,2,,n. If any of these evaluation points lie outside the region of definition of the interpolant, the corresponding entries in qx, qy and qz are set to the largest machine representable number (see nag_machine_real_largest (x02al)), and nag_interp_3d_scat_shep_eval (e01th) returns with ifail=3.
5:     ifail int64int32nag_int scalar
ifail=0 unless the function detects an error (see Error Indicators and Warnings).

Error Indicators and Warnings

Errors or warnings detected by the function:

Cases prefixed with W are classified as warnings and do not generate an error of type NAG:error_n. See nag_issue_warnings.

   ifail=1
On entry,m<10,
orliq<2×m+1,
orlrq<10×m+7,
orn<1.
   ifail=2
Values supplied in iq or rq appear to be invalid. Check that these arrays have not been corrupted between the calls to nag_interp_3d_scat_shep (e01tg) and nag_interp_3d_scat_shep_eval (e01th).
W  ifail=3
At least one evaluation point lies outside the region of definition of the interpolant. At all such points the corresponding values in q, qx, qy and qz have been set to the largest machine representable number (see nag_machine_real_largest (x02al)).
   ifail=-99
An unexpected error has been triggered by this routine. Please contact NAG.
   ifail=-399
Your licence key may have expired or may not have been installed correctly.
   ifail=-999
Dynamic memory allocation failed.

Accuracy

Computational errors should be negligible in most practical situations.

Further Comments

The time taken for a call to nag_interp_3d_scat_shep_eval (e01th) will depend in general on the distribution of the data points. If x, y and z are approximately uniformly distributed, then the time taken should be only On. At worst Omn time will be required.

Example

See Example in nag_interp_3d_scat_shep (e01tg).
function e01th_example


fprintf('e01th example results\n\n');

data = [ 0.80  0.23  0.37  0.51;
         0.23  0.88  0.05  1.80;
         0.18  0.43  0.04  0.11;
         0.58  0.95  0.62  2.65;
         0.64  0.69  0.20  0.93;
         0.88  0.35  0.49  0.72;
         0.30  0.10  0.78 -0.11;
         0.87  0.09  0.05  0.67;
         0.04  0.02  0.40  0.00;
         0.62  0.90  0.43  2.20;
         0.87  0.96  0.24  3.17;
         0.62  0.64  0.45  0.74;
         0.86  0.13  0.47  0.64;
         0.87  0.60  0.46  1.07;
         0.49  0.43  0.13  0.22;
         0.12  0.61  0.00  0.41;
         0.02  0.71  0.82  0.58;
         0.62  0.93  0.44  2.48;
         0.49  0.54  0.04  0.37;
         0.36  0.56  0.39  0.35;
         0.62  0.42  0.97 -0.20;
         0.01  0.72  0.45  0.78;
         0.41  0.36  0.52  0.11;
         0.17  0.99  0.65  2.82;
         0.51  0.29  0.59  0.14;
         0.85  0.05  0.04  0.61;
         0.20  0.20  0.87 -0.25;
         0.04  0.67  0.04  0.59;
         0.31  0.63  0.18  0.50;
         0.88  0.27  0.07  0.71];

x = data(:,1); y = data(:,2); z = data(:,3); f = data(:,4);
nw = int64(0);
nq = nw;
[iq, rq, ifail] = e01tg( ...
                         x, y, z, f, nw, nq);

% Evaluate at equispaced points on diagonal line
px = [0.1:0.1:0.6]'; py = px; pz = px;

[q, qx, qy, qz, ifail] = e01th( ...
                                x, y, z, f, iq, rq, px, py, pz);

fprintf('  Evaluation point       Q(x,y,z)\n');
fprintf(' (%4.1f, %4.1f, %4.1f)    %8.4f\n',[px py pz q]');


e01th example results

  Evaluation point       Q(x,y,z)
 ( 0.1,  0.1,  0.1)      0.2630
 ( 0.2,  0.2,  0.2)      0.1182
 ( 0.3,  0.3,  0.3)      0.0811
 ( 0.4,  0.4,  0.4)      0.1552
 ( 0.5,  0.5,  0.5)      0.3019
 ( 0.6,  0.6,  0.6)      0.5712

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015