# NAG FL Interfaced01rbf (withdraw_​1d_​gen_​vec_​multi_​diagnostic)

Note: this routine is deprecated and will be withdrawn at Mark 28. There is no replacement for this routine.
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.

## ▸▿ Contents

Settings help

FL Name Style:

FL Specification Language:

## 1Purpose

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.

## 2Specification

Fortran Interface
 Subroutine d01rbf ( ni, icom, com, lcom,
 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
#include <nag.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)
The routine may be called by the names d01rbf or nagf_quad_withdraw_1d_gen_vec_multi_diagnostic.

## 3Description

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 ${\mathbf{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 ${\mathbf{irevcm}}=0$, i.e., it has completed the computation of the approximations of the integrals.

None.

## 5Arguments

1: $\mathbf{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 ${\mathbf{irevcm}}=11$ or $12$. Additionally, after a call of d01raf returning ${\mathbf{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, ldi, fs, es, ldr,
 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(*)
 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: $\mathbf{ni}$Integer Input
On entry: ${n}_{i}$, the number of integrands specified in d01raf.
2: $\mathbf{ns}$Integer Input
On entry: ${n}_{s}$, the number of segments formed during the adaptive procedure that can currently be examined. ${n}_{s}=2{n}_{\mathit{sdiv}}+{s}_{\mathit{pri}}$, where ${n}_{\mathit{sdiv}}$ is the number of segments that have been subdivided (the number of subdivisions).
3: $\mathbf{dinest}\left({\mathbf{ni}}\right)$Real (Kind=nag_wp) array Input/Output
On entry: ${\mathbf{dinest}}\left(\mathit{j}\right)$ contains the current estimate of the definite integral of integrand $\mathit{j}$, for $\mathit{j}=1,2,\dots ,{n}_{i}$.
On exit: you may refine the estimates in dinest. This should only be done after d01raf has returned ${\mathbf{irevcm}}=0$.
4: $\mathbf{errest}\left({\mathbf{ni}}\right)$Real (Kind=nag_wp) array Input/Output
On entry: ${\mathbf{errest}}\left(\mathit{j}\right)$ contains the current error estimate associated with integral $\mathit{j}$, for $\mathit{j}=1,2,\dots ,{n}_{i}$.
On exit: you may refine the estimates in errest. This should only be done after d01raf has returned ${\mathbf{irevcm}}=0$.
5: $\mathbf{fcount}\left({\mathbf{ni}}\right)$Integer array Input
On entry: ${\mathbf{fcount}}\left(\mathit{j}\right)$ contains the number of different approximations of integral $\mathit{j}$ calculated so far, for $\mathit{j}=1,2,\dots ,{n}_{i}$.
6: $\mathbf{sinfoi}\left({\mathbf{ldi}},*\right)$Integer array Input
On entry: ${\mathbf{sinfoi}}\left(\mathit{l},\mathit{k}\right)$ contains information about the hierarchy of splitting, for $\mathit{l}=1,2,\dots ,5$ and $\mathit{k}=1,2,\dots ,{n}_{s}$.
${\mathbf{sinfoi}}\left(1,k\right)$
Contains a unique identifier, the sid, related to segment $k$.
${\mathbf{sinfoi}}\left(2,k\right)$
Contains the parent segment number of segment $k$, the reference to the segment that was split to create segment $k$.
${\mathbf{sinfoi}}\left(3,k\right)$ and ${\mathbf{sinfoi}}\left(4,k\right)$
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.
${\mathbf{sinfoi}}\left(5,k\right)$
Contains the level at which the segment exists, corresponding to ${n}_{a}+1$, where ${n}_{a}$ is the number of ancestor segments of segment $k$.
If ${\mathbf{sinfoi}}\left(5,k\right)<0$, this segment is considered too small for further splitting, and its level is $|{\mathbf{sinfoi}}\left(5,k\right)|$.
7: $\mathbf{evals}\left({\mathbf{ldi}},*\right)$Integer array Input
On entry: contains information to indicate whether an estimate of the integral $\mathit{j}$ has been obtained over segment $\mathit{k}$, and if so whether this evaluation still contributes to the approximation in ${\mathbf{dinest}}\left(\mathit{j}\right)$, for $\mathit{j}=1,2,\dots ,{n}_{i}$ and $\mathit{k}=1,2,\dots ,{n}_{s}$.
${\mathbf{evals}}\left(j,k\right)=0$
Indicates that integral $j$ has not been evaluated over segment $k$.
${\mathbf{evals}}\left(j,k\right)=1$
Indicates that integral $j$ has been evaluated over segment $k$, and that this evaluation contributes to the total approximation ${\mathbf{dinest}}\left(j\right)$.
${\mathbf{evals}}\left(j,k\right)=2$
Indicates that integral $j$ has been evaluated over segment $k$, that this evaluation contributes to the total approximation ${\mathbf{dinest}}\left(j\right)$, and that you have requested no further evaluation of this integral at this segment by setting ${\mathbf{needi}}\left(j\right)<0$ in d01raf.
${\mathbf{evals}}\left(j,k\right)=3$
Indicates that integral $j$ has been evaluated over segment $k$, and this evaluation no longer contributes to ${\mathbf{dinest}}\left(j\right)$.
${\mathbf{evals}}\left(j,k\right)=4$
Indicates that integral $j$ has been evaluated over segment $k$, that this evaluation contributes to the total approximation ${\mathbf{dinest}}\left(j\right)$, 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 ${\mathbf{ifail}}={\mathbf{2}}$ or ${\mathbf{3}}$, indicating extremely bad behaviour.
${\mathbf{evals}}\left(j,k\right)=5$
Indicates that integral $j$ has been evaluated over segment $k$, that this evaluation contributes to the total approximation of ${\mathbf{dinest}}\left(j\right)$, 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: $\mathbf{ldi}$Integer Input
On entry: the leading dimension of arrays sinfoi and evals.
9: $\mathbf{sinfor}\left({\mathbf{ldr}},*\right)$Real (Kind=nag_wp) array Input
On entry: sinfor contains the bounds of each segment $\mathit{k}$, for $\mathit{k}=1,2,\dots ,{n}_{s}$.
${\mathbf{sinfor}}\left(1,k\right)$
Contains the lower bound of segment $k$.
${\mathbf{sinfor}}\left(2,k\right)$
Contains the upper bound of segment $k$.
10: $\mathbf{fs}\left({\mathbf{ldr}},*\right)$Real (Kind=nag_wp) array Input
On entry: ${\mathbf{fs}}\left(\mathit{j},\mathit{k}\right)$ contains the definite integral estimate of the $\mathit{j}$th integral over the $\mathit{k}$th segment, for $\mathit{j}=1,2,\dots ,{n}_{i}$ and $\mathit{k}=1,2,\dots ,{n}_{s}$.
11: $\mathbf{es}\left({\mathbf{ldr}},*\right)$Real (Kind=nag_wp) array Input
On entry: ${\mathbf{es}}\left(\mathit{j},\mathit{k}\right)$ contains the definite integral error estimate of the $\mathit{j}$th integral over the $\mathit{k}$th segment, for $\mathit{j}=1,2,\dots ,{n}_{i}$ and $\mathit{k}=1,2,\dots ,{n}_{s}$.
12: $\mathbf{ldr}$Integer Input
On entry: the leading dimension of arrays sinfor, fs and es.
13: $\mathbf{iuser}\left(*\right)$Integer array User Workspace
14: $\mathbf{ruser}\left(*\right)$Real (Kind=nag_wp) array User 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: $\mathbf{ni}$Integer Input
On entry: ${n}_{i}$, the number of integrals.
3: $\mathbf{dinest}\left({\mathbf{ni}}\right)$Real (Kind=nag_wp) array Input/Output
On entry: ${\mathbf{dinest}}\left(\mathit{j}\right)$ contains the current estimate of the definite integral of integrand $\mathit{j}$, for $\mathit{j}=1,2,\dots ,{n}_{i}$.
On exit: dinest is not altered by d01rbf directly. It may be changed by monit.
4: $\mathbf{errest}\left({\mathbf{ni}}\right)$Real (Kind=nag_wp) array Input/Output
On entry: ${\mathbf{errest}}\left(\mathit{j}\right)$ contains the current error estimate associated with integral $\mathit{j}$, for $\mathit{j}=1,2,\dots ,{n}_{i}$.
On exit: errest is not altered by d01rbf directly. It may be changed by monit.
5: $\mathbf{icom}\left({\mathbf{licom}}\right)$Integer array Communication Array
On entry: the elements of this array must not be changed since the call of d01raf.
6: $\mathbf{licom}$Integer Input
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: ${\mathbf{licom}}\ge 50$.
Note: if ${\mathbf{licom}}<{\mathbf{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 ${\mathbf{ifail}}={\mathbf{1}}$.
7: $\mathbf{licusd}$Integer Output
On exit: the number of elements of the array icom, passed to d01raf, actually used.
8: $\mathbf{com}\left({\mathbf{lcom}}\right)$Real (Kind=nag_wp) array Communication Array
On entry: the elements of this array must not be changed since the call of d01raf.
9: $\mathbf{lcom}$Integer Input
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: ${\mathbf{lcom}}\ge 50$.
Note: if ${\mathbf{lcom}}<{\mathbf{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 ${\mathbf{ifail}}={\mathbf{1}}$.
10: $\mathbf{lcusd}$Integer Output
On exit: the number of elements of com used by d01raf.
11: $\mathbf{iuser}\left(*\right)$Integer array User Workspace
12: $\mathbf{ruser}\left(*\right)$Real (Kind=nag_wp) array User 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: $\mathbf{ifail}$Integer Input/Output
On entry: ifail must be set to $0$, $-1$ or $1$ to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of $0$ causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of $-1$ means that an error message is printed while a value of $1$ means that it is not.
If halting is not appropriate, the value $-1$ or $1$ is recommended. If message printing is undesirable, then the value $1$ is recommended. Otherwise, the value $-1$ is recommended since useful values can be provided in some output arguments even when ${\mathbf{ifail}}\ne {\mathbf{0}}$ on exit. When the value $-\mathbf{1}$ or $\mathbf{1}$ is used it is essential to test the value of ifail on exit.
On exit: ${\mathbf{ifail}}={\mathbf{0}}$ unless the routine detects an error or a warning has been flagged (see Section 6).

## 6Error Indicators and Warnings

If on entry ${\mathbf{ifail}}=0$ or $-1$, explanatory error messages are output on the current error message unit (as defined by x04aaf).
Errors or warnings detected by the routine:
Note: in some cases d01rbf may return useful information.
${\mathbf{ifail}}=1$
On entry, ${\mathbf{licom}}=⟨\mathit{\text{value}}⟩$, ${\mathbf{lcom}}=⟨\mathit{\text{value}}⟩$.
licom or lcom is insufficient for a complete examination of the communication arrays. A maximum $⟨\mathit{\text{value}}⟩$ segments out of $⟨\mathit{\text{value}}⟩$ are examinable.
Constraint: ${\mathbf{licom}}\ge ⟨\mathit{\text{value}}⟩$ and ${\mathbf{lcom}}\ge ⟨\mathit{\text{value}}⟩$.
${\mathbf{ifail}}=21$
On entry, ni is not consistent with that used to construct the communication arrays.
On entry, ${\mathbf{ni}}=⟨\mathit{\text{value}}⟩$.
Constraint: ${\mathbf{ni}}=⟨\mathit{\text{value}}⟩$.
${\mathbf{ifail}}=61$
On entry, ${\mathbf{licom}}<50$.
${\mathbf{ifail}}=91$
On entry, ${\mathbf{lcom}}<50$.
${\mathbf{ifail}}=1101$
Either the communication arrays have not been created by d01raf, or they have become corrupted.
${\mathbf{ifail}}=-99$
See Section 7 in the Introduction to the NAG Library FL Interface for further information.
${\mathbf{ifail}}=-399$
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library FL Interface for further information.
${\mathbf{ifail}}=-999$
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.

Not applicable.

## 8Parallelism and Performance

d01rbf is not threaded in any implementation.

When called after d01raf has returned ${\mathbf{irevcm}}=0$, d01rbf may be used to modify dinest and errest. For example if ${\mathbf{evals}}\left(\mathit{j},\overline{\mathit{k}}\right)=4$ for some $j\in 1,\dots ,{n}_{i}$, $\overline{k}\in 1,\dots ,{n}_{s}$, indicating integral $j$ was badly behaved over segment $\overline{k}$, then one may potentially modify ${\mathbf{dinest}}\left(j\right)$ as follows:
• ${a}_{\overline{k}}={\mathbf{sinfor}}\left(\mathit{l},\mathit{k}\right)$
• ${b}_{\overline{k}}={\mathbf{sinfor}}\left(\mathit{l},\mathit{k}\right)$
• ${F}_{\overline{k}}^{\mathrm{new}}={\int }_{{a}_{\overline{k}}}^{{b}_{\overline{k}}}{f}_{j}\left(x\right)dx$: performed using accurate technique for specific function.
• ${\mathbf{dinest}}\left(j\right)={\mathbf{dinest}}\left(j\right)-{\mathbf{fs}}\left(\mathit{j},\overline{\mathit{k}}\right)+{F}_{\overline{k}}^{\mathrm{new}}$
errest may be similarly updated if required.
Note: if integral $j$ has been approximated successfully due to extrapolation, indicated by ${\mathbf{needi}}\left(j\right)=1$ after d01raf has completed, ${\mathbf{dinest}}\left(j\right)$ will not be the direct sum of the contributing segments. You may however reconstruct the unextrapolated integral estimate as,
 $dinest(j) = ∑ K fs(j,k) + ∑ K¯ fs(j,k¯) ,$
where $K=\left\{k\mid {\mathbf{evals}}\left({\mathbf{ldi}}×\left(\mathit{k}\right)+\mathit{j}\right)=1,2,5\right\}$ and $\overline{K}=\left\{\overline{\mathit{k}}\mid {\mathbf{evals}}\left({\mathbf{ldi}}×\left(\overline{\mathit{k}}\right)+\mathit{j}\right)=4\right\}$, 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 $\overline{K}$ may be replaced with more accurate approximations ${F}_{\overline{k}}^{\mathrm{new}}$ if available.

See d01raf.