NAG Library Routine Document

d01rbf (withdraw_1d_gen_vec_multi_diagnostic)

Note: please be advised that d01rbf has been deprecated. You are advised to follow the directions in Section 9.1 in d01raf to replicate its functionality. Furthermore, any future diagnostic enhancements for d01raf will only be available in this manner.

1
Purpose

d01rbf is an expert diagnostic routine associated with d01raf to allow the arrays icom and com to be examined. These arrays contain details of the adaptive process. Facilities are provided, via the argument monit, to refine the final answer by adjusting the contribution made by specific segments.

2
Specification

Fortran Interface
Subroutine d01rbf ( monit, ni, dinest, errest, icom, licom, licusd, com, lcom, lcusd, iuser, ruser, ifail)
Integer, Intent (In):: ni, icom(licom), licom, lcom
Integer, Intent (Inout):: iuser(*), ifail
Integer, Intent (Out):: licusd, lcusd
Real (Kind=nag_wp), Intent (In):: com(lcom)
Real (Kind=nag_wp), Intent (Inout):: dinest(ni), errest(ni), ruser(*)
External:: monit
C Header Interface
#include <nagmk26.h>
void  d01rbf_ (
void (NAG_CALL *monit)(const Integer *ni, const Integer *ns, double dinest[], double errest[], const Integer fcount[], const Integer sinfoi[], const Integer evals[], const Integer *ldi, const double sinfor[], const double fs[], const double es[], const Integer *ldr, Integer iuser[], double ruser[]),
const Integer *ni, double dinest[], double errest[], const Integer icom[], const Integer *licom, Integer *licusd, const double com[], const Integer *lcom, Integer *lcusd, Integer iuser[], double ruser[], Integer *ifail)

3
Description

The principal role of d01rbf is to take information about the adaptive process that is stored in com and icom and present it in more intelligible arguments. A monitor routine, monit, allows you to report the progress of the adaptive process back to the calling program between those calls of d01raf which have returned irevcm=11 or 12.
A secondary role, useful only if you are an expert, is to utilize monit in such a way that it can override aspects of that information. Specifically, you may choose to remove the contributions of one or more individual segments from the estimates for individual integrals contained in dinest and errest, and replace such information with a more accurate approximation you have calculated by some other means. Clearly this facility should only be used with care. We recommend that it be used only after d01raf has returned with irevcm=0, i.e., it has completed the computation of the approximations of the integrals.

4
References

None.

5
Arguments

