D01RBF (PDF version)
D01 Chapter Contents
D01 Chapter Introduction
NAG Library Manual

NAG Library Routine Document

D01RBF

Note:  before using this routine, please read the Users' Note for your implementation to check the interpretation of bold italicised terms and other implementation-dependent details.

+ Contents

    1  Purpose
    7  Accuracy
    9  Example

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 parameter MONIT, to refine the final answer by adjusting the contribution made by specific segments.

2  Specification

SUBROUTINE D01RBF ( MONIT, NI, DINEST, ERREST, ICOM, LICOM, LICUSD, COM, LCOM, LCUSD, IUSER, RUSER, IFAIL)
INTEGER  NI, ICOM(LICOM), LICOM, LICUSD, LCOM, LCUSD, IUSER(*), IFAIL
REAL (KIND=nag_wp)  DINEST(NI), ERREST(NI), COM(LCOM), RUSER(*)
EXTERNAL  MONIT

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 parameters. 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  Parameters

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 overwrite that information.
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:
SUBROUTINE MONIT ( NI, NS, DINEST, ERREST, FCOUNT, SINFOI, EVALS, LDI, SINFOR, FS, ES, LDR, IUSER, RUSER)
INTEGER  NI, NS, FCOUNT(NI), SINFOI(LDI,*), EVALS(LDI,*), LDI, LDR, IUSER(*)
REAL (KIND=nag_wp)  DINEST(NI), ERREST(NI), SINFOR(LDR,*), FS(LDR,*), ES(LDR,*), 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:     DINEST(NI) – 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:     ERREST(NI) – 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:     FCOUNT(NI) – INTEGER arrayInput
On entry: FCOUNTj contains the number of different approximations of integral j calculated so far, for j=1,2,,ni.
6:     SINFOI(LDI,*) – INTEGER arrayInput
On entry: contains information about the hierarchy of splitting.
For k=1,,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:     EVALS(LDI,*) – 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:     SINFOR(LDR,*) – 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:   FS(LDR,*) – REAL (KIND=nag_wp) arrayInput
On entry: the jth element of the kth column of FS contains the definite integral estimate of the jth integral over the kth segment, for j=1,2,,ni and k=1,2,,ns.
11:   ES(LDR,*) – REAL (KIND=nag_wp) arrayInput
On entry: the jth elements of the kth column of ES 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 order of arrays SINFOR, FS and ES.
13:   IUSER(*) – INTEGER arrayUser Workspace
14:   RUSER(*) – REAL (KIND=nag_wp) arrayUser Workspace
MONIT is called with the parameters IUSER and RUSER as supplied to D01RBF. You are free to use the arrays IUSER and RUSER to supply information to MONIT as an alternative to using COMMON global variables.
MONIT must either be a module subprogram USEd by, or declared as EXTERNAL in, the (sub)program from which D01RBF is called. Parameters denoted as Input must not be changed by this procedure.
2:     NI – INTEGERInput
On entry: ni, the number of integrals.
3:     DINEST(NI) – 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:     ERREST(NI) – 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:     ICOM(LICOM) – INTEGER arrayCommunication Array
On entry: the elements of this array must not be changed.
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 parameter 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:     COM(LCOM) – REAL (KIND=nag_wp) arrayCommunication Array
On entry: the elements of this array must not be changed.
9:     LCOM – INTEGERInput
On entry: the dimension of the array COM as declared in the (sub)program from which D01RBF is called. The dimension of the array COM. 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 parameter 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 as an alternative to using COMMON global variables.
13:   IFAIL – INTEGERInput/Output
On entry: IFAIL must be set to 0, -1​ or ​1. If you are unfamiliar with this parameter you should refer to Section 3.3 in the Essential Introduction 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 parameters 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 or LCOM is insufficient for a complete examination of the communication arrays.
A maximum value segments out of value are examinable.
On entry, LICOM=value.
Constraint: LICOMvalue.
On entry, LCOM=value.
Constraint: 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.

7  Accuracy

Not applicable.

8  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 EVALSjk = 1,2,5 FSjk + k- EVALSjk-=4 FSjk- ,
where the second summation may be replaced by more accurate approximations Fk-new.

9  Example

See Section 9 in D01RAF.

D01RBF (PDF version)
D01 Chapter Contents
D01 Chapter Introduction
NAG Library Manual

© The Numerical Algorithms Group Ltd, Oxford, UK. 2012