# NAG Library Routine Document

## 1Purpose

g01zuf is used to initialize routines g01euf and g01muf.
It is intended to be used before a call to g01euf or g01muf.

## 2Specification

Fortran Interface
 Subroutine g01zuf ( mode, xl, xu,
 Integer, Intent (In) :: mode Integer, Intent (Inout) :: ifail Real (Kind=nag_wp), Intent (In) :: rkappa, beta2 Real (Kind=nag_wp), Intent (Out) :: xl, xu, rcomm(322)
#include nagmk26.h
 void g01zuf_ (const double *rkappa, const double *beta2, const Integer *mode, double *xl, double *xu, double rcomm[], Integer *ifail)

## 3Description

g01zuf initializes the array rcomm for use by g01euf or g01muf in the evaluation of the Vavilov functions ${\varphi }_{V}\left(\lambda \text{;}\kappa ,{\beta }^{2}\right)$ and ${\Phi }_{V}\left(\lambda \text{;}\kappa ,{\beta }^{2}\right)$ respectively.
Multiple calls to g01euf or g01muf can be made following a single call to g01zuf, provided that rkappa or beta2 do not change, and that either all calls are to g01euf or all calls are to g01muf. If you wish to call both g01euf and g01muf, then you will need to initialize both separately.

## 4References

Schorr B (1974) Programs for the Landau and the Vavilov distributions and the corresponding random numbers Comp. Phys. Comm. 7 215–224

## 5Arguments

1:     $\mathbf{rkappa}$ – Real (Kind=nag_wp)Input
On entry: the argument $\kappa$ of the function.
Constraint: $0.01\le {\mathbf{rkappa}}\le 10.0$.
2:     $\mathbf{beta2}$ – Real (Kind=nag_wp)Input
On entry: the argument ${\beta }^{2}$ of the function.
Constraint: $0.0\le {\mathbf{beta2}}\le 1.0$.
3:     $\mathbf{mode}$ – IntegerInput
On entry: if ${\mathbf{mode}}=0$, g01muf is to be called after the call to g01zuf. Otherwise, g01euf is to be called.
4:     $\mathbf{xl}$ – Real (Kind=nag_wp)Output
On exit: ${x}_{l}$, a threshold value below which ${\varphi }_{V}\left(\lambda \text{;}\kappa ,{\beta }^{2}\right)$ will be set to zero by g01muf and ${\Phi }_{V}\left(\lambda \text{;}\kappa ,{\beta }^{2}\right)$ will be set to zero by g01euf if $\lambda <{x}_{l}$.
5:     $\mathbf{xu}$ – Real (Kind=nag_wp)Output
On exit: ${x}_{u}$, a threshold value above which ${\varphi }_{V}\left(\lambda \text{;}\kappa ,{\beta }^{2}\right)$ will be set to zero by g01muf and ${\Phi }_{V}\left(\lambda \text{;}\kappa ,{\beta }^{2}\right)$ will be set to unity by g01euf if $\lambda >{x}_{u}$.
6:     $\mathbf{rcomm}\left(322\right)$ – Real (Kind=nag_wp) arrayCommunication Array
On exit: this argument should be passed unchanged to g01euf or g01muf.
7:     $\mathbf{ifail}$ – IntegerInput/Output
On entry: ifail must be set to $0$, $-1\text{​ 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\text{​ or ​}1$ is recommended. If the output of error messages is undesirable, then the value $1$ is recommended. Otherwise, if you are not familiar with this argument, the recommended value is $0$. When the value $-\mathbf{1}\text{​ 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:
${\mathbf{ifail}}=1$
On entry, ${\mathbf{beta2}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{beta2}}\ge 0.0$.
On entry, ${\mathbf{beta2}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{beta2}}\le 1.0$.
On entry, ${\mathbf{rkappa}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{rkappa}}\ge 0.01$.
On entry, ${\mathbf{rkappa}}=〈\mathit{\text{value}}〉$.
Constraint: ${\mathbf{rkappa}}\le 10.0$.
${\mathbf{ifail}}=2$
The initialization has been abandoned due to an internal error. This error exit is unlikely to occur, but if it does change the values of rkappa and/or beta2 and rerun g01zuf.
${\mathbf{ifail}}=-99$
See Section 3.9 in How to Use the NAG Library and its Documentation for further information.
${\mathbf{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.
${\mathbf{ifail}}=-999$
Dynamic memory allocation failed.
See Section 3.7 in How to Use the NAG Library and its Documentation for further information.

## 7Accuracy

At least five significant digits are usually correct.

## 8Parallelism and Performance

g01zuf is not threaded in any implementation.