1:     monit – Subroutine, supplied by the NAG Library or the user.External Procedure
monit allows you to examine details of the adaptive process after a call of d01raf returning irevcm=11 or 12. Additionally, after a call of d01raf returning irevcm=0, monit may enhance the computed solution.
If no monitoring is required, monit may be the dummy monitoring routine d01rbm. (d01rbm is included in the NAG Library.)
The specification of monit is:
Fortran Interface
Subroutine monit ( ni, ns, dinest, errest, fcount, sinfoi, evals, ldi, sinfor, fs, es, ldr, iuser, ruser)
Integer, Intent (In):: ni, ns, fcount(ni), sinfoi(ldi,*), evals(ldi,*), ldi, ldr
Integer, Intent (Inout):: iuser(*)
Real (Kind=nag_wp), Intent (In):: sinfor(ldr,*), fs(ldr,*), es(ldr,*)
Real (Kind=nag_wp), Intent (Inout):: dinest(ni), errest(ni), ruser(*)
C Header Interface
#include <nagmk26.h>
void  monit (const Integer *ni, const Integer *ns, double dinest[], double errest[], const Integer fcount[], const Integer sinfoi[], const Integer evals[], const Integer *ldi, const double sinfor[], const double fs[], const double es[], const Integer *ldr, Integer iuser[], double ruser[])
1:     ni – IntegerInput
On entry: ni, the number of integrands specified in d01raf.
2:     ns – IntegerInput
On entry: ns, the number of segments formed during the adaptive procedure that can currently be examined. ns=2nsdiv+spri, where nsdiv is the number of segments that have been subdivided (the number of subdivisions).
3:     dinestni – Real (Kind=nag_wp) arrayInput/Output
On entry: dinestj contains the current estimate of the definite integral of integrand j, for j=1,2,,ni.
On exit: you may refine the estimates in dinest. This should only be done after d01raf has returned irevcm=0.
4:     errestni – Real (Kind=nag_wp) arrayInput/Output
On entry: errestj contains the current error estimate associated with integral j, for j=1,2,,ni.
On exit: you may refine the estimates in errest. This should only be done after d01raf has returned irevcm=0.
5:     fcountni – Integer arrayInput
On entry: fcountj contains the number of different approximations of integral j calculated so far, for j=1,2,,ni.
6:     sinfoildi* – Integer arrayInput
On entry: sinfoilk contains information about the hierarchy of splitting, for l=1,2,,5 and k=1,2,,ns.
sinfoi1k
Contains a unique identifier, the sid, related to segment k.
sinfoi2k
Contains the parent segment number of segment k, the reference to the segment that was split to create segment k.
sinfoi3k and sinfoi4k
Contain the segment numbers of the two child segments formed from segment k, if segment k has been split. If segment k has not been split, these will be negative.
sinfoi5k
Contains the level at which the segment exists, corresponding to na+1, where na is the number of ancestor segments of segment k.
If sinfoi5k<0, this segment is considered too small for further splitting, and its level is sinfoi5k.
7:     evalsldi* – Integer arrayInput
On entry: contains information to indicate whether an estimate of the integral j has been obtained over segment k, and if so whether this evaluation still contributes to the approximation in dinestj, for j=1,2,,ni and k=1,2,,ns.
evalsjk=0
Indicates that integral j has not been evaluated over segment k.
evalsjk=1
Indicates that integral j has been evaluated over segment k, and that this evaluation contributes to the total approximation dinestj.
evalsjk=2
Indicates that integral j has been evaluated over segment k, that this evaluation contributes to the total approximation dinestj, and that you have requested no further evaluation of this integral at this segment by setting needij<0.
evalsjk=3
Indicates that integral j has been evaluated over segment k, and this evaluation no longer contributes to dinestj.
evalsjk=4
Indicates that integral j has been evaluated over segment k, that this evaluation contributes to the total approximation dinestj, and that this segment is too small for any further splitting to be performed. Integral j also has a local error estimate over this segment above the requested tolerance. Such segments cause d01raf to return ifail=2 or 3, indicating extremely bad behaviour.
evalsjk=5
Indicates that integral j has been evaluated over segment k, that this evaluation contributes to the total approximation of dinestj, and that this segment is too small for any further splitting to be performed. The local error estimate is however below the requested tolerance.
8:     ldi – IntegerInput
On entry: the leading dimension of arrays sinfoi and evals.
9:     sinforldr* – Real (Kind=nag_wp) arrayInput
On entry: sinfor contains the bounds of each segment k, for k=1,2,,ns.
sinfor1k
Contains the lower bound of segment k.
sinfor2k
Contains the upper bound of segment k.
10:   fsldr* – Real (Kind=nag_wp) arrayInput
On entry: fsjk contains the definite integral estimate of the jth integral over the kth segment, for j=1,2,,ni and k=1,2,,ns.
11:   esldr* – Real (Kind=nag_wp) arrayInput
On entry: esjk contains the definite integral error estimate of the jth integral over the kth segment, for j=1,2,,ni and k=1,2,,ns.
12:   ldr – IntegerInput
On entry: the leading dimension of arrays sinfor, fs and es.
13:   iuser* – Integer arrayUser Workspace
14:   ruser* – Real (Kind=nag_wp) arrayUser Workspace
monit is called with the arguments iuser and ruser as supplied to d01rbf. You should use the arrays iuser and ruser to supply information to monit.
monit must either be a module subprogram USEd by, or declared as EXTERNAL in, the (sub)program from which d01rbf is called. Arguments denoted as Input must not be changed by this procedure.
Note: monit should not return floating-point NaN (Not a Number) or infinity values, since these are not handled by d01rbf. If your code inadvertently does return any NaNs or infinities, d01rbf is likely to produce unexpected results.
2:     ni – IntegerInput
On entry: ni, the number of integrals.
3:     dinestni – Real (Kind=nag_wp) arrayInput/Output
On entry: dinestj contains the current estimate of the definite integral of integrand j, for j=1,2,,ni.
On exit: dinest is not altered by d01rbf directly. It may be changed by monit.
4:     errestni – Real (Kind=nag_wp) arrayInput/Output
On entry: errestj contains the current error estimate associated with integral j, for j=1,2,,ni.
On exit: errest is not altered by d01rbf directly. It may be changed by monit.
5:     icomlicom – Integer arrayCommunication Array
On entry: the elements of this array must not be changed since the call of d01raf.
6:     licom – IntegerInput
On entry: the dimension of the array icom as declared in the (sub)program from which d01rbf is called. Normally this will be the same value licom passed to d01raf.
Constraint: licom50.
Note: if licom<licusd, (i.e., licom is less than the value passed to d01raf) not all segments may be investigated using monit (see argument ns) and d01rbf will return ifail=1.
7:     licusd – IntegerOutput
On exit: the number of elements of the array icom, passed to d01raf, actually used.
8:     comlcom – Real (Kind=nag_wp) arrayCommunication Array
On entry: the elements of this array must not be changed since the call of d01raf.
9:     lcom – IntegerInput
On entry: the dimension of the array com as declared in the (sub)program from which d01rbf is called. Normally this will be the same value lcom passed to d01raf.
Constraint: lcom50.
Note: if lcom<lcusd, (i.e., lcom is less than the value passed to d01raf) not all segments may be investigated using monit (see argument ns) and d01rbf will return ifail=1.
10:   lcusd – IntegerOutput
On exit: the number of elements of com used by d01raf.
11:   iuser* – Integer arrayUser Workspace
12:   ruser* – Real (Kind=nag_wp) arrayUser Workspace
iuser and ruser are not used by d01rbf, but are passed directly to monit and may be used to pass information to this routine.
13:   ifail – IntegerInput/Output
On entry: ifail must be set to 0, -1 or 1. If you are unfamiliar with this argument you should refer to Section 3.4 in How to Use the NAG Library and its Documentation for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value -1 or 1 is recommended. If the output of error messages is undesirable, then the value 1 is recommended. Otherwise, because for this routine the values of the output arguments may be useful even if ifail0 on exit, the recommended value is -1. When the value -1 or 1 is used it is essential to test the value of ifail on exit.
On exit: ifail=0 unless the routine detects an error or a warning has been flagged (see Section 6).

6
Error Indicators and Warnings

If on entry ifail=0 or -1, explanatory error messages are output on the current error message unit (as defined by x04aaf).
Note: d01rbf may return useful information for one or more of the following detected errors or warnings.
Errors or warnings detected by the routine:
ifail=1
On entry, licom=value, lcom=value.
licom or lcom is insufficient for a complete examination of the communication arrays. A maximum value segments out of value are examinable.
Constraint: licomvalue and lcomvalue.
ifail=21
On entry, ni is not consistent with that used to construct the communication arrays.
On entry, ni=value.
Constraint: ni=value.
ifail=61
On entry, licom<50.
ifail=91
On entry, lcom<50.
ifail=1101
Either the communication arrays have not been created by d01raf, or they have become corrupted.
ifail=-99
An unexpected error has been triggered by this routine. Please contact NAG.
See Section 3.9 in How to Use the NAG Library and its Documentation for further information.
ifail=-399
Your licence key may have expired or may not have been installed correctly.
See Section 3.8 in How to Use the NAG Library and its Documentation for further information.
ifail=-999
Dynamic memory allocation failed.
See Section 3.7 in How to Use the NAG Library and its Documentation for further information.

7
Accuracy

Not applicable.

8
Parallelism and Performance

d01rbf is not threaded in any implementation.

9
Further Comments

When called after d01raf has returned irevcm=0, d01rbf may be used to modify dinest and errest. For example if evalsjk- =4  for some j1,,ni, k-1,,ns, indicating integral j was badly behaved over segment k-, then one may potentially modify dinestj as follows:
errest may be similarly updated if required.
Note: if integral j has been approximated successfully due to extrapolation, indicated by needij=1 after d01raf has completed, dinestj will not be the direct sum of the contributing segments. You may however reconstruct the unextrapolated integral estimate as,
dinestj = K fsjk + K- fsjk- ,  
where K=kevalsldi×k+j=1,2,5 and K-=k-evalsldi×k-+j=4, the sets of all contributing segements where integral j has been evaluated accurately and inaccurately respectively. Some or all of the terms in the summation over K- may be replaced with more accurate approximations Fk-new if available.

10
Example

See Section 10 in d01raf.