# NAG CL InterfaceReplacement Calls Advice

The following list gives the names of functions that are suitable replacements for functions that have either been withdrawn or deprecated since Mark 23.
The list indicates the minimum change necessary, but many of the replacement functions have additional flexibility and you may wish to take advantage of new features. It is strongly recommended that you consult the function documents.
Settings help

CL Name Style:

## C02 – Zeros of Polynomials

### c02afc

Deprecated at Mark 27.1.
Replaced by c02aac.

#### Old Code

```Complex a[n+1], z[n];
Nag_Boolean scale;
...
scale = Nag_True;
nag_zeros_poly_complex(n, a, scale, z, &fail);```

#### New Code

```Complex a[n+1], z[n];
Integer itmax;
Nag_Root_Polish polish;
double berr[n], cond[n];
Integer conv[n];
...
itmax = 30;
polish = Nag_Root_Polish_Simple;
nag_zeros_poly_complex_fpml(a, n, itmax, polish, z, berr, cond, conv, &fail);```
Note: that the roots may be returned in a different order in array z.

### c02agc

Deprecated at Mark 27.1.
Replaced by c02abc.

#### Old Code

```double a[n+1];
Complex z[n];
Nag_Boolean scale;
...
scale = Nag_True;
nag_zeros_poly_real(n, a, scale, z, &fail);```

#### New Code

```double a[n+1];
complex z[n];
integer itmax;
nag_root_polish polish;
double berr[n], cond[n];
Integer conv[n];
...
itmax = 30;
polish = Nag_Root_Polish_Simple;
nag_zeros_poly_real_fpml(a, n, itmax, polish, z, berr, cond, conv, &fail);```
Note: that the roots may be returned in a different order in array z.

## C05 – Roots of One or More Transcendental Equations

Withdrawn at Mark 24.
Replaced by c05ayc.

#### Old Code

```double f(double xx)
{
...
}
...
nag_zero_cont_func_bd(a, b, &x, f, xtol, ftol, &fail);```

#### New Code

```double f(double xx, Nag_Comm *comm)
{
...
}
...
Nag_Comm comm;
...
nag_zero_cont_func_brent(a, b, xtol, ftol, f, &x, &comm, &fail);```

### c05agc

Withdrawn at Mark 25.
Replaced by c05auc.

#### Old Code

`nag_zero_cont_func_brent_bsrch(...);`

#### New Code

`nag_zero_cont_func_brent_binsrch(...);`

### c05nbc

Withdrawn at Mark 24.
Replaced by c05qbc.

#### Old Code

```void f(Integer n, const double x[], double fvec[], Integer *userflag)
{
...
}
...
nag_zero_nonlin_eqns(n, x, fvec, f, xtol, &fail);```

#### New Code

```void fcn(Integer n, const double x[], double fvec[], Nag_Comm *comm,
Integer *userflag)
{
...
}
...
Nag_Comm comm;
...
nag_zero_nonlin_eqns_easy(fcn, n, x, fvec, xtol, &comm, &fail);```

### c05pbc

Withdrawn at Mark 24.
Replaced by c05rbc.

#### Old Code

```void f(Integer n, double x[], double fvec[], double fjac[],
Integer tdfjac, Integer *userflag)
{
...
}
...
fjac = NAG_ALLOC(n*tdfjac, double);
...
nag_zero_nonlin_eqns_deriv(n, x, fvec, fjac, tdfjac, f, xtol, &fail);```

#### New Code

```void fcn(Integer n, double x[], double fvec[], double fjac_c[],
Nag_Comm *comm, Integer *iflag)
{
/* The Jacobian must be filled column-wise. */
}
...
Nag_Comm comm;
...
fjac_c = NAG_ALLOC(n*n, double);
...
nag_zero_nonlin_eqns_deriv_easy(fcn, n, x, fvec, fjac_c, xtol, &comm,
&fail);
/* The factorization of the Jacobian is now stored column-wise. */```

### c05sdc

Withdrawn at Mark 25.
Replaced by c05ayc.

#### Old Code

```double f(double x, Nag_User *comm)
{
...
}
...
Nag_User comm;
...
nag_zero_cont_func_bd_1(a, b, &x, f, xtol, ftol, &comm, &fail);```

#### New Code

```double f(double xx, Nag_Comm *comm)
{
...
}
...
Nag_Comm comm;
...
nag_zero_cont_func_brent(a, b, xtol, ftol, f, &x, &comm, &fail);```
Note that the communication structure comm is now of type Nag_Comm (see Section 3.1.1 in the Introduction to the NAG Library CL Interface) rather than Nag_User (see Section 3.1.1 in the Introduction to the NAG Library CL Interface).

### c05tbc

Withdrawn at Mark 24.
Replaced by c05qbc.

#### Old Code

```void f(Integer n, const double x[], double fvec[], Integer *userflag,
Nag_User *comm)
{
...
}
...
Nag_User comm;
...
nag_zero_nonlin_eqns_1(n, x, fvec, fcn, xtol, &comm, &fail);```

#### New Code

```void fcn(Integer n, const double x[], double fvec[], Nag_Comm *comm,
Integer *userflag)
{
...
}
...
Nag_Comm comm;
...
nag_zero_nonlin_eqns_easy(fcn, n, x, fvec, xtol, &comm, &fail);```
Note that the communication structure comm is now of type Nag_Comm (see Section 3.1.1 in the Introduction to the NAG Library CL Interface) rather than Nag_User (see Section 3.1.1 in the Introduction to the NAG Library CL Interface).

### c05ubc

Withdrawn at Mark 25.
Replaced by c05rbc.

#### Old Code

```void f(Integer n, double x[], double fvec[], double fjac[],
Integer tdfjac, Integer *userflag, Nag_User *comm)
{
...
}
...
Nag_User comm;
...
fjac = NAG_ALLOC(n*tdfjac, double);
...
nag_zero_nonlin_eqns_deriv_1(n, x, fvec, fjac, tdfjac, f, xtol,
&comm, &fail);```

#### New Code

```void fcn(Integer n, double x[], double fvec[], double fjac_c[],
Nag_Comm *comm, Integer *userflag)
{
/* The Jacobian must be filled column-wise. */
}
...
Nag_Comm comm;
...
fjac_c = NAG_ALLOC(n*n, double);
...
nag_zero_nonlin_eqns_deriv_easy(fcn, n, x, fvec, fjac_c, xtol, &comm,
&fail);
/* The factorization of the Jacobian is now stored column-wise. */```
Note that the communication structure comm is now of type Nag_Comm (see Section 3.1.1 in the Introduction to the NAG Library CL Interface) rather than Nag_User (see Section 3.1.1 in the Introduction to the NAG Library CL Interface).

### c05zbc

Withdrawn at Mark 24.
Replaced by c05zdc.

#### Old Code

`nag_check_deriv(n, x, fvec, fjac, tdfjac, f, &fail);`

#### New Code

```Integer mode, m;
double *xp = 0, *fvecp = 0, *err = 0;
m = n;
mode = 1;
/* Store fjac by columns. */nag_check_derivs(mode, m, n, x, fvec, fjac_c, xp, fvecp, err, &fail);
/* Set fvec to the function values at the original point x and fvecp
* to the function values at the update point xp. */
mode = 2;
nag_check_derivs(mode, m, n, x, fvec, fjac_c, xp, fvecp, err, &fail);
/* Check the contents of err for the measures of correctness of each

### c05zcc

Withdrawn at Mark 24.
Replaced by c05zdc.

#### Old Code

`nag_check_deriv_1(n, x, fvec, fjac, tdfjac, f, &comm, &fail);`

#### New Code

```Integer mode, m;
double *xp = 0, *fvecp = 0, *err = 0;
m = n;
mode = 1;
/* Store fjac by columns. */nag_check_derivs(mode, m, n, x, fvec, fjac_c, xp, fvecp, err, &fail);
/* Set fvec to the function values at the original point x and fvecp
* to the function values at the update point xp. */
mode = 2;
nag_check_derivs(mode, m, n, x, fvec, fjac_c, xp, fvecp, err, &fail);
/* Check the contents of err for the measures of correctness of each

## C06 – Fourier Transforms

### c06eac

Withdrawn at Mark 26.
Replaced by c06pac.
c06pac removes restrictions on sequence length and combines transform directions.

#### Old Code

`nag_sum_withdraw_fft_real_1d_nowork(n, x, &fail);`

#### New Code

`nag_sum_fft_realherm_1d(Nag_ForwardTransform, x, n, &fail);`
where the dimension of the array x has been extended from the original n to ${\mathbf{n}}+2$. The output values x are stored in a different order with real and imaginary parts stored contiguously. The mapping of output elements is as follows:
• ${\mathbf{x}}\left[2×\mathit{i}-1\right]←{\mathbf{x}}\left[\mathit{i}-1\right]$, for $\mathit{i}=0,1,\dots ,{\mathbf{n}}/2$ and
${\mathbf{x}}\left[2×\mathit{i}\right]←{\mathbf{x}}\left[{\mathbf{n}}-\mathit{i}-1\right]$, for $\mathit{i}=1,2,\dots ,\left({\mathbf{n}}+1\right)/2$.

### c06ebc

Withdrawn at Mark 26.
Replaced by c06pac.
c06pac removes restrictions on sequence length and combines transform directions.

#### Old Code

`nag_sum_withdraw_fft_hermitian_1d_nowork(n, x, &fail);`

#### New Code

`nag_sum_fft_realherm_1d(Nag_BackwardTransform, x, n, &fail);`
where the dimension of the array x has been extended from the original n to ${\mathbf{n}}+2$. The input values of x are stored in a different order with real and imaginary parts stored contiguously. Also c06pac performs the inverse transform without the need to first conjugate. If prior conjugation of original array x is assumed then the mapping of input elements is:
• ${\mathbf{x}}\left[2×\mathit{i}-1\right]←{\mathbf{x}}\left[\mathit{i}-1\right]$, for $\mathit{i}=0,1,\dots ,{\mathbf{n}}/2$ and
${\mathbf{x}}\left[2×\mathit{i}\right]←{\mathbf{x}}\left[{\mathbf{n}}-\mathit{i}-1\right]$, for $\mathit{i}=1,2,\dots ,\left({\mathbf{n}}-1\right)/2$.

### c06ecc

Withdrawn at Mark 26.
Replaced by c06pcc.
c06pcc removes restrictions on sequence length, combines transform directions and uses complex types.

#### Old Code

`nag_sum_withdraw_fft_complex_1d_nowork(n, x, y, &fail);`

#### New Code

`nag_sum_fft_complex_1d(Nag_ForwardTransform, z, n, &fail);`
where $\mathrm{z}$ is a complex array of length n such that $\mathrm{z}\left[\mathit{i}\right]\mathbf{.}\mathbf{re}=\mathbf{x}\left[\mathit{i}\right]$ and $\mathrm{z}\left[\mathit{i}\right]\mathbf{.}\mathbf{im}=\mathbf{y}\left[\mathit{i}\right]$, for $\mathit{i}=0,1,\dots ,{\mathbf{n}}-1$ on input and output.

### c06ekc

Withdrawn at Mark 26.
Replaced by c06fkc.
c06fkc removes restrictions on sequence length.

#### Old Code

`nag_sum_withdraw_convcorr_real_nowork(job, n, x, y, &fail);`

#### New Code

`nag_sum_convcorr_real(job, x, y, n, &fail);`

### c06fpc

Scheduled for withdrawal at Mark 30.2.
Replaced by c06pqc.
c06pqc provides a simpler interface for both forward and backward transforms.

#### Old Code

`nag_sum_withdraw_fft_real_1d_multi_rfmt(m, n, x, trig, &fail);`

#### New Code

`nag_sum_fft_realherm_1d_multi_col(Nag_ForwardTransform, n, m, x, &fail);`
where the dimension of the array x has been extended from the original ${\mathbf{n}}×{\mathbf{m}}$ to $\left({\mathbf{n}}+2\right)×{\mathbf{m}}$.
The input values are stored slightly differently to allow for two extra storage spaces at the end of each sequence.
The mapping of input elements is as follows:
• for $\mathit{j}=0,1,\dots ,{\mathbf{m}}-1$
• $J=j×\left({\mathbf{n}}+2\right)$;
• ${\mathbf{x}}\left[J+\mathit{i}\right]←{\mathbf{x}}\left[j×{\mathbf{n}}+\mathit{i}\right]$, for $\mathit{i}=0,1,\dots ,{\mathbf{n}}-1$;
• ${\mathbf{x}}\left[J+{\mathbf{n}}\right]$ and ${\mathbf{x}}\left[J+{\mathbf{n}}+1\right]$ need not be set.
The output values x are stored in a different order with real and imaginary parts of each Hermitian sequence stored contiguously.
The mapping of output elements is as follows:
• for $\mathit{j}=0,1,\dots ,{\mathbf{m}}-1$
• $J=j×\left({\mathbf{n}}+2\right)$;
• ${\mathbf{x}}\left[J+2×\mathit{i}\right]←{\mathbf{x}}\left[j×{\mathbf{n}}+\mathit{i}\right]$, for $\mathit{i}=0,1,\dots ,{\mathbf{n}}/2$ (real parts);
• ${\mathbf{x}}\left[J+2×\mathit{i}+1\right]←{\mathbf{x}}\left[j×{\mathbf{n}}+{\mathbf{n}}-\mathit{i}\right]$, for $\mathit{i}=1,2,\dots ,\left({\mathbf{n}}-1\right)/2$ (imaginary parts);
• ${\mathbf{x}}\left[J+1\right]=0$;
• ${\mathbf{x}}\left[J+{\mathbf{n}}+1\right]=0$ when n is even.

### c06fqc

Scheduled for withdrawal at Mark 30.2.
Replaced by c06pqc.
c06pqc provides a simpler interface for both forward and backward transforms.

#### Old Code

`nag_sum_withdraw_fft_hermitian_1d_multi_rfmt(m, n, x, trig, &fail);`

#### New Code

`nag_sum_fft_realherm_1d_multi_col(Nag_BackwardTransform, n, m, x, &fail);`
where the dimension of the array x has been extended from the original ${\mathbf{n}}×{\mathbf{m}}$ to $\left({\mathbf{n}}+2\right)×{\mathbf{m}}$.
The input values x are stored in a different order with real and imaginary parts of each Hermitian sequence stored contiguously.
The mapping of input elements is as follows:
• for $\mathit{j}=0,1,\dots ,{\mathbf{m}}-1$
• $J=j×\left({\mathbf{n}}+2\right)$;
• ${\mathbf{x}}\left[J+2×\mathit{i}\right]←{\mathbf{x}}\left[j×{\mathbf{n}}+\mathit{i}\right]$, for $\mathit{i}=0,1,\dots ,{\mathbf{n}}/2$ (real parts);
• ${\mathbf{x}}\left[J+2×\mathit{i}+1\right]←{\mathbf{x}}\left[j×{\mathbf{n}}+{\mathbf{n}}-\mathit{i}\right]$, for $\mathit{i}=1,2,\dots ,\left({\mathbf{n}}-1\right)/2$ (imaginary parts);
• ${\mathbf{x}}\left[J+1\right]=0$;
• ${\mathbf{x}}\left[J+{\mathbf{n}}+1\right]=0$ when n is even.
The output values are stored slightly differently to allow for two extra storage spaces at the end of each sequence.
The mapping of output elements is as follows:
• for $\mathit{j}=0,1,\dots ,{\mathbf{m}}-1$
• $J=j×\left({\mathbf{n}}+2\right)$;
• ${\mathbf{x}}\left[J+\mathit{i}\right]←{\mathbf{x}}\left[j×{\mathbf{n}}+\mathit{i}\right]$, for $\mathit{i}=0,1,\dots ,{\mathbf{n}}-1$;
• ${\mathbf{x}}\left[J+{\mathbf{n}}\right]={\mathbf{x}}\left[J+{\mathbf{n}}+1\right]=0\text{.}$

### c06frc

Withdrawn at Mark 26.
Replaced by c06psc.
c06psc provides a simpler interface for both forward and backward transforms.

#### Old Code

`nag_fft_multiple_complex(m, n, x, y, trig, &fail);`

#### New Code

`nag_sum_fft_complex_1d_multi_col(Nag_ForwardTransform, n, m, z, &fail);`
where $z$ is a complex array of length ${\mathbf{m}}×{\mathbf{n}}$ such that $z\left[\mathit{i}\right]\mathbf{.}\mathbf{re}=\mathbf{x}\left[\mathit{i}\right]$ and $z\left[\mathit{i}\right]\mathbf{.}\mathbf{im}=\mathbf{y}\left[\mathit{i}\right]$, for $\mathit{i}=0,1,\dots ,{\mathbf{m}}×{\mathbf{n}}-1$ on input and output.

### c06fuc

Withdrawn at Mark 26.
Replaced by c06puc.
c06puc provides a simpler interface for both forward and backward transforms.

#### Old Code

`nag_fft_2d_complex(m, n, x, y, trigm, trign, &fail);`

#### New Code

`nag_sum_fft_complex_2d(Nag_ForwardTransform, m, n, z, &fail);`
where $\mathrm{z}$ is a complex array of length ${\mathbf{m}}×{\mathbf{n}}$ such that $\mathrm{z}\left[\mathit{i}\right]\mathbf{.}\mathbf{re}=\mathbf{x}\left[\mathit{i}\right]$ and $\mathrm{z}\left[\mathit{i}\right]\mathbf{.}\mathbf{im}=\mathbf{y}\left[\mathit{i}\right]$, for $\mathit{i}=0,1,\dots ,{\mathbf{m}}×{\mathbf{n}}-1$ on input and output.

### c06gbc

Withdrawn at Mark 26.
There is no replacement for this function.

### c06gcc

Withdrawn at Mark 26.
There is no replacement for this function.

### c06gqc

Scheduled for withdrawal at Mark 30.2.
There is no replacement for this function.

### c06gsc

Scheduled for withdrawal at Mark 30.2.
There is no replacement for this function.

### c06gzc

Scheduled for withdrawal at Mark 30.2.
There is no replacement for this function.

### c06hac

Withdrawn at Mark 26.
Replaced by c06rec.
c06rec has a simpler interface, storing sequences by column.

#### Old Code

`nag_fft_multiple_sine(m, n, x, trig, &fail);`

#### New Code

`nag_sum_fft_sine(m, n, x, &fail);`

### c06hbc

Withdrawn at Mark 26.
Replaced by c06rfc.
c06rfc has a simpler interface, storing sequences by column.

#### Old Code

`nag_fft_multiple_cosine(m, n, x, trig, &fail);`

#### New Code

`nag_sum_fft_cosine(m, n, x, &fail);`

### c06hcc

Withdrawn at Mark 26.
Replaced by c06rgc.
c06rgc has a simpler interface, storing sequences by column.

#### Old Code

`nag_fft_multiple_qtr_sine(direct, m, n, x, trig, &fail);`

#### New Code

`nag_sum_fft_qtrsine(direct, m, n, x, &fail);`

### c06hdc

Withdrawn at Mark 26.
Replaced by c06rhc.
c06rhc has a simpler interface, storing sequences by column.

#### Old Code

`nag_fft_multiple_qtr_cosine(direct, m, n, x, trig, &fail);`

#### New Code

`nag_sum_fft_qtrcosine(direct, m, n, x, &fail);`

### d01ajc

Withdrawn at Mark 24.
Replaced by d01rjc.
d01rjc provides thread safety in passing of data to user-supplied function. d01rjc also requires the user-supplied function f to calculate a vector of abscissae at once for greater efficiency and returns additional information on the computation (in the arrays rinfo and iinfo rather than qp previously).
Callbacks

#### Old Code

`double (*f)(double x)`

#### New Code

`void (*f)(const double x[], Integer nx, double fv[], Integer *iflag, Nag_Comm *comm)`
Main Call

#### Old Code

```nag_1d_quad_gen(f, a, b, epsabs, epsrel, max_num_subint, &result, &abserr,
&qp, &fail);```

#### New Code

```nag_quad_dim1_fin_general(f, a, b, epsabs, epsrel, maxsub, &result, &abserr,
rinfo, iinfo, &comm, &fail);```
comm, a pointer to a structure of type Nag_Comm (see Section 3.1.1 in the Introduction to the NAG Library CL Interface), allows you to pass information to the user-supplied function f.

### d01akc

Withdrawn at Mark 24.
Replaced by d01rkc.
d01rkc provides thread safety in passing of data to user-supplied function. d01rkc also requires the user-supplied function f to calculate a vector of abscissae at once for greater efficiency and returns additional information on the computation (in the arrays rinfo and iinfo rather than qp previously).
Callbacks

#### Old Code

`double (*f)(double x)`

#### New Code

`void (*f)(const double x[], Integer nx, double fv[], Integer *iflag, Nag_Comm *comm)`
Main Call

#### Old Code

```nag_1d_quad_osc(f, a, b, epsabs, epsrel, max_num_subint, &result, &abserr,
&qp, &fail);```

#### New Code

```key = 6;
nag_quad_dim1_fin_osc_fn(f, a, b, key, epsabs, epsrel, maxsub, &result, &abserr,
rinfo, iinfo, &comm, &fail);```
comm, a pointer to a structure of type Nag_Comm (see Section 3.1.1 in the Introduction to the NAG Library CL Interface), allows you to pass information to the user-supplied function f.

### d01alc

Withdrawn at Mark 24.
Replaced by d01rlc.
d01rlc provides thread safety in passing of data to user-supplied function. d01rlc also requires the user-supplied function f to calculate a vector of abscissae at once for greater efficiency and returns additional information on the computation (in the arrays rinfo and iinfo rather than $qp$ previously).
Callbacks

#### Old Code

`double (*f)(double x)`

#### New Code

`void (*f)(const double x[], Integer nx, double fv[], Integer *iflag, Nag_Comm *comm)`
Main Call

#### Old Code

```nag_1d_quad_brkpts(f, a, b, nbrkpts, brkpts, epsabs, epsrel, max_num_subint, &result, &abserr,
&qp, &fail);```

#### New Code

```nagf_quad_dim1_fin_brkpts(f, a, b, npts, points, epsabs, epsrel, maxsub, &result, &abserr,
rinfo, iinfo, &comm, &fail);```
comm, a pointer to a structure of type Nag_Comm (see Section 3.1.1 in the Introduction to the NAG Library CL Interface), allows you to pass information to the user-supplied function f.

### d01amc

Withdrawn at Mark 24.
Replaced by d01rmc.
d01rmc provides thread safety in passing of data to user-supplied function. d01rmc also requires the user-supplied function f to calculate a vector of abscissae at once for greater efficiency and returns additional information on the computation (in the arrays rinfo and iinfo rather than $qp$ previously).
Callbacks

#### Old Code

`double (*f)(double x)`

#### New Code

`void (*f)(const double x[], Integer nx, double fv[], Integer *iflag, Nag_Comm *comm)`
Main Call

#### Old Code

```Nag_BoundInterval boundinf = Nag_UpperSemiInfinite; /* or Nag_LowerSemiInfinite or Nag_Infinite */
nag_1d_quad_inf(f, boundinf, bound, epsabs, epsrel, max_num_subint, &result, &abserr,
&qp, &fail);```

#### New Code

```Integer inf = 1;  /* or -1 or 2 */
nagf_quad_dim1_inf_general(f, bound, inf, epsabs, epsrel, maxsub, &result, &abserr,
rinfo, iinfo, &comm, &fail);```
comm, a pointer to a structure of type Nag_Comm (see Section 3.1.1 in the Introduction to the NAG Library CL Interface), allows you to pass information to the user-supplied function f.

### d01anc

Withdrawn at Mark 24.
Replaced by d01snc.
Where comm, a pointer to a structure of type Nag_User (see Section 3.1.1 in the Introduction to the NAG Library CL Interface), has been added to allow you to pass information to the user-supplied function g.

### d01apc

Withdrawn at Mark 24.
Replaced by d01spc.
Where comm, a pointer to a structure of type Nag_User (see Section 3.1.1 in the Introduction to the NAG Library CL Interface), has been added to allow you to pass information to the user-supplied function g.

### d01aqc

Withdrawn at Mark 24.
Replaced by d01sqc.
Where comm, a pointer to a structure of type Nag_User (see Section 3.1.1 in the Introduction to the NAG Library CL Interface), has been added to allow you to pass information to the user-supplied function g.

### d01asc

Withdrawn at Mark 24.
Replaced by d01ssc.
Where comm, a pointer to a structure of type Nag_User (see Section 3.1.1 in the Introduction to the NAG Library CL Interface), has been added to allow you to pass information to the user-supplied function g.

### d01bac

Withdrawn at Mark 24.
Replaced by d01uac.
d01uac provides a simpler interface to select the quadrature rule.

#### Old Code

```double fun (double x)

#### New Code

```void f (const double x[], Integer nx, double fv[], Integer *iflag,
Nag_Comm *comm)
&fail);```
comm is a pointer to a structure of type Nag_Comm (see Section 3.1.1 in the Introduction to the NAG Library CL Interface) available to allow you to pass information to the user-supplied function f.
iflag is an Integer which you may use to force an immediate exit from d01uac in case of an error in the user-supplied function f.
f may be used to call the original fun as follows, although it may be more efficient to recode the integrand.
```void f(const double x[], const Integer nx, double fv[], Integer *iflag,
Nag_Comm *comm)
{
Integer i;
for(i=0; i < nx; i++)
{
fv[i]  = fun(x[i]);
}
}```

### d01fcc

Withdrawn at Mark 25.
Replaced by d01wcc.
Where comm, a pointer to a structure of type Nag_User (see Section 3.1.1 in the Introduction to the NAG Library CL Interface), has been added to allow you to pass information to the user-supplied function f.

### d01gbc

Withdrawn at Mark 25.
Replaced by d01xbc.
Where comm, a pointer to a structure of type Nag_User (see Section 3.1.1 in the Introduction to the NAG Library CL Interface), has been added to allow you to pass information to the user-supplied function f.

### d01sjc

Deprecated at Mark 27.1.
Replaced by d01rjc.
d01rjc requires the user-supplied function f to calculate a vector of abscissae at once for greater efficiency and returns additional information on the computation (in the arrays rinfo and iinfo rather than $qp$ previously).
Callbacks

#### Old Code

`double (*f)(double x)`

#### New Code

`void (*f)(const double x[], Integer nx, double fv[], Integer *iflag, Nag_Comm *comm)`
Main Call

#### Old Code

```nag_quad_dim1_fin_gen(f, a, b, epsabs, epsrel, max_num_subint, &result, &abserr,
&qp, &comm, &fail);```

#### New Code

```nag_quad_dim1_fin_general(f, a, b, epsabs, epsrel, maxsub, &result, &abserr,
rinfo, iinfo, &comm, &fail);```

### d01skc

Deprecated at Mark 27.1.
Replaced by d01rkc.
d01rkc requires the user-supplied function f to calculate a vector of abscissae at once for greater efficiency and returns additional information on the computation (in the arrays rinfo and iinfo rather than $qp$ previously).
Callbacks

#### Old Code

`double (*f)(double x)`

#### New Code

`void (*f)(const double x[], Integer nx, double fv[], Integer *iflag, Nag_Comm *comm)`
Main Call

#### Old Code

```nag_quad_dim1_osc(f, a, b, epsabs, epsrel, max_num_subint, &result, &abserr,
&qp, &comm, &fail);```

#### New Code

```key = 6;
nag_quad_dim1_fin_osc_fn(f, a, b, key, epsabs, epsrel, maxsub, &result, &abserr,
rinfo, iinfo, &comm, &fail);```

### d01slc

Deprecated at Mark 27.1.
Replaced by d01rlc.
d01rlc requires the user-supplied function f to calculate a vector of abscissae at once for greater efficiency and returns additional information on the computation (in the arrays rinfo and iinfo rather than $qp$ previously).
Callbacks

#### Old Code

`double (*f)(double x)`

#### New Code

`void (*f)(const double x[], Integer nx, double fv[], Integer *iflag, Nag_Comm *comm)`
Main Call

#### Old Code

```nag_quad_dim1_fin_brkpts_threadsafe(f, a, b, nbrkpts, brkpts, epsabs, epsrel, max_num_subint, &result,
&abserr, &qp, &comm, &fail);```

#### New Code

```nagf_quad_dim1_fin_brkpts(f, a, b, npts, points, epsabs, epsrel, maxsub, &result, &abserr,
rinfo, iinfo, &comm, &fail);```

### d01smc

Deprecated at Mark 27.1.
Replaced by d01rmc.
d01rmc requires the user-supplied function f to calculate a vector of abscissae at once for greater efficiency and returns additional information on the computation (in the arrays rinfo and iinfo rather than $qp$ previously).
Callbacks

#### Old Code

`double (*f)(double x)`

#### New Code

`void (*f)(const double x[], Integer nx, double fv[], Integer *iflag, Nag_Comm *comm)`
Main Call

#### Old Code

```Nag_BoundInterval boundinf = Nag_UpperSemiInfinite; /* or Nag_LowerSemiInfinite or Nag_Infinite */
&qp, &comm, &fail);```

#### New Code

```Integer inf = 1;  /* or -1 or 2 */
nagf_quad_dim1_inf_general(f, bound, inf, epsabs, epsrel, maxsub, &result, &abserr,
rinfo, iinfo, &comm, &fail);```

### d01tac

Withdrawn at Mark 28.3.
Replaced by d01uac.
d01uac requires the user-supplied function f to calculate a vector of abscissae at once for greater efficiency and returns a flag to allow a signal that computation should be stopped.
Callbacks

#### Old Code

`double (*f)(double x, Nag_User *comm)`

#### New Code

`void (*f)(const double x[], Integer nx, double fv[], Integer *iflag, Nag_Comm *comm)`
Main Call

#### Old Code

```Nag_User comm;
Nag_GaussFormulae gaussformula=Nag_Legendre;
result = nag_quad_dim1_gauss_1(gaussformula, f, a, b, npts, &comm, &fail);```

#### New Code

```Nag_Comm comm;
Similarly for the Laguerre, Hermite and Rational quadrature formulae.

## D02 – Ordinary Differential Equations

### d02pcc

Withdrawn at Mark 26.
Replaced by d02pec and associated d02p functions.

#### Old Code

```nag_ode_ivp_rk_setup(n, tstart, yinit, tend, tol, thres, method, task,
errass, hstart, &opt, &fail);
...
nag_ode_ivp_rk_range(n, f, twant, &tgot, ygot, ypgot, ymax, &opt,
&comm, &fail);```

#### New Code

```nag_ode_ivp_rkts_setup(n, tstart, tend, yinit, tol, thres, method,
errass, hstart, iwsav, rwsav, &fail);
...
nag_ode_ivp_rkts_range(f2, n, twant, &tgot, ygot, ypgot, ymax,
&comm2, iwsav, rwsav, &fail);```
iwsav is an Integer array of length $130$ and rwsav is a double array of length $350+32×{\mathbf{n}}$.
comm2 is a pointer to a structure of type nag_comm available to allow you to pass information to the user defined function f2 (see f in d02pec).
The definition of f2 (see f in d02pec) can use the original function f as follows:
```void f2(double t, Integer n, const double *y, double *yp, Nag_Comm *comm2)
{
Nag_User comm;
f(n, t, y, yp, &comm);
}```

### d02pdc

Withdrawn at Mark 26.
Replaced by d02pfc and associated d02p functions.
d02pgc offers a reverse communication approach.

#### Old Code

```nag_ode_ivp_rk_setup(n, tstart, yinit, tend, tol, thres, method, task,
errass, hstart, &opt, &fail);
nag_ode_ivp_rk_onestep(n, f, &tnow, ynow, ypnow, &opt, &comm,
&fail);```

#### New Code

```nag_ode_ivp_rkts_setup(n, tstart, tend, yinit, tol, thres, method,
errass, hstart, iwsav, rwsav, &fail);
nag_ode_ivp_rkts_onestep(f2, n, &tnow, ynow, ypnow, &comm2, iwsav,
rwsav, &fail);```
iwsav is an Integer array of length $130$ and rwsav is a double array of length $350+32×{\mathbf{n}}$.
comm2 is a pointer to a structure of type Nag_Comm (see Section 3.1.1 in the Introduction to the NAG Library CL Interface) available to allow you to pass information to the user defined function f2 (see f in d02pec).
The definition of f2 (see f in d02pec) can use the original function f as follows:
```void f2(double t, Integer n, const double *y, double *yp, Nag_Comm *comm2)
{
Nag_User comm;
f(n, t, y, yp, &comm);
}```

### d02ppc

Withdrawn at Mark 26.
There is no replacement for this function.

### d02pvc

Withdrawn at Mark 26.
Replaced by d02pqc.
See d02pcc and d02pdc for further information.

### d02pwc

Withdrawn at Mark 26.
Replaced by d02prc.

#### Old Code

`nag_ode_ivp_rk_reset_tend(tendnu, &opt, &fail);`

#### New Code

`nag_ode_ivp_rkts_reset_tend(tendnu, iwsav, rwsav, &fail);`
iwsav is an Integer array of length $130$ and rwsav is a double array of length $350$.

### d02pxc

Withdrawn at Mark 26.
Replaced by d02psc.

#### Old Code

```nag_ode_ivp_rk_interp(n, twant, request, nwant, ywant, ypwant, f,
&opt, &comm, &fail);```

#### New Code

```nag_ode_ivp_rkts_interp(n, twant, request, nwant, ywant, ypwant, f2,
wcomm, lwcomm, &comm2, iwsav, rwsav, &fail);```
iwsav is an Integer array of length $130$ and rwsav is a double array of length $350+32×{\mathbf{n}}$.
comm2 is a pointer to a structure of type Nag_Comm (see Section 3.1.1 in the Introduction to the NAG Library CL Interface) available to allow you to pass information to the user defined function f2 (see f in d02psc).
wcomm is a double array of length lwcomm. See the function document for d02psc for further information.
The definition of f2 (see f in d02psc) can use the original function f as follows:
```void f2(double t, Integer n, const double *y, double *yp, Nag_Comm *comm2)
{
Nag_User comm;
f(n, t, y, yp, &comm);
}```

### d02pzc

Withdrawn at Mark 26.
Replaced by d02puc.

#### Old Code

`nag_ode_ivp_rk_errass(n, rmserr, &errmax, &terrmx, &opt, &fail);`

#### New Code

```nag_ode_ivp_rkts_errass(n, rmserr, &errmax, &terrmx, iwsav, rwsav,
&fail);```
n must be unchanged from that passed to d02pqc.
iwsav is an Integer array of length $130$ and rwsav is a double array of length $350+32×{\mathbf{n}}$.

## E01 – Interpolation

### e01sac

Withdrawn at Mark 23.
Replaced by e01sgc or e01sjc.
e01sac generates a two-dimensional surface interpolating a set of scattered data points, using either the method of Renka and Cline or a modification of Shepard's method. The replacement functions separate these two methods. e01sac_rk.c provides replacement call information for the Renka and Cline method (e01sgc) and e01sac_shep.c provides replacement call information for the Shepard's method (e01sjc).

### e01sbc

Withdrawn at Mark 23.
Replaced by e01shc or e01skc.
See the example program e01sac_rk.c and e01sac_shep.c for full details.

### e01szc

Withdrawn at Mark 23.
There is no replacement for this function.

## E04 – Minimizing or Maximizing a Function

### e04ccc

Withdrawn at Mark 24.
Replaced by e04cbc.

#### Old Code

`nag_opt_withdraw_uncon_simplex(n, funct, x, &objf, &options, &comm, &fail);`

#### New Code

```nag_opt_uncon_simplex(n, x, &objf, tolf, tolx, funct, monit, maxcal,
&comm, &fail);```
The options structure has been removed from e04ccc. The optim_tol and max_iter members of the options structure have been introduced as the arguments tolf and maxcal, respectively. tolx is an additional argument to control tolerance. A new user defined function monit has been added to allow you to monitor the optimization process. If no monitoring is required, monit may be specified as NULLFN.

### e04dgc

Deprecated at Mark 27.
Replaced by e04kfc.
The new solver e04kfc is part of the NAG optimization modelling suite(see Section 4.1 in the E04 Chapter Introduction), therefore the definition of the objective function values and gradients need to be split into two separate subroutines. e04kfc offers a significant improvement in performance over e04dgc as well as additional functionality, such as the addition of variable bounds and monitoring.
Callbacks

#### Old Code

```static void NAG_CALL objfun(Integer n, const double x[], double *objf,
double g[], Nag_Comm *comm)
{
/* Compute objective at point x */
*objf = ... ;

/* Compute objective gradient at point x */
g[0] = ... ;
...
g[n-1] = ... ;
}```

#### New Code

```static void NAG_CALL objfun(Integer nvar,
const double x[],
double *fx, Integer * inform, Nag_Comm * comm)
{
/* Compute objective at point x */
*fx = ... ;
}

static void NAG_CALL objgrd(Integer nvar,
const double x[],
Integer nnzfd,
double fdx[],
Integer * inform, Nag_Comm * comm)
{
/* Compute objective gradient at point x */
fdx[0] = ... ;
fdx[1] = ... ;
...
fdx[nnzfd-1] = ... ;
}```
Main Call

#### Old Code

```SET_FAIL(fail);
nag_opt_uncon_conjgrd_comp(n, objfun, x, &objf, g, &options, &comm, &fail);```

#### New Code

```/* Initialize problem with n variables */
nag_opt_handle_init(&handle, n, NAGERR_DEFAULT);

* (dependent on all variables)
*/
for (int i=1; i<=n; i++)
idxfd[i-1] = i;
nag_opt_handle_set_nlnobj(handle, n, idxfd, NAGERR_DEFAULT);

/* Solver the problem */
SET_FAIL(fail);
nag_opt_handle_solve_bounds_foas(handle, objfun, objgrd, NULLFN, n,
x, rinfo, stats, &comm, &fail);

iter = stats[7];
objf = rinfo[0];

/* Free the handle memory */
nag_opt_handle_free(&handle, NAGERR_DEFAULT);```

### e04gbc

Deprecated at Mark 28.3.
Replaced by e04ggc.
e04ggc is part of the new NAG optimization modelling suite (see Section 4.1 in the E04 Chapter Introduction), therefore the definition of the nonlinear residual function values and gradients need to be split into two separate subroutines. e04ggc offers a significant improvement in performance over e04gbc as well as additional functionality, such as the addition of variable bounds and user-evaluation recovery, amongst many others.
Callbacks
Main Call

### e04jbc

Withdrawn at Mark 26.
Replaced by e04ucc.
See the example program e04jbce.c for code demonstrating how to use e04ucc instead of e04jbc.

### e04jcc

Deprecated at Mark 27.
Replaced by e04jdc and e04jec.
e04jdc and e04jec are a part of the new NAG optimization modelling suite (see Section 4.1 in the E04 Chapter Introduction) which allows you to define and solve various problems in a uniform manner. They also offer various algorithmic additions, such as a performance improvement on noisy problems, a possibility to progress towards the solution earlier than after $n$ initial function evaluations, heuristic stopping criteria, recovery from unavailable function evaluations, and various other algorithmic updates and tuning. In addition, e04jec offers a reverse communication interface (see Section 4.2 in the E04 Chapter Introduction) which might be useful in some environments or if you can parallelize your function evaluations.
Callbacks
The objective function callbacks are almost identical, the order of arguments has been slightly altered.

#### Old Code

`void (*objfun)(Integer n, const double x[], double *f, Nag_Comm *comm, Integer *inform)`

#### New Code

`void (*objfun)(Integer n, const double x[], double *f, Integer *inform, Nag_Comm *comm)`
Main Call

#### Old Code

```SET_FAIL(fail);
nag_opt_bounds_bobyqa_func(objfun, n, npt, x, bl, bu, rhobeg, rhoend,
NULLFN, maxcal, &f, &nf, &comm, &fail);```

#### New Code

```void *handle;
Integer *idxfd, i;
double rinfo[100], stats[100];

/* Initialize the problem with n variables */
nag_opt_handle_init(&handle, n, NAGERR_DEFAULT);

/* Add nonlinear objective function which depends on all variables */
idxfd = (Integer*) malloc(n*sizeof(Integer));
for (i=0; i<n; i++)
idxfd[i] = i+1;
nag_opt_handle_set_nlnobj(handle, n, idxfd, NAGERR_DEFAULT);

/* Add bounds for the variables */
nag_opt_handle_set_simplebounds(handle, n, bl, bu, NAGERR_DEFAULT);

/* Pass npt, rhobeg, rhoend, maxcal as options if different from defaults */
nag_opt_handle_opt_set(handle, 'DFO Number Interp Points = <your npt>', NAGERR_DEFAULT);
nag_opt_handle_opt_set(handle, 'DFO Starting trust Region = <your rhobeg>', NAGERR_DEFAULT);
nag_opt_handle_opt_set(handle, 'DFO Trust Region Tolerance = <your rhoend>', NAGERR_DEFAULT);
nag_opt_handle_opt_set(handle, 'DFO Max Objective Calls = <your maxcal>', NAGERR_DEFAULT);

/* Solve the problem */
SET_FAIL(fail);
nag_opt_handle_solve_dfno(handle, objfun, NULLFN, n, x, rinfo, stats,
&comm, &fail);

/* retrieve the objective value and the total number of calls made to the objective function */
f = rinfo[0];
nf = (Integer) stats[0];

/* Free the handle memory */
nag_opt_handle_free(&handle, NAGERR_DEFAULT);```

### e04ugc

Deprecated at Mark 28.3.
Replaced by e04src.
A modern Sequential Quadratic Programming (SQP) algorithm that uses the NAG optimization modelling suite (see Section 4.1 in the E04 Chapter Introduction) has been introduced. This new function e04src has access to all of the suite facilities and uses the same interface as all compatible solvers.

### e04vgc

Deprecated at Mark 28.3.
Replaced by e04src.
This was an initialization function for e04vhc which has been superseded by e04src. e04src is part of the NAG optimization modelling suite (see Section 4.1 in the E04 Chapter Introduction) which uses the initialization facilities common to that suite.

### e04vhc

Deprecated at Mark 28.3.
Replaced by e04src.
A modern Sequential Quadratic Programming (SQP) algorithm that uses the NAG optimization modelling suite (see Section 4.1 in the E04 Chapter Introduction) has been introduced. This new function e04src has access to all of the suite facilities and uses the same interface as all compatible solvers.

### e04vjc

Deprecated at Mark 28.3.
Replaced by e04src.
This was a sparsity structure defining function for e04vhc which has been superseded by e04src. e04src is part of the NAG optimization modelling suite (see Section 4.1 in the E04 Chapter Introduction) which uses the problem defining facilities common to that suite.

### e04vkc

Deprecated at Mark 28.3.
Replaced by e04src.
This was an option setting function for e04vhc which has been superseded by e04src. e04src is part of the NAG optimization modelling suite (see Section 4.1 in the E04 Chapter Introduction) which uses the option setting facilities common to that suite.

### e04vlc

Deprecated at Mark 28.3.
Replaced by e04src.
This was an option setting function for e04vhc which has been superseded by e04src. e04src is part of the NAG optimization modelling suite (see Section 4.1 in the E04 Chapter Introduction) which uses the option setting facilities common to that suite.

### e04vmc

Deprecated at Mark 28.3.
Replaced by e04src.
This was an option setting function for e04vhc which has been superseded by e04src. e04src is part of the NAG optimization modelling suite (see Section 4.1 in the E04 Chapter Introduction) which uses the option setting facilities common to that suite.

### e04vnc

Deprecated at Mark 28.3.
Replaced by e04src.
This was an option setting function for e04vhc which has been superseded by e04src. e04src is part of the NAG optimization modelling suite (see Section 4.1 in the E04 Chapter Introduction) which uses the option setting facilities common to that suite.

### e04vrc

Deprecated at Mark 28.3.
Replaced by e04src.
This was an option getting function for e04vhc which has been superseded by e04src. e04src is part of the NAG optimization modelling suite (see Section 4.1 in the E04 Chapter Introduction) which uses the option getting facilities common to that suite.

### e04vsc

Deprecated at Mark 28.3.
Replaced by e04src.
This was an option getting function for e04vhc which has been superseded by e04src. e04src is part of the NAG optimization modelling suite (see Section 4.1 in the E04 Chapter Introduction) which uses the option getting facilities common to that suite.

### e04yac

Deprecated at Mark 28.3.
There is no replacement for this function.

## E05 – Global Optimization of a Function

### e05jac

Deprecated at Mark 28.3.
There is no replacement for this function.

### e05jbc

Deprecated at Mark 28.3.
Replaced by e05kbc.
A new interface to the Multi-level Coordinate Search (MCS) algorithm to integrate it to the NAG optimization modelling suite has been introduced. This new function gives access to all of the suite facilities and uses the same interface as all compatible solvers, simplifying experimentation significantly.
Callbacks

#### Old Code

```static void NAG_CALL objfun(Integer n, const double x[], double *f,
Integer nstate, Nag_Comm *comm, Integer *inform) {
{
/* Compute objective at point x */
*f = ... ;
}```

#### New Code

```static void NAG_CALL objfun(Integer nvar, const double x[],
double *fx, Integer * inform, Nag_Comm * comm)
{
/* Compute objective at point x */
*fx = ... ;
}```
Main Call

#### Old Code

```SET_FAIL(fail);
nag_glopt_bnd_mcs_solve(n, objfun, boundenum, initmethodenum, bl, bu, sdlist,
list, numpts, initpt, monit, x, &obj, &state, &comm,
&fail);```

#### New Code

```/* Initialize problem with n variables */
nag_opt_handle_init(&handle, n, NAGERR_DEFAULT);

* (dependent on all variables)
*/
for (int i=1; i<=n; i++)
idxfd[i-1] = i;
nag_opt_handle_set_nlnobj(handle, n, idxfd, NAGERR_DEFAULT);

/* Define bounds for the variables
* nag_opt_handle_set_simplebounds (e04rhc)
*/
nag_opt_handle_set_simplebounds(handle, nvar, lx, ux, NAGERR_DEFAULT);

/* Solve the problem */
SET_FAIL(fail);
nag_glopt_handle_solve_mcs(handle, objfun, monit, nvar, x, rinfo, stats,
&comm, ∓fail);```

### e05jcc

Deprecated at Mark 28.3.
There is no replacement for this function.

### e05jdc

Deprecated at Mark 28.3.
There is no replacement for this function.

### e05jec

Deprecated at Mark 28.3.
There is no replacement for this function.

### e05jfc

Deprecated at Mark 28.3.
There is no replacement for this function.

### e05jgc

Deprecated at Mark 28.3.
There is no replacement for this function.

### e05jhc

Deprecated at Mark 28.3.
There is no replacement for this function.

### e05jjc

Deprecated at Mark 28.3.
There is no replacement for this function.

### e05jkc

Deprecated at Mark 28.3.
There is no replacement for this function.

### e05jlc

Deprecated at Mark 28.3.
There is no replacement for this function.

## F01 – Matrix Operations, Including Inversion

### f01bnc

Withdrawn at Mark 25.
Replaced by f07frc.
If you were only using f01bnc in order to feed its results into f04awc, then the simple replacement function in the section for f04awc will suffice. A more thorough replacement function is given here and it will put the same values in arrays a and p as f01bnc did.
```void f01bnc_replacement(Integer n, Complex a[], Integer tda, double p[],
NagError *fail)
{
Integer i, pdb=n;
Complex *b;

b = NAG_ALLOC(n*n, Complex);
/* replacement factorization routine requires the upper triangle
to be stored for U^H*U, but f01bnc expects the lower triangle
to be stored so put the lower triangle of a into the upper
triangle of b */
/* nag_blast_zge_copy */
f16tfc(Nag_RowMajor, Nag_ConjTrans, n, n, a, tda, b, pdb, fail);
/* factorize b */
/* nag_lapacklin_zpotrf */
f07frc(Nag_RowMajor, Nag_Upper, n, b,pdb, fail);
/* diagonal elements to populate the p array */
for (i = 0; i < n; ++i) p[i] = 1.0/b[i*tda+i].re;
/* overwrite the off-diagonal upper triangle of a with U */
/* nag_blast_ztr_copy */
f16tec(Nag_RowMajor, Nag_Upper, Nag_NoTrans, Nag_UnitDiag, n, b, pdb, a,
tda, fail);
NAG_FREE(b);
}```

### f01qcc

Withdrawn at Mark 25.
Replaced by f08aec.
The subdiagonal elements of a and the elements of zeta returned by f08aec are not the same as those returned by f01qcc. Subsequent calls to f01qdc or f01qec must also be replaced by calls to f08afc or f08agc as shown below.
```void f01qcc_replacement(Integer m, Integer n, double a[], Integer tda,
double zeta[], NagError *fail)
{
/* nag_lapackeig_dgeqrf */
f08aec(Nag_RowMajor, m, n, a, tda, zeta, fail);
/* the factorization in a and zeta will be stored differently */
}```

### f01qdc

Withdrawn at Mark 25.
Replaced by f08agc.
The following replacement is valid only if the previous call to f01qcc has been replaced by a call to f08aec as shown below. It also assumes that the second argument of f01qdc is set to $\mathbf{wheret}=\mathrm{Nag_ElementsSeparate}$, which is appropriate if the contents of a and zeta have not been changed after the call of f01qcc.
```void f01qcc_replacement(Integer m, Integer n, double a[], Integer tda,
double zeta[], NagError *fail)
{
/* nag_lapackeig_dgeqrf */
f08aec(Nag_RowMajor, m, n, a, tda, zeta, fail);
/* the factorization in a and zeta will be stored differently */
}

void f01qdc_replacement(MatrixTranspose trans, Nag_WhereElements wheret,
Integer m, Integer n, double a[], Integer tda, const double zeta[],
Integer ncolb, double b[], Integer tdb, NagError *fail)
{
Nag_TransType t = (trans == NoTranspose)? Nag_NoTrans : Nag_Trans;
/* nag_lapackeig_dormqr */
f08agc(Nag_RowMajor, Nag_LeftSide, t, m, ncolb, n, a, tda, zeta,
b, tdb, fail);
}```

### f01qec

Withdrawn at Mark 25.
Replaced by f08afc.
The following replacement is valid only if the previous call to f01qcc has been replaced by a call to f08aec as shown below. It also assumes that the first argument of f01qec is set to $\mathbf{wheret}=\mathrm{Nag_ElementsSeparate}$, which is appropriate if the contents of a and zeta have not been changed after the call of f01qcc.
```void f01qcc_replacement(Integer m, Integer n, double a[], Integer tda,
double zeta[], NagError *fail)
{
/* nag_lapackeig_dgeqrf */
f08aec(Nag_RowMajor, m, n, a, tda, zeta, fail);
/* the factorization in a and zeta will be stored differently */
}

void f01qec_replacement(Nag_WhereElements wheret, Integer m, Integer n,
Integer ncolq, double a[], Integer tda, const double zeta[],
NagError *fail)
{
/* factorization performed by nag_dgeqrf (f08aec) */
/* nag_lapackeig_dorgqr */
f08afc(Nag_RowMajor, m, ncolq, n, a, tda, zeta, fail);
}```

### f01rcc

Withdrawn at Mark 25.
Replaced by f08asc.
The subdiagonal elements of a and the elements of theta returned by f08asc are not the same as those returned by f01rcc. Subsequent calls to f01rdc or f01rec must also be replaced by calls to f08auc or f08atc as shown below.
```void f01rcc_replacement(Integer m, Integer n, Complex a[], Integer tda,
Complex theta[], NagError *fail)
{
/* nag_lapackeig_zgeqrf */
f08asc(Nag_RowMajor, m, n, a, tda, theta, fail);
/* the factorization in a and theta will be stored differently */
}```

### f01rdc

Withdrawn at Mark 25.
Replaced by f08auc.
The following replacement is valid only if the previous call to f01rcc has been replaced by a call to f08asc as shown below. It also assumes that the second argument of f01rdc is set to $\mathbf{wheret}=\mathrm{Nag_ElementsSeparate}$, which is appropriate if the contents of a and theta have not been changed after the call of f01rcc.
```void f01rcc_replacement(Integer m, Integer n, Complex a[], Integer tda,
Complex theta[], NagError *fail)
{
/* nag_lapackeig_zgeqrf */
f08asc(Nag_RowMajor, m, n, a, tda, theta, fail);
/* the factorization in a and theta will be stored differently */
}

void f01rdc_replacement(MatrixTranspose trans, Nag_WhereElements wheret,
Integer m, Integer n, Complex a[], Integer tda, const Complex theta[],
Integer ncolb, Complex b[], Integer tdb, NagError *fail)
{
Nag_TransType t = (trans == NoTranspose)? Nag_NoTrans : Nag_ConjTrans;
/* nag_lapackeig_zunmqr */
f08auc(Nag_RowMajor, Nag_LeftSide, t, m, ncolb, n, a, tda, theta,
b, tdb, fail);
}```

### f01rec

Withdrawn at Mark 25.
Replaced by f08atc.
The following replacement is valid only if the previous call to f01rcc has been replaced by a call to f08asc as shown below. It also assumes that the first argument of f01rec is set to $\mathbf{wheret}=\mathrm{Nag_ElementsSeparate}$, which is appropriate if the contents of a and theta have not been changed after the call of f01rcc.
```void f01rcc_replacement(Integer m, Integer n, Complex a[], Integer tda,
Complex theta[], NagError *fail)
{
/* nag_lapackeig_zgeqrf */
f08asc(Nag_RowMajor, m, n, a, tda, theta, fail);
/* the factorization in a and theta will be stored differently */
}

void f01rec_replacement(Nag_WhereElements wheret, Integer m, Integer n,
Integer ncolq, Complex a[], Integer tda, const Complex theta[],
NagError *fail)
{
/* nag_lapackeig_zungqr */
/* factorization performed by f08asc */
f08atc(Nag_RowMajor, m, ncolq, n, a, tda, theta, fail);
}```

## F02 – Eigenvalues and Eigenvectors

### f02aac

Withdrawn at Mark 26.
Replaced by f08fac.

#### Old Code

`nag_real_symm_eigenvalues(n, a, tda, r, &fail);`

#### New Code

`nag_dsyev(Nag_RowMajor, Nag_EigVals, Nag_Lower, n, a, tda, r, &fail);`

### f02abc

Withdrawn at Mark 26.
Replaced by f08fac.

#### Old Code

`nag_real_symm_eigensystem(n, a, tda, r, v, tdv, &fail);`

#### New Code

```nag_dtr_copy (Nag_RowMajor, Nag_Lower, Nag_NoTrans, Nag_NonUnitDiag, n,
a, tda, v, tdv, &fail);
nag_dsyev(Nag_RowMajor, Nag_DoBoth, Nag_Lower, n, v, tdv, r, &fail);```
If f02abc was called with the same array supplied for v and a, then the call to f16qec may be omitted.

Withdrawn at Mark 26.
Replaced by f08sac.

#### Old Code

`nag_real_symm_general_eigenvalues(n, a, tda, b, tdb, r, &fail);`

#### New Code

```nag_dsygv(Nag_RowMajor, 1, Nag_EigVals, Nag_Upper, n, a, tda, b, tdb,
r, &fail);```
Note that the call to f08sac will overwrite the upper triangles of the arrays a and b and leave the subdiagonal elements unchanged, whereas the call to f02adc overwrites the lower triangle and leaves the elements above the diagonal unchanged.

### f02aec

Withdrawn at Mark 26.
Replaced by f08sac.

#### Old Code

```nag_real_symm_general_eigensystem(n, a, tda, b, tdb, r, v, tdv,
&fail);```

#### New Code

```nag_dtr_copy (Nag_RowMajor, Nag_Upper, Nag_NoTrans, Nag_NonUnitDiag, n,
a, tda, v, tdv, &fail);
nag_dsygv(Nag_RowMajor, 1, Nag_DoBoth, Nag_Upper, n, v, tdv, b, tdb,
r, &fail);```
Note that the call to f08sac will overwrite the upper triangle of the array b and leave the subdiagonal elements unchanged, whereas the call to f02aec overwrites the lower triangle and leaves the elements above the diagonal unchanged. The call to f16qec copies a to v, so a is left unchanged. If f02aec was called with the same array supplied for v and a, then the call to f16qec may be omitted.

### f02afc

Withdrawn at Mark 26.
Replaced by f08nac.

#### Old Code

`nag_real_eigenvalues(n, a, tda, r, iter, &fail);`

#### New Code

```nag_dgeev(Nag_RowMajor, Nag_NotLeftVecs, Nag_NotRightVecs, n, a, tda,
wr, wi,vl, 1, vr, 1, &fail);```
where wr and wi are double arrays of lengths $n$ such that ${\mathbf{wr}}\left[\mathit{i}-1\right]=\mathbf{r}\left[\mathit{i}-1\right]\mathbf{.}\mathbf{re}$ and ${\mathbf{wi}}\left[\mathit{i}-1\right]=\mathbf{r}\left[\mathit{i}-1\right]\mathbf{.}\mathbf{im}$, for $\mathit{i}=1,2,\dots ,n$; vl and vr are double arrays of length $1$ (not used in this call); the iteration counts (returned by f02afc in the array iter) are not available from f08nac.

### f02agc

Withdrawn at Mark 26.
Replaced by f08nac.

#### Old Code

`nag_real_eigensystem(n, a, tda, r, v, tdv, iter, &fail);`

#### New Code

```nag_dgeev(Nag_RowMajor, Nag_NotLeftVecs, Nag_RightVecs, n, a, tda,
wr, wi, vl, 1, vr, pdvr, &fail);```
where wr and wi are double arrays of lengths $n$ such that ${\mathbf{wr}}\left[\mathit{i}-1\right]=\mathbf{r}\left[\mathit{i}-1\right]\mathbf{.}\mathbf{re}$ and ${\mathbf{wi}}\left[\mathit{i}-1\right]=\mathbf{r}\left[\mathit{i}-1\right]\mathbf{.}\mathbf{im}$, for $\mathit{i}=1,2,\dots ,n$; vl is a double array of length $1$ (not used in this call) and vr is a double array of length ${\mathbf{n}}×{\mathbf{n}}$; the iteration counts (returned by f02agc in the array iter) are not available from f08nac.
Eigenvector information is stored differently in vr:
• $\mathbf{v}\left[\mathit{j}\right]\mathbf{.}\mathbf{re}={\mathbf{vr}}\left[j\right]$ if ${\mathbf{wi}}\left[j\right]=0.0$.
• $\mathbf{v}\left[\mathit{j}\right]\mathbf{.}\mathbf{re}={\mathbf{vr}}\left[j\right]$ and $\mathbf{v}\left[\mathit{j}\right]\mathbf{.}\mathbf{im}={\mathbf{vr}}\left[j+1\right]$ and $\mathbf{v}\left[\mathit{j}+1\right]\mathbf{.}\mathbf{re}={\mathbf{vr}}\left[j\right]$ and $\mathbf{v}\left[\mathit{j}+1\right]\mathbf{.}\mathbf{im}=-{\mathbf{vr}}\left[j+1\right]$ if ${\mathbf{wi}}\left[j\right]\ne 0$ and ${\mathbf{wi}}\left[j\right]=-{\mathbf{wi}}\left[j+1\right]$.

### f02awc

Withdrawn at Mark 26.
Replaced by f08fnc.

#### Old Code

`nag_hermitian_eigenvalues(n, a, tda, r, &fail);`

#### New Code

`nag_zheev(Nag_RowMajor, Nag_EigVals, Nag_Lower, n, a, tda, r, &fail);`

### f02axc

Withdrawn at Mark 26.
Replaced by f08fnc.

#### Old Code

`nag_hermitian_eigensystem(n, a, tda, r, v, tdv, &fail);`

#### New Code

```nag_ztr_copy(Nag_RowMajor, Nag_Lower, Nag_NoTrans, Nag_NonUnitDiag, n,
a, tda, v, tdv, &fail);
nag_zheev(Nag_RowMajor, Nag_DoBoth, Nag_Lower, n, v, tdv, r, &fail);```
If f02axc was called with the same arrays supplied for v and a, then the call to f16tec may be omitted.

### f02bjc

Withdrawn at Mark 26.
Replaced by f08wcc.

#### Old Code

```nag_real_general_eigensystem(n, a, tda, b, tdb, tol, alfa, beta,
wantv, v, tdv, iter, &fail);```

#### New Code

```if (wantv) jobvr = Nag_RightVecs; else jobvr = Nag_NotRightVecs;
nag_dggev(Nag_RowMajor, Nag_NotLeftVecs, jobvr, n, a, tda, b, tdb,
alphar, alphai, beta, vl, tdvl, vr, tdvr, &fail);```
where alphar and alphai are double arrays of lengths $n$ such that $\mathbf{alphar}\left[\mathit{i}-1\right]=\mathrm{alfa}\left[\mathit{i}-1\right]\mathbf{.}\mathbf{re}$ and $\mathbf{alphai}\left[\mathit{i}-1\right]=\mathrm{alfa}\left[\mathit{i}-1\right]\mathbf{.}\mathbf{im}$, for $\mathit{i}=1,2,\dots ,n$.

### f02wec

Withdrawn at Mark 26.
Replaced by f08kbc.

#### Old Code

```nag_real_svd(m, n, a, tda, ncolb, b, tdb, wantq, q, tdq, sv, wantp,
pt, tdpt, &iter, e, &failinfo, &fail);```

#### New Code

```if (wantq) jobu = Nag_AllU; else jobu = Nag_NotU;
if (wantp) jobvt = Nag_AllVT; else jobvt = Nag_NotVT;
nag_dgesvd(Nag_RowMajor, jobu, jobvt, m, n, a, tda, sv, q, tdq,
pt, tdpt, work, &fail);```
work must be a one-dimensional double array of length $\mathrm{min}\phantom{\rule{0.125em}{0ex}}\left({\mathbf{m}},{\mathbf{n}}\right)$; the iteration count (returned by f02wec in the argument iter) is not available from f08kbc.
Please note that the facility to return ${Q}^{\mathrm{T}}B$ is not provided so arguments $\mathbf{ncolb}$ and $\mathbf{b}$ are not required. Instead, f08kbc has an option to return the entire ${\mathbf{m}}×{\mathbf{m}}$ orthogonal matrix $Q$, referred to as ${\mathbf{u}}$ in its documentation, through its 8th argument.

### f02xec

Withdrawn at Mark 26.
Replaced by f08kpc.

#### Old Code

```nag_complex_svd(m, n, a, tda, ncolb, b, tdb, wantq, q, tdq, sv, wantp,
ph, tdph, &iter, e, &failinfo, &fail);```

#### New Code

```if (wantq) jobu = Nag_AllU; else jobu = Nag_NotU;
if (wantp) jobvt = Nag_AllVT; else jobvt = Nag_NotVT;
nag_zgesvd(Nag_RowMajor, jobu, jobvt, m, n, a, tda, sv, q, tdq,
ph, tdph, rwork, &fail);```
rwork must be a one-dimensional double array of length $\mathrm{min}\phantom{\rule{0.125em}{0ex}}\left({\mathbf{m}},{\mathbf{n}}\right)$; the iteration count (returned by f02xec in the argument iter) is not available from f08kpc.
Please note that the facility to return ${Q}^{\mathrm{H}}B$ is not provided so arguments ncolb and $\mathbf{b}$ are not required. Instead, f08kpc has an option to return the entire ${\mathbf{m}}*{\mathbf{m}}$ unitary matrix $Q$, referred to as ${\mathbf{u}}$ in its documentation, through its 8th argument.

## F03 – Determinants

### f03aec

Withdrawn at Mark 25.
Replaced by f07fdc and f03bfc.
```void f03aec_replacement(Integer n, double a[], Integer tda,
double p[], double *detf, Integer *dete, NagError *fail)
{
/* nag_dpotrf */
f07fdc(Nag_RowMajor, Nag_Upper, n, a, tda, fail);
/* nag_det_real_sym */
f03bfc(Nag_RowMajor, n, a, tda, detf, dete, fail);
/* p is not written to */
/* factorization in a will be different */
}```
f07fdc performs the Cholesky factorization and f03bfc calculates the determinant from the factored form.
Note: subsequent solution of linear systems using the Cholesky factorization performed by f07fdc should be performed using f07fec).

### f03afc

Withdrawn at Mark 25.
```void f03afc_replacement(Integer n, double a[], Integer tda,
Integer pivot[], double *detf, Integer *dete, NagError *fail)
{
/* nag_lapacklin_dgetrf */
f07adc(Nag_RowMajor, n, n, a, tda, pivot, fail);
/* nag_det_real_gen */
f03bac(Nag_RowMajor, n, a, tda, pivot, detf, dete, fail);
/* the factorization in a will be different */
/* the array pivot will be different */
}```
Note: subsequent solution of linear systems using the $LU$ factorization performed by f07adc should be performed using f07aec).

### f03ahc

Withdrawn at Mark 25.
Replaced by f07arc and f03bnc.
```void f03ahc_replacement(Integer n, Complex a[], Integer tda,
Integer pivot[], Complex *det, Integer *dete, NagError *fail)
{
Complex d={0,0};
Integer id[2]={0,0};
/* nag_lapacklin_zgetrf */
f07arc(Nag_RowMajor, n, n, a, tda, pivot, fail);
/* nag_det_complex_gen */
f03bnc(Nag_RowMajor, n, a, tda, pivot, &d, id, fail);
/* Bring real and imaginary parts to a common scale */
*dete = max(id[0],id[1]);
det->re = ldexp(d.re,id[0]-*dete);
det->im = ldexp(d.im,id[1]-*dete);
/* the factorization in a will be different */
}```
f07arc performs the $LU$ factorization and f03bnc calculates the determinant from the factored form.
Note: the details of the $LU$ factorization performed by f07arc differ from those perfomed by f03ahc; subsequent solution of linear systems using the $LU$ factorization performed by f07arc should be performed using f07asc. The determinant returned by f03bnc independently scales the real and imaginary parts whereas the determinant returned by f03ahc used a single scaling factor.

## F04 – Simultaneous Linear Equations

The factorization and solution of a positive definite linear system can be handled by calls to functions from Chapter F04.

Withdrawn at Mark 25.
Replaced by f04cac.
```void f04adc_replacement(Integer n, Integer nrhs,
Complex a[], Integer tda, const Complex b[], Integer tdb,
Complex x[], Integer tdx, NagError *fail)
{
Integer *ipiv;
double rcond, errbnd;

ipiv = NAG_ALLOC(n, Integer);
/* nag_blast_zge_copy */
f16tfc(Nag_RowMajor, Nag_NoTrans, n, nrhs, b, tdb, x, tdx, fail);
/* nag_linsys_complex_square_solve */
f04cac(Nag_RowMajor, n, nrhs, a, tda, ipiv, x,
tdx, &rcond, &errbnd, fail);
/* The factorization in a will be different */
/* Error codes will be different */
/* Condition number and error bounds are available to you */
NAG_FREE(ipiv);
}```

### f04agc

Withdrawn at Mark 25.
Replaced by f07fec.
It is assumed that the matrix has been factorized by a call to f07fdc rather than f03aec. The array p is no longer required.
```void f03aec_replacement(Integer n, double a[], Integer tda,
double p[], double *detf, Integer *dete, NagError *fail)
{
/* nag_lapacklin_dpotrf /*
f07fdc(Nag_RowMajor, Nag_Upper, n, a, tda, fail);
/* nag_det_real_sym */
f03bfc(Nag_RowMajor, n, a, tda, detf, dete, fail);
/* p is not used */
/* the factorization in a will be different */
}

void f04agc_replacement(Integer n, Integer nrhs, double a[],
Integer tda, double p[], const double b[], Integer tdb, double x[],
Integer tdx, NagError *fail)
{
/* nag_blast_dge_copy */
f16qfc(Nag_RowMajor, Nag_NoTrans, n, nrhs, b, tdb, x, tdx, fail);
/* nag_lapacklin_dpotrs */
f07fec(Nag_RowMajor, Nag_Upper, n, nrhs, a, tda, x, tdx, fail);
/* p is not used */
}```

### f04ajc

Withdrawn at Mark 25.
Replaced by f07aec.
It is assumed that the matrix has been factorized by a call to f07adc rather than f03afc.
```void f03afc_replacement(Integer n, double a[], Integer tda,
Integer pivot[], double *detf, Integer *dete, NagError *fail)
{
/* nag_lapacklin_dgetrf */
f07adc(Nag_RowMajor, n, n, a, tda, pivot, fail);
/* nag_det_real_gen */
f03bac(Nag_RowMajor, n, a, tda, pivot, detf, dete, fail);
/* the call to f03bac is not needed if you don't want determinants */
}

void f04ajc_replacement(Integer n, Integer nrhs, const double a[],
Integer tda, const Integer pivot[], double b[], Integer tdb,
NagError *fail)
{
/* nag_lapacklin_dgetrs */
f07aec(Nag_RowMajor, Nag_NoTrans, n, nrhs, a, tda, pivot, b, tdb, fail);
}```

### f04akc

Withdrawn at Mark 25.
Replaced by f07asc.
```void f03ahc_replacement(Integer n, Complex a[], Integer tda,
Integer pivot[], Complex *det, Integer *dete, NagError *fail)
{
Complex d={0,0};
Integer id[2]={0,0};
/* nag_lapacklin_zgetrf */
f07arc(Nag_RowMajor, n, n, a, tda, pivot, fail);
/* nag_det_complex_gen */
f03bnc(Nag_RowMajor, n, a, tda, pivot, &d, id, fail);
/* Bring real and imaginary parts to a common scale */
*dete = max(id[0],id[1]);
det->re = ldexp(d.re,id[0]-*dete);
det->im = ldexp(d.im,id[1]-*dete);
/* the factorization in a will be different */
}

void f04akc_replacement(Integer n, Integer nrhs, const Complex a[],
Integer tda, const Integer pivot[], Complex b[], Integer tdb,
NagError *fail)
{
/* nag_lapacklin_zgetrs */
f07asc(Nag_RowMajor, Nag_NoTrans, n, nrhs, a, tda, pivot, b, tdb, fail );
}```
It is assumed that the matrix has been factorized by a call to f07arc rather than f03ahc.

### f04arc

Withdrawn at Mark 25.
Replaced by f04bac.
```void f04arc_replacement(Integer n, double a[], Integer tda,
const double b[], double x[], NagError *fail)
{
Integer *ipiv;
double rcond, errbnd;

ipiv = NAG_ALLOC(n, Integer);
/* nag_blast_dge_copy */
f16qfc(Nag_RowMajor, Nag_NoTrans, n, 1, b, 1, x, 1, fail);
/* nag_linsys_real_square_solve */
f04bac(Nag_RowMajor, n, 1, a, tda, ipiv, x, 1,
&rcond, &errbnd, fail);
/* The factorization in a will be different */
/* Error codes will be different */
/* Condition number and error bounds are available to you */
NAG_FREE(ipiv);
}```

### f04awc

Withdrawn at Mark 25.
Replaced by f07fsc.
```void f01bnc_replacement(Integer n, Complex a[], Integer tda,
double p[], NagError *fail)
{
/* nag_lapacklin_zpotrf */
f07frc(Nag_RowMajor, Nag_Lower, n, a, tda, fail);
}

void f04awc_replacement(Integer n, Integer nrhs, const Complex a[],
Integer tda, const double p[], const Complex b[],
Integer tdb, Complex x[], Integer tdx, NagError *fail)
{
/* nag_blast_zge_copy */
f16tfc(Nag_RowMajor, Nag_NoTrans, n, nrhs, b, tdb, x, tdx, fail);
/* nag_lapacklin_zpotrs */
f07fsc(Nag_RowMajor, Nag_Lower, n, nrhs, a, tda, x, tdx, fail);
}```
Note that the preceding call to f01bnc has been replaced by f07frc.

## F06 – Linear Algebra Support Functions

The functions in Chapter F16 provide greater functionality than their corresponding functions in Chapter F06. The essential differences are:
1. The order argument. This provides the flexibility to operate on matrix data stored in row or column major order.
2. The addition of the fail argument to trap data errors. The f06 functions used to abort noisily.
3. The enumeration types and members use NAG_ as the prefix. This is to guard against accidental use of non-NAG enums.
4. Scale factors have been introduced in some functions. For example nag_dtrmv (f16pfc) has an extra argument, alpha which was not present in the corresponding old_dtrmv (f06pfc) function.

### f06pac

Withdrawn at Mark 23.
Replaced by f16pac.

### f06pbc

Withdrawn at Mark 23.
Replaced by f16pbc.

### f06pcc

Withdrawn at Mark 23.
Replaced by f16pcc.

### f06pdc

Withdrawn at Mark 23.
Replaced by f16pdc.

### f06pec

Withdrawn at Mark 23.
Replaced by f16pec.

### f06pfc

Withdrawn at Mark 23.
Replaced by f16pfc.

### f06pgc

Withdrawn at Mark 23.
Replaced by f16pgc.

### f06phc

Withdrawn at Mark 23.
Replaced by f16phc.

### f06pjc

Withdrawn at Mark 23.
Replaced by f16pjc.

### f06pkc

Withdrawn at Mark 23.
Replaced by f16pkc.

### f06plc

Withdrawn at Mark 23.
Replaced by f16plc.

### f06pmc

Withdrawn at Mark 23.
Replaced by f16pmc.

### f06ppc

Withdrawn at Mark 23.
Replaced by f16ppc.

### f06pqc

Withdrawn at Mark 23.
Replaced by f16pqc.

### f06prc

Withdrawn at Mark 23.
Replaced by f16prc.

### f06psc

Withdrawn at Mark 23.
Replaced by f16psc.

### f06sac

Withdrawn at Mark 23.
Replaced by f16sac.

### f06sbc

Withdrawn at Mark 23.
Replaced by f16sbc.

### f06scc

Withdrawn at Mark 23.
Replaced by f16scc.

### f06sdc

Withdrawn at Mark 23.
Replaced by f16sdc.

### f06sec

Withdrawn at Mark 23.
Replaced by f16sec.

### f06sfc

Withdrawn at Mark 23.
Replaced by f16sfc.

### f06sgc

Withdrawn at Mark 23.
Replaced by f16sgc.

### f06shc

Withdrawn at Mark 23.
Replaced by f16shc.

### f06sjc

Withdrawn at Mark 23.
Replaced by f16sjc.

### f06skc

Withdrawn at Mark 23.
Replaced by f16skc.

### f06slc

Withdrawn at Mark 23.
Replaced by f16slc.

### f06smc

Withdrawn at Mark 23.
Replaced by f16smc.

### f06snc

Withdrawn at Mark 23.
Replaced by f16smc.

### f06spc

Withdrawn at Mark 23.
Replaced by f16spc.

### f06sqc

Withdrawn at Mark 23.
Replaced by f16sqc.

### f06src

Withdrawn at Mark 23.
Replaced by f16src.

### f06ssc

Withdrawn at Mark 23.
Replaced by f16ssc.

### f06yac

Withdrawn at Mark 23.
Replaced by f16yac.

### f06ycc

Withdrawn at Mark 23.
Replaced by f16ycc.

### f06yfc

Withdrawn at Mark 23.
Replaced by f16yfc.

### f06yjc

Withdrawn at Mark 23.
Replaced by f16yjc.

### f06ypc

Withdrawn at Mark 23.
Replaced by f16ypc.

### f06yrc

Withdrawn at Mark 23.
Replaced by f16yrc.

### f06zac

Withdrawn at Mark 23.
Replaced by f16zac.

### f06zcc

Withdrawn at Mark 23.
Replaced by f16zcc.

### f06zfc

Withdrawn at Mark 23.
Replaced by f16zfc.

### f06zjc

Withdrawn at Mark 23.
Replaced by f16zjc.

### f06zpc

Withdrawn at Mark 23.
Replaced by f16zpc.

### f06zrc

Withdrawn at Mark 23.
Replaced by f16zrc.

### f06ztc

Withdrawn at Mark 23.
Replaced by f16ztc.

### f06zuc

Withdrawn at Mark 23.
Replaced by f16zuc.

### f06zwc

Withdrawn at Mark 23.
Replaced by f16zwc.

## F08 – Least Squares and Eigenvalue Problems (LAPACK)

For each of the deprecated functions listed below, the replacement function has an identical interface. This disguises algorithmic changes that improve performance at the cost of larger internal memory allocation.

### f08bec

Deprecated at Mark 27.
Replaced by f08bfc.

### f08bsc

Deprecated at Mark 27.
Replaced by f08btc.

### f08vac

Deprecated at Mark 27.
Replaced by f08vcc.

### f08vec

Deprecated at Mark 27.
Replaced by f08vgc.

### f08vnc

Deprecated at Mark 27.
Replaced by f08vqc.

### f08vsc

Deprecated at Mark 27.
Replaced by f08vuc.

### f08wac

Deprecated at Mark 27.
Replaced by f08wcc.

### f08wec

Deprecated at Mark 27.
Replaced by f08wfc.

### f08wnc

Deprecated at Mark 27.
Replaced by f08wqc.

### f08wsc

Deprecated at Mark 27.
Replaced by f08wtc.

### f08xac

Deprecated at Mark 27.
Replaced by f08xcc.

### f08xnc

Deprecated at Mark 27.
Replaced by f08xqc.

## G01 – Simple Calculations on Statistical Data

### g01aac

Withdrawn at Mark 26.
Replaced by g01atc.
Withdrawn because on output, additional information was needed to allow large datasets to be processed in blocks and the results combined through a call to g01auc. This information is returned in rcomm.

#### Old Code

```/* g01aac */
nag_stat_withdraw_summary_1var(n, x, wt, &nvalid, &xmean, &xsd, &xskew,
&xkurt,&xmin, &xmax, &wsum, &fail);```

#### New Code

```/* g01atc */
pn = 0;
nag_stat_summary_onevar(n, x, wt, &pn, &xmean, &xsd, &xskew, &xkurt,
&xmin, &xmax, rcomm, &fail);
nvalid = pn;
wtsum = rcomm[0];```

### g01cec

Withdrawn at Mark 24.
Replaced by g01fac.

#### Old Code

`x = nag_deviates_normal_dist(p, &fail);`

#### New Code

`x = nag_deviates_normal(Nag_LowerTail, p, &fail);`

## G02 – Correlation and Regression Analysis

### g02ewc

Withdrawn at Mark 25.
Replaced by g02efh (see monfun in g02efc).

#### Old Code

`nag_correg_(flag, var, val, &fail)`

#### New Code

`nag_correg_linregm_fit_stepwise_sample_monfun(flag, var, val, &fail)`
Note: it is unlikely that you will need to call this function directly. Rather it will be supplied as a function argument to g02efc when monitoring information is required.

### g02jacg02jbcg02jccg02jdcg02jec

Deprecated at Mark 27.
For each of the routines g02jac, g02jbc, g02jcc, g02jdc and g02jec there is not a direct one-to-one replacement, rather they have been replaced with a new suite of routines. This new suite allows a linear mixed effects model to be specified using a modelling language; giving a more natural way of specifying the model, allowing interaction terms to be specified and means that it is no longer necessary to create dummy variables when the model contains categorical variables.
The new suite of routines consists of:
• g22ybc used to describe the dataset of interest. Calling this function allows labels to be assign to variables, which can then be used when specifying the model.
• g22yac multiple calls to this routine are used to specify the fixed and random part of the model. The model is specified using strings and a modelling language, for example the string: ${V}_{1}+{V}_{2}+{V}_{1}\dots {V}_{1}$ would specify a model with the main effects of variables ${V}_{1}$ and ${V}_{2}$ and the interaction term between them. The modelling language is explained in detail in Section 3 in g22yac.
• g02jfc pre-processes the dataset prior to calling the model fitting routine.
• g02jhc fits the model and returns the parameter estimates etc.
In addition to the routines listed above, the following can also be used:
• g02jgc combines information returned by multiple calls to g02jfc. This is useful for large problems as it allows the dataset to be split up into smaller subsets of data, pre-processing each one separately before combining them into a single set of information as if g02jfc had been called on the full dataset.
• g22ydc can be used to obtain labels for the parameter estimates returned by g02jhc.
• g22zmc can be used to set any optional arguments.
• g22znc can be used to return the value of any optional arguments.
By default, the model fitting routine, g02jhc, fits the linear mixed effects model using restricted maximum likelihood (REML). In order to fit the model using maximum likelihood (ML) you need to call the optional argument setting routine, g22zmc with optstr set to ${\mathbf{Likelihood}}=\mathrm{ML}$, between the call to g02jfc and the call to g02jhc.

## G05 – Random Number Generators

### g05cac

Withdrawn at Mark 24.
Replaced by g05sac.

#### Old Code

```/*  g05cac */
for (i = 0; i < n; i++)
x[i] = nag_random_continuous_uniform();```

#### New Code

```/*  g05sac */
nag_rand_dist_uniform01(n,state,x,&fail);```
The Integer array state in the call to g05sac contains information on the base generator being used. This array must have been initialized prior to calling g05sac with a call to either g05kfc or g05kgc. The required length of the array state will depend on the base generator chosen during initialization. Due to changes in the underlying code the sequence of values produced by g05sac is likely to be different from those produced by g05cac.

### g05cbc

Withdrawn at Mark 24.
Replaced by g05kfc.

#### Old Code

```/* g05cbc */
nag_random_init_repeatable(i);```

#### New Code

```lseed = 1;
seed[0] = i;
genid = Nag_Basic;
subid = 1;

/* g05kfc */
nag_rand_init_repeat(genid,subid,seed,lseed,state,&lstate,&fail);```
The Integer array state in the call to g05kfc contains information on the base generator being used. The base generator is chosen via the integer arguments genid and subid. The required length of the array state depends on the base generator chosen. Due to changes in the underlying code a sequence of values produced by using a random number generator initialized via a call to g05kfc is likely to be different from a sequence produced by a generator initialized by g05cbc, even if the same value for i is used.
Note: it may still be necessary to call g05cbc rather than the replacement function g05kfc when using d01xbc. See Section 10 in d01xbc for additional information.

### g05ccc

Withdrawn at Mark 24.
Replaced by g05kgc.

#### Old Code

```/* g05ccc */
nag_random_init_nonrepeatable();```

#### New Code

```genid = Nag_Basic;
subid = 1;

/* g05kgc */
nag_rand_init_nonrepeat(genid,subid,state,&lstate,&fail);```
The Integer array state in the call to g05kgc contains information on the base generator being used. The base generator is chosen via the integer arguments genid and subid. The required length of the array state depends on the base generator chosen.
Note: it may still be necessary to call g05ccc rather than the replacement function g05kgc when using d01xbc. See Section 10 in d01xbc for additional information.

### g05cfc

Withdrawn at Mark 24.
There is no replacement for this function.

#### Old Code

```/* g05cfc */
nag_save_random_state(istate,xstate);```

#### New Code

```for (i = 0; i < lstate; i++)
istate[i] = state[i];```
The state of the base generator for the group of functions g05kfc, g05kgc, g05khc, g05kjc, g05ncc, g05ndc, g05pdcg05pzc, g05rccg05rzc, g05s and g05t can be saved by simply creating a local copy of the array state. The first element of the state array contains the number of elements that are used by the random number generating functions, therefore either this number of elements can be copied, or the whole array (as defined in the calling program).

### g05cgc

Withdrawn at Mark 24.
There is no replacement for this function.

#### Old Code

```/* g05cgc */
nag_restore_random_state(istate,xstate,&fail);```

#### New Code

```for (i = 0; i < lstate; i++)
state[i] = istate[i];```
The state of the base generator for the group of functions g05kfc, g05kgc, g05khc, g05kjc, g05ncc, g05ndc, g05pdcg05pzc, g05rccg05rzc, g05s and g05t can be restored by simply copying back the previously saved copy of the state array. The first element of the state array contains the number of elements that are used by the random number generating functions, therefore either this number of elements can be copied, or the whole array (as defined in the calling program).

### g05dac

Withdrawn at Mark 24.
Replaced by g05sqc.

#### Old Code

```for (i = 0; i < n; i++)
/* g05dac */
x[i] =  nag_random_continuous_uniform_ab(aa,bb);```

#### New Code

```a = (aa < bb) ? aa : bb;
b = (aa < bb) ? bb : aa;

/* g05sqc */
nag_rand_dist_uniform(n,a,b,state,x,&fail);```
The old function g05dac returns a single variate at a time, whereas the new function g05sqc returns a vector of n values in one go. In g05sqc the minimum value must be held in the argument a and the maximum in argument b, therefore ${\mathbf{a}}<{\mathbf{b}}$. This was not the case for the equivalent arguments in g05dac.
The Integer array state in the call to g05sqc contains information on the base generator being used. This array must have been initialized prior to calling g05sqc with a call to either g05kfc or g05kgc. The required length of the array state will depend on the base generator chosen during initialization. Due to changes in the underlying code the sequence of values produced by g05sqc is likely to be different from those produced by g05dac.

### g05dbc

Withdrawn at Mark 24.
Replaced by g05sfc.

#### Old Code

```for (i = 0; i < n; i++)
/* g05dbc */
x[i] = nag_random_exp(aa);```

#### New Code

```a = fabs(aa);
/* g05sfc */
nag_rand_dist_exp(n,a,state,x,&fail);```
The old function g05dbc returns a single variate at a time, whereas the new function g05sfc returns a vector of n values in one go. In g05sfc argument a must be non-negative, this was not the case for the equivalent argument in g05dbc.
The Integer array state in the call to g05sfc contains information on the base generator being used. This array must have been initialized prior to calling g05sfc with a call to either g05kfc or g05kgc. The required length of the array state will depend on the base generator chosen during initialization. Due to changes in the underlying code the sequence of values produced by g05sfc is likely to be different from those produced by g05dbc.

### g05ddc

Withdrawn at Mark 24.
Replaced by g05skc.

#### Old Code

```for (i = 0; i < n; i++)
/* g05ddc */
x[i] = nag_random_normal(xmu,sd);```

#### New Code

```/* g05skc */
nag_rand_dist_normal(n,xmu,var,state,x,&fail);```
The old function g05ddc returns a single variate at a time, whereas the new function g05skc returns a vector of n values in one go. g05skc expects the variance of the Normal distribution (argument var), compared to g05ddc which expected the standard deviation.
The Integer array state in the call to g05skc contains information on the base generator being used. This array must have been initialized prior to calling g05skc with a call to either g05kfc or g05kgc. The required length of the array state will depend on the base generator chosen during initialization. Due to changes in the underlying code the sequence of values produced by g05skc is likely to be different from those produced by g05ddc.

### g05dyc

Withdrawn at Mark 24.
Replaced by g05tlc.

#### Old Code

```for (i = 0; i < n; i++)
/* g05dyc */
x[i] = nag_random_discrete_uniform(aa,bb);```

#### New Code

```a = (aa < bb) ? aa : bb;
b = (aa < bb) ? bb : aa;
/* g05tlc */
nag_rand_int_uniform(n,a,b,state,x,&fail);```
The old function g05dyc returns a single variate at a time, whereas the new function g05tlc returns a vector of n values in one go. In g05tlc the minimum value must be held in the argument a and the maximum in argument b, therefore ${\mathbf{a}}\le {\mathbf{b}}$. This was not the case for the equivalent arguments in g05dyc.
The Integer array state in the call to g05tlc contains information on the base generator being used. This array must have been initialized prior to calling g05tlc with a call to either g05kfc or g05kgc. The required length of the array state will depend on the base generator chosen during initialization. Due to changes in the underlying code the sequence of values produced by g05tlc is likely to be different from those produced by g05dyc.

### g05eac

Withdrawn at Mark 24.
Replaced by g05rzc.

#### Old Code

```/* g05eac */
nag_ref_vec_multi_normal(a,m,c,tdc,eps,&r,&fail);```

#### New Code

```order = Nag_RowMajor;
mode = Nag_InitializeReference;
lr = m * (m + 1) + 1;
r = NAG_ALLOC(lr,double);

/* g05rzc */
nag_rand_multivar_normal(order,mode,n,m,a,c,tdc,r,lr,
state,x,pdx,&fail);```
The old function g05eac sets up a reference vector for use by g05ezc. The functionality of both these functions has been combined into the single new function g05rzc. Setting ${\mathbf{mode}}=\mathrm{Nag_InitializeReference}$ in the call to g05rzc only sets up the double reference vector r and hence mimics the functionality of g05eac.
The length of the double reference vector, r, in g05rzc must be at least ${\mathbf{m}}×\left({\mathbf{m}}+1\right)+1$. In contrast to the equivalent argument in g05eac, this array must be allocated in the calling program.

### g05ecc

Withdrawn at Mark 24.
Replaced by g05tjc.

#### Old Code

```/* g05ecc */
nag_ref_vec_poisson(t,&r,&fail);
for (i = 0; i < n; i++)
/* g05eyc */
x[i] = nag_return_discrete(r);```

#### New Code

```mode = Nag_InitializeAndGenerate;
lr = 30 + (Integer) (20 * sqrt(t) + t);
r = NAG_ALLOC(lr,double);

/* g05tjc */
nag_rand_int_poisson(mode,n,t,r,lr,state,x,&fail);```
The old function g05ecc sets up a reference vector for use by g05eyc. The replacement function g05tjc is now used to both set up a reference vector and generate the required variates. Setting ${\mathbf{mode}}=\mathrm{Nag_InitializeReference}$ in the call to g05tjc sets up the double reference vector r and hence mimics the functionality of g05ecc. Setting ${\mathbf{mode}}=\mathrm{Nag_GenerateFromReference}$ generates a series of variates from a reference vector mimicking the functionality of g05eyc for this particular distribution. Setting ${\mathbf{mode}}=\mathrm{Nag_InitializeAndGenerate}$ initializes the reference vector and generates the variates in one go.
The function g05eyc returns a single variate at a time, whereas the new function g05tjc returns a vector of n values in one go.
The length of the double reference vector, r, in g05tjc, must be allocated in the calling program in contrast to the equivalent argument in g05ecc, see the documentation for more details.
The Integer array state in the call to g05tjc contains information on the base generator being used. This array must have been initialized prior to calling g05tjc with a call to either g05kfc or g05kgc. The required length of the array state will depend on the base generator chosen during initialization. Due to changes in the underlying code the sequence of values produced by g05tjc is likely to be different from those produced by a combination of g05ecc and g05eyc.

### g05edc

Withdrawn at Mark 24.
Replaced by g05tac.

#### Old Code

```/* g05edc */
nag_ref_vec_binomial(m,p,&r,&fail);
for (i = 0; i < n; i++)
/* g05eyc */
x[i] = nag_return_discrete(r);```

#### New Code

```mode = Nag_InitializeAndGenerate;
lr = 22 + 20 * ((Integer) sqrt(m * p * (1 - p)));
r = NAG_ALLOC(lr,double);

/* g05tac */
nag_rand_int_binomial(mode,n,m,p,r,lr,state,x,&fail);```
The old function g05edc sets up a reference vector for use by g05eyc. The replacement function g05tac is now used to both set up a reference vector and generate the required variates. Setting ${\mathbf{mode}}=\mathrm{Nag_InitializeReference}$ in the call to g05tac sets up the double reference vector r and hence mimics the functionality of g05edc. Setting ${\mathbf{mode}}=\mathrm{Nag_GenerateFromReference}$ generates a series of variates from a reference vector mimicking the functionality of g05eyc for this particular distribution. Setting ${\mathbf{mode}}=\mathrm{Nag_InitializeAndGenerate}$ initializes the reference vector and generates the variates in one go.
The function g05eyc returns a single variate at a time, whereas the new function g05tac returns a vector of n values in one go.
The length of the double reference vector, r, in g05tac, needs to be a different length from the equivalent argument in g05edc, see the documentation for more details.
The Integer array state in the call to g05tac contains information on the base generator being used. This array must have been initialized prior to calling g05tac with a call to either g05kfc or g05kgc. The required length of the array state will depend on the base generator chosen during initialization. Due to changes in the underlying code the sequence of values produced by g05tac is likely to be different from those produced by a combination of g05edc and g05eyc.

### g05ehc

Withdrawn at Mark 24.
Replaced by g05ncc.

#### Old Code

```/* g05ehc */
nag_ran_permut_vec(index,n,&fail);```

#### New Code

```/* g05ncc */
nag_rand_permute(index,n,state,&fail);```
The Integer array state in the call to g05ncc contains information on the base generator being used. This array must have been initialized prior to calling g05ncc with a call to either g05kfc or g05kgc. The required length of the array state will depend on the base generator chosen during initialization. Due to changes in the underlying code the sequence of values produced by g05ncc is likely to be different from those produced by g05ehc.

### g05ejc

Withdrawn at Mark 24.
Replaced by g05ndc.

#### Old Code

```/* g05ejc */
nag_ran_sample_vec(ia,n,iz,m,&fail);```

#### New Code

```/* g05ndc */
nag_rand_sample(ia,n,iz,m,state,&fail);```
The Integer array state in the call to g05ndc contains information on the base generator being used. This array must have been initialized prior to calling g05ndc with a call to either g05kfc or g05kgc. The required length of the array state will depend on the base generator chosen during initialization. Due to changes in the underlying code the sequence of values produced by g05ndc is likely to be different from those produced by g05ejc.

### g05exc

Withdrawn at Mark 24.
Replaced by g05tdc.

#### Old Code

```/* g05exc */
nag_ref_vec_discrete_pdf_cdf(p,np,sizep,distf,&r,&fail);
for (i = 0; i < n; i++)
/* g05eyc */
x[i] = nag_return_discrete(r);```

#### New Code

```mode = Nag_InitializeAndGenerate;
lr = 10 + (Integer) (1.4 * np);
r = NAG_ALLOC(lr,double);

/* g05tdc */
nag_rand_int_general(mode,n,p,np,sizep,distf,r,lr,state,x,&fail);```
The old function g05exc sets up a reference vector for use by g05eyc. The replacement function g05tdc is now used to both set up a reference vector and generate the required variates. Setting ${\mathbf{mode}}=\mathrm{Nag_InitializeReference}$ in the call to g05tdc sets up the double reference vector r and hence mimics the functionality of g05exc. Setting ${\mathbf{mode}}=\mathrm{Nag_GenerateFromReference}$ generates a series of variates from a reference vector mimicking the functionality of g05eyc for this particular distribution. Setting ${\mathbf{mode}}=\mathrm{Nag_InitializeAndGenerate}$ initializes the reference vector and generates the variates in one go.
The function g05eyc returns a single variate at a time, whereas the new function g05tdc returns a vector of n values in one go.
The length of the double reference vector, r, in g05tdc must be allocated in the calling program in contrast to the equivalent argument in g05exc, see the documentation for more details.
The Integer array state in the call to g05tdc contains information on the base generator being used. This array must have been initialized prior to calling g05tdc with a call to either g05kfc or g05kgc. The required length of the array state will depend on the base generator chosen during initialization. Due to changes in the underlying code the sequence of values produced by g05tdc is likely to be different from those produced by a combination of g05exc and g05eyc.

### g05eyc

Withdrawn at Mark 24.
Replaced by g05tdc.
There is no direct replacement function for g05eyc.
g05eyc is designed to generate random draws from a distribution defined by a reference vector. These reference vectors are created by other functions in Chapter G05, for example g05ecc, which have themselves been superseded. In order to replace a call to g05eyc you must identify which NAG function generated the reference vector being used and look up its replacement. For example, to replace a call to g05eyc preceded by a call to g05exc, as in:
```/* g05exc */
nag_ref_vec_discrete_pdf_cdf(p,np,sizep,distf,&r,&fail);
/* g05eyc */
x = nag_return_discrete(r);```
you would need to look at the replacement function for g05exc.

### g05ezc

Withdrawn at Mark 24.
Replaced by g05rzc.

#### Old Code

```#define x(i,j) x[(i*pdx + j)]
/* g05eac */
nag_ref_vec_multi_normal(a,m,c,tdc,eps,&r,&fail);
for (i = 0; i < n; i++) {
/* g05ezc */
nag_return_multi_normal(z,r);
for (j = 0; j < m; j++)
x(i,j) = z[j];
}```

#### New Code

```order = Nag_RowMajor;
mode = Nag_InitializeAndGenerate;
lr = m * (m + 1) + 1;
r = NAG_ALLOC(lr,double);
/* g05rzc */
nag_rand_multivar_normal(order,mode,n,m,a,c,tdc,r,lr,
state,x,pdx,&fail);```
The old function g05eac sets up a reference vector for use by g05ezc. The functionality of both these functions has been combined into the single new function g05rzc. Setting ${\mathbf{mode}}=\mathrm{Nag_InitializeAndGenerate}$ in the call to g05rzc sets up the double reference vector r and generates the draws from the multivariate Normal distribution in one go.
The old function g05ezc returns a single (m-dimensional vector) draw from the multivariate Normal distribution at a time, whereas the new function g05rzc returns an n by m matrix of n draws in one go.
The Integer array state in the call to g05rzc contains information on the base generator being used. This array must have been initialized prior to calling g05rzc with a call to either g05kfc or g05kgc. The required length of the array state will depend on the base generator chosen during initialization. Due to changes in the underlying code the sequence of values produced by g05rzc is likely to be different from those produced by g05ezc.

### g05fec

Withdrawn at Mark 24.
Replaced by g05sbc.

#### Old Code

```/* g05fec */
nag_random_beta(a,b,n,x,&fail);```

#### New Code

```/* g05sbc */
nag_rand_dist_beta(n,a,b,state,x,&fail);```
The Integer array state in the call to g05sbc contains information on the base generator being used. This array must have been initialized prior to calling g05sbc with a call to either g05kfc or g05kgc. The required length of the array state will depend on the base generator chosen during initialization. Due to changes in the underlying code the sequence of values produced by g05sbc is likely to be different from those produced by g05fec.

### g05ffc

Withdrawn at Mark 24.
Replaced by g05sjc.

#### Old Code

```/* g05ffc */
nag_random_gamma(a,b,n,x,&fail);```

#### New Code

```/* g05sjc */
nag_rand_dist_gamma(n,a,b,state,x,&fail);```
The Integer array state in the call to g05sjc contains information on the base generator being used. This array must have been initialized prior to calling g05sjc with a call to either g05kfc or g05kgc. The required length of the array state will depend on the base generator chosen during initialization. Due to changes in the underlying code the sequence of values produced by g05sjc is likely to be different from those produced by g05ffc.

### g05hac

Withdrawn at Mark 24.
Replaced by g05phc.

#### Old Code

```/* g05hac */
nag_arma_time_series(start,p,q,phi,theta,mean,vara,n,w,ref,&fail);```

#### New Code

```mode = (start == Nag_TRUE) ? Nag_InitializeAndGenerate :
Nag_GenerateFromReference;
lr = (p > q + 1) ? p : q + 1;
lr += p + q + 6;
r = NAG_ALLOC(lr,double);

/* g05phc */
nag_rand_times_arma(mode,n,mean,p,phi,q,theta,vara,r,lr,state,&var,x,&fail);```
The Integer array state in the call to g05phc contains information on the base generator being used. This array must have been initialized prior to calling g05phc with a call to either g05kfc or g05kgc. The required length of the array state will depend on the base generator chosen during initialization. Due to changes in the underlying code the sequence of values produced by g05phc is likely to be different from those produced by g05hac.

### g05hkc

Withdrawn at Mark 24.
Replaced by g05pdc.

#### Old Code

```/* g05hkc */
nag_rand_withdraw_times_garch_asym1(num,p,q,theta,gamma,ht,et,fcall,rvec,&fail);```

#### New Code

```dist = Nag_NormalDistn;
df = 0;
bfcall = (fcall == Nag_Garch_Fcall_True) ? Nag_TRUE : Nag_FALSE;
lr = 2 * (p + q + 2);
r = NAG_ALLOC(lr,double);

/* g05pdc */
nag_rand_times_garch_asym1(dist,num,p,q,theta,gamma,df,ht,et,bfcall,r,lr,
state,&fail);```
The Integer array state in the call to g05pdc contains information on the base generator being used. This array must have been initialized prior to calling g05pdc with a call to either g05kfc or g05kgc. The required length of the array state will depend on the base generator chosen during initialization. Due to changes in the underlying code the sequence of values produced by g05pdc is likely to be different from those produced by g05hkc.

### g05hlc

Withdrawn at Mark 24.
Replaced by g05pec.

#### Old Code

```/* g05hlc */
nag_rand_withdraw_times_garch_asym2(num,p,q,theta,gamma,ht,et,fcall,rvec,&fail);```

#### New Code

```dist = Nag_NormalDistn;
df = 0;
bfcall = (fcall == Nag_Garch_Fcall_True) ? Nag_TRUE : Nag_FALSE;
lr = 2 * (p + q + 2);
r = NAG_ALLOC(lr,double);

/* g05pec */
nag_rand_times_garch_asym2(dist,num,p,q,theta,gamma,df,ht,et,bfcall,r,lr,
state,&fail);```
The Integer array state in the call to g05pec contains information on the base generator being used. This array must have been initialized prior to calling g05pec with a call to either g05kfc or g05kgc. The required length of the array state will depend on the base generator chosen during initialization. Due to changes in the underlying code the sequence of values produced by g05pec is likely to be different from those produced by g05hlc.

### g05hmc

Withdrawn at Mark 24.
Replaced by g05pfc.

#### Old Code

```/* g05hmc */
nag_rand_withdraw_times_garch_gjr(num,p,q,theta,gamma,ht,et,fcall,rvec,&fail);```

#### New Code

```dist = Nag_NormalDistn;
df = 0;
bfcall = (fcall == Nag_Garch_Fcall_True) ? Nag_TRUE : Nag_FALSE;
lr = 2 * (p + q + 2);
r = NAG_ALLOC(lr,double);

/* g05pfc */
nag_rand_times_garch_gjr(dist,num,p,q,theta,gamma,df,ht,et,bfcall,r,lr,
state,&fail);```
The Integer array state in the call to g05pfc contains information on the base generator being used. This array must have been initialized prior to calling g05pfc with a call to either g05kfc or g05kgc. The required length of the array state will depend on the base generator chosen during initialization. Due to changes in the underlying code the sequence of values produced by g05pfc is likely to be different from those produced by g05hmc.

### g05kac

Withdrawn at Mark 24.
Replaced by g05sac.

#### Old Code

```for (i = 0; i < n; i++)
/* g05kac */
x[i] = nag_rand_withdraw_dist_uniform01(igen,iseed);```

#### New Code

```/* g05sac */
nag_rand_dist_uniform01(n,state,x,&fail);```
The old function g05kac returns a single variate at a time, whereas the new function g05sac returns a vector of n values in one go.
The Integer array state in the call to g05sac contains information on the base generator being used. This array must have been initialized prior to calling g05sac with a call to either g05kfc or g05kgc. The required length of the array state will depend on the base generator chosen during initialization.

### g05kbc

Withdrawn at Mark 24.
Replaced by g05kfc.

#### Old Code

```/* g05kbc */
nag_rand_withdraw_init_repeat(&igen,iseed);```

#### New Code

```if (igen == 0) {
genid = Nag_Basic;
subid = 1;
} else if (igen >= 1) {
genid = Nag_WichmannHill_I;
subid = igen;
}

/* g05kfc */
nag_rand_init_repeat(genid,subid,iseed,lseed,state,&lstate,&fail);```

### g05kcc

Withdrawn at Mark 24.
Replaced by g05kgc.

#### Old Code

```/* g05kcc */
nag_rand_withdraw_init_nonrepeat(&igen,iseed);```

#### New Code

```if (igen == 0) {
genid = Nag_Basic;
subid = 1;
} else if (igen >= 1) {
genid = Nag_WichmannHill_I;
subid = igen;
}

/* g05kgc */
nag_rand_init_nonrepeat(genid,subid,state,&lstate,&fail);```

### g05kec

Withdrawn at Mark 24.
Replaced by g05tbc.

#### Old Code

```for (i = 0; i < n; i++)
/* g05kec */
x[i] = nag_rand_withdraw_logical(p,igen,iseed,&fail);```

#### New Code

```/* g05tbc */
nag_rand_logical(n,p,state,x,&fail);```
The old function g05kec returns a single variate at a time, whereas the new function g05tbc returns a vector of n values in one go.
The Integer array state in the call to g05tbc contains information on the base generator being used. This array must have been initialized prior to calling g05tbc with a call to either g05kfc or g05kgc. The required length of the array state will depend on the base generator chosen during initialization.

### g05lac

Withdrawn at Mark 24.
Replaced by g05skc.

#### Old Code

```/* g05lac */
nag_rand_withdraw_dist_normal(xmu,var,n,x,igen,iseed,&fail);```

#### New Code

```/* g05skc */
nag_rand_dist_normal(n,xmu,var,state,x,&fail);```
The Integer array state in the call to g05skc contains information on the base generator being used. This array must have been initialized prior to calling g05skc with a call to either g05kfc or g05kgc. The required length of the array state will depend on the base generator chosen during initialization.

### g05lbc

Withdrawn at Mark 24.
Replaced by g05snc.

#### Old Code

```/* g05lbc */
nag_rand_withdraw_dist_students_t(df,n,x,igen,iseed,&fail);```

#### New Code

```/* g05snc */
nag_rand_dist_students_t(n,df,state,x,&fail);```
The Integer array state in the call to g05snc contains information on the base generator being used. This array must have been initialized prior to calling g05snc with a call to either g05kfc or g05kgc. The required length of the array state will depend on the base generator chosen during initialization.

### g05lcc

Withdrawn at Mark 24.
Replaced by g05sdc.

#### Old Code

```/* g05lcc */
nag_rand_withdraw_dist_chisq(df,n,x,igen,iseed,&fail);```

#### New Code

```/* g05sdc */
nag_rand_dist_chisq(n,df,state,x,&fail);```
The Integer array state in the call to g05sdc contains information on the base generator being used. This array must have been initialized prior to calling g05sdc with a call to either g05kfc or g05kgc. The required length of the array state will depend on the base generator chosen during initialization.

### g05ldc

Withdrawn at Mark 24.
Replaced by g05shc.

#### Old Code

```/* g05ldc */
nag_rand_withdraw_dist_f(df1,df2,n,x,igen,iseed,&fail);```

#### New Code

```/* g05shc */
nag_rand_dist_f(n,df1,df2,state,x,&fail);```
The Integer array state in the call to g05shc contains information on the base generator being used. This array must have been initialized prior to calling g05shc with a call to either g05kfc or g05kgc. The required length of the array state will depend on the base generator chosen during initialization.

### g05lec

Withdrawn at Mark 24.
Replaced by g05sbc.

#### Old Code

```/* g05lec */
nag_rand_withdraw_dist_beta(a,b,n,x,igen,iseed,&fail);```

#### New Code

```/* g05sbc */
nag_rand_dist_beta(n,a,b,state,x,&fail);```
The Integer array state in the call to g05sbc contains information on the base generator being used. This array must have been initialized prior to calling g05sbc with a call to either g05kfc or g05kgc. The required length of the array state will depend on the base generator chosen during initialization.

### g05lfc

Withdrawn at Mark 24.
Replaced by g05sjc.

#### Old Code

```/* g05lfc */
nag_rand_withdraw_dist_gamma(a,b,n,x,igen,iseed,&fail);```

#### New Code

```/* g05sjc */
nag_rand_dist_gamma(n,a,b,state,x,&fail);```
The Integer array state in the call to g05sjc contains information on the base generator being used. This array must have been initialized prior to calling g05sjc with a call to either g05kfc or g05kgc. The required length of the array state will depend on the base generator chosen during initialization.

### g05lgc

Withdrawn at Mark 24.
Replaced by g05sqc.

#### Old Code

```/* g05lgc */
nag_rand_withdraw_dist_uniform(a,b,n,x,igen,iseed,&fail);```

#### New Code

```/* g05sqc */
nag_rand_dist_uniform(n,a,b,state,x,&fail);```
The Integer array state in the call to g05sqc contains information on the base generator being used. This array must have been initialized prior to calling g05sqc with a call to either g05kfc or g05kgc. The required length of the array state will depend on the base generator chosen during initialization.

### g05lhc

Withdrawn at Mark 24.
Replaced by g05spc.

#### Old Code

```/* g05lhc */
nag_rand_withdraw_dist_triangular(xmin,xmax,xmed,n,x,igen,iseed,&fail);```

#### New Code

```/* g05spc */
nag_rand_dist_triangular(n,xmin,xmed,xmax,state,x,&fail);```
The Integer array state in the call to g05spc contains information on the base generator being used. This array must have been initialized prior to calling g05spc with a call to either g05kfc or g05kgc. The required length of the array state will depend on the base generator chosen during initialization.

### g05ljc

Withdrawn at Mark 24.
Replaced by g05sfc.

#### Old Code

```/* g05ljc */
nag_rand_withdraw_dist_exp(a,n,x,igen,iseed,&fail);```

#### New Code

```/* g05sfc */
nag_rand_dist_exp(n,a,state,x,&fail);```
The Integer array state in the call to g05sfc contains information on the base generator being used. This array must have been initialized prior to calling g05sfc with a call to either g05kfc or g05kgc. The required length of the array state will depend on the base generator chosen during initialization.

### g05lkc

Withdrawn at Mark 24.
Replaced by g05smc.

#### Old Code

```/* g05lkc */
nag_rand_withdraw_dist_lognormal(xmu,var,n,x,igen,iseed,&fail);```

#### New Code

```/* g05smc */
nag_rand_dist_lognormal(n,xmu,var,state,x,&fail);```
The Integer array state in the call to g05smc contains information on the base generator being used. This array must have been initialized prior to calling g05smc with a call to either g05kfc or g05kgc. The required length of the array state will depend on the base generator chosen during initialization.

### g05llc

Withdrawn at Mark 24.
Replaced by g05scc.

#### Old Code

```/* g05llc */
nag_rand_withdraw_dist_cauchy(xmed,semiqr,n,x,igen,iseed,&fail);```

#### New Code

```/* g05scc */
nag_rand_dist_cauchy(n,xmed,semiqr,state,x,&fail);```
The Integer array state in the call to g05scc contains information on the base generator being used. This array must have been initialized prior to calling g05scc with a call to either g05kfc or g05kgc. The required length of the array state will depend on the base generator chosen during initialization.

### g05lmc

Withdrawn at Mark 24.
Replaced by g05ssc.

#### Old Code

```/* g05lmc */
nag_rand_withdraw_dist_weibull(a,b,n,x,igen,iseed,&fail);```

#### New Code

```/* g05ssc */
nag_rand_dist_weibull(n,a,b,state,x,&fail);```
The Integer array state in the call to g05ssc contains information on the base generator being used. This array must have been initialized prior to calling g05ssc with a call to either g05kfc or g05kgc. The required length of the array state will depend on the base generator chosen during initialization.

### g05lnc

Withdrawn at Mark 24.
Replaced by g05slc.

#### Old Code

```/* g05lnc */
nag_rand_withdraw_dist_logistic(a,b,n,x,igen,iseed,&fail);```

#### New Code

```/* g05slc */
nag_rand_dist_logistic(n,a,b,state,x,&fail);```
The Integer array state in the call to g05slc contains information on the base generator being used. This array must have been initialized prior to calling g05slc with a call to either g05kfc or g05kgc. The required length of the array state will depend on the base generator chosen during initialization.

### g05lpc

Withdrawn at Mark 24.
Replaced by g05src.

#### Old Code

```/* g05lpc */
nag_rand_withdraw_dist_vonmises(vk,n,x,igen,iseed,&fail);```

#### New Code

```/* g05src */
nag_rand_dist_vonmises(n,vk,state,x,&fail);```
The Integer array state in the call to g05src contains information on the base generator being used. This array must have been initialized prior to calling g05src with a call to either g05kfc or g05kgc. The required length of the array state will depend on the base generator chosen during initialization.

### g05lqc

Withdrawn at Mark 24.
Replaced by g05sgc.

#### Old Code

```/* g05lqc */
nag_rand_withdraw_dist_expmix(nmix,a,wgt,n,x,igen,iseed,&fail);```

#### New Code

```/* g05sgc */
nag_rand_dist_expmix(n,nmix,a,wgt,state,x,&fail);```
The Integer array state in the call to g05sgc contains information on the base generator being used. This array must have been initialized prior to calling g05sgc with a call to either g05kfc or g05kgc. The required length of the array state will depend on the base generator chosen during initialization.

### g05lxc

Withdrawn at Mark 24.
Replaced by g05ryc.

#### Old Code

```/* g05lxc */
nag_rand_withdraw_multivar_students_t(order,mode,df,m,xmu,c,pdc,n,x,pdx,
igen,iseed,r,lr,&fail);```

#### New Code

```if (mode == 0) {
emode = Nag_InitializeAndGenerate;
} else if (mode == 1) {
emode = Nag_InitializeReference;
} else if (mode == 2) {
emode = Nag_GenerateFromReference;
}
lr = m * (m + 1) + 2;
r = NAG_ALLOC(lr,double);

/* g05ryc */
nag_rand_multivar_students_t(order,emode,n,df,m,xmu,c,pdc,r,lr,
state,x,pdx,&fail);```
The Integer array state in the call to g05ryc contains information on the base generator being used. This array must have been initialized prior to calling g05ryc with a call to either g05kfc or g05kgc. The required length of the array state will depend on the base generator chosen during initialization.

### g05lyc

Withdrawn at Mark 24.
Replaced by g05rzc.

#### Old Code

```/* g05lyc */
nag_rand_withdraw_multivar_normal(order,mode,m,xmu,c,pdc,n,x,pdx,igen,
iseed,r,lr,&fail);```

#### New Code

```if (mode == 0) {
emode = Nag_InitializeAndGenerate;
} else if (mode == 1) {
emode = Nag_InitializeReference;
} else if (mode == 2) {
emode = Nag_GenerateFromReference;
}
lr = m * (m + 1) + 1;
r = NAG_ALLOC(lr,double);

/* g05rzc */
nag_rand_multivar_normal(order,emode,n,m,xmu,c,pdc,r,lr,
state,x,pdx,&fail);```
The Integer array state in the call to g05rzc contains information on the base generator being used. This array must have been initialized prior to calling g05rzc with a call to either g05kfc or g05kgc. The required length of the array state will depend on the base generator chosen during initialization.

### g05lzc

Withdrawn at Mark 24.
Replaced by g05rzc.

#### Old Code

```/* g05lzc */
nag_rand_withdraw_multivar_normal_svec(order,mode,m,xmu,c,pdc,x,igen,iseed,r,&fail);```

#### New Code

```if (mode == 0) {
emode = Nag_InitializeAndGenerate;
} else if (mode == 1) {
emode = Nag_InitializeReference;
} else if (mode == 2) {
emode = Nag_GenerateFromReference;
}
n = 1;
pdx = 1;
lr = m * (m + 1) + 1;
r = NAG_ALLOC(lr,double);

/* g05rzc */
nag_rand_multivar_normal(order,emode,n,m,xmu,c,pdc,r,lr,
state,x,pdx,&fail);```
The Integer array state in the call to g05rzc contains information on the base generator being used. This array must have been initialized prior to calling g05rzc with a call to either g05kfc or g05kgc. The required length of the array state will depend on the base generator chosen during initialization.

### g05mac

Withdrawn at Mark 24.
Replaced by g05tlc.

#### Old Code

```/* g05mac */
nag_rand_withdraw_int_uniform(a,b,n,x,igen,iseed,&fail);```

#### New Code

```/* g05tlc */
nag_rand_int_uniform(n,a,b,state,x,&fail);```
The Integer array state in the call to g05tlc contains information on the base generator being used. This array must have been initialized prior to calling g05tlc with a call to either g05kfc or g05kgc. The required length of the array state will depend on the base generator chosen during initialization.

### g05mbc

Withdrawn at Mark 24.
Replaced by g05tcc.

#### Old Code

```/* g05mbc */
nag_rand_withdraw_int_geom(mode,p,n,x,igen,iseed,r,&fail);```

#### New Code

```if (mode == 0) {
emode = Nag_InitializeReference;
} else if (mode == 1) {
emode = Nag_GenerateFromReference;
} else if (mode == 2) {
emode = Nag_InitializeAndGenerate;
} else if (mode == 3) {
emode = Nag_GenerateWithoutReference;
}
lr = (emode == Nag_GenerateWithoutReference) ? 1 :
8 + (Integer) (42 / p);
r = NAG_ALLOC(lr,double);

/* g05tcc */
nag_rand_int_geom(emode,n,p,r,lr,state,x,&fail);```
g05mbc returned the number of trials required to get the first success, whereas g05tcc returns the number of failures before the first success, therefore the value returned by g05tcc is one less than the equivalent value returned from g05mbc.
The Integer array state in the call to g05tcc contains information on the base generator being used. This array must have been initialized prior to calling g05tcc with a call to either g05kfc or g05kgc. The required length of the array state will depend on the base generator chosen during initialization.

### g05mcc

Withdrawn at Mark 24.
Replaced by g05thc.

#### Old Code

```/* g05mcc */
nag_rand_withdraw_int_negbin(mode,m,p,n,x,igen,iseed,r,&fail);```

#### New Code

```if (mode == 0) {
emode = Nag_InitializeReference;
} else if (mode == 1) {
emode = Nag_GenerateFromReference;
} else if (mode == 2) {
emode = Nag_InitializeAndGenerate;
} else if (mode == 3) {
emode = Nag_GenerateWithoutReference;
}
lr = (emode == Nag_GenerateWithoutReference) ? 1 :
28 + (Integer) ((20 * sqrt(m*p) + 30 * p) / (1 - p));
r = NAG_ALLOC(lr,double);

/* g05thc */
nag_rand_int_negbin(emode,n,m,p,r,lr,state,x,&fail);```
The Integer array state in the call to g05thc contains information on the base generator being used. This array must have been initialized prior to calling g05thc with a call to either g05kfc or g05kgc. The required length of the array state will depend on the base generator chosen during initialization.

### g05mdc

Withdrawn at Mark 24.
Replaced by g05tfc.

#### Old Code

```/* g05mdc */
nag_rand_withdraw_int_log(mode,a,n,x,igen,iseed,r,&fail);```

#### New Code

```if (mode == 0) {
emode = Nag_InitializeReference;
} else if (mode == 1) {
emode = Nag_GenerateFromReference;
} else if (mode == 2) {
emode = Nag_InitializeAndGenerate;
} else if (mode == 3) {
emode = Nag_GenerateWithoutReference;
}
lr = (emode == Nag_GenerateWithoutReference) ? 1 :
18 + (Integer) (40 / (1 - a));
r = NAG_ALLOC(lr,double);

/* g05tfc */
nag_rand_int_log(emode,n,a,r,lr,state,x,&fail);```
The Integer array state in the call to g05tfc contains information on the base generator being used. This array must have been initialized prior to calling g05tfc with a call to either g05kfc or g05kgc. The required length of the array state will depend on the base generator chosen during initialization.

### g05mec

Withdrawn at Mark 24.
Replaced by g05tkc.

#### Old Code

```/* g05mec */
nag_rand_withdraw_int_poisson_varmean(m,vlamda,x,igen,iseed,&fail);```

#### New Code

```/* g05tkc */
nag_rand_int_poisson_varmean(m,vlamda,state,x,&fail);```
The Integer array state in the call to g05tkc contains information on the base generator being used. This array must have been initialized prior to calling g05tkc with a call to either g05kfc or g05kgc. The required length of the array state will depend on the base generator chosen during initialization.

### g05mjc

Withdrawn at Mark 24.
Replaced by g05tac.

#### Old Code

```/* g05mjc */
nag_rand_withdraw_int_binomial(mode,m,p,n,x,igen,iseed,r,&fail);```

#### New Code

```if (mode == 0) {
emode = Nag_InitializeReference;
} else if (mode == 1) {
emode = Nag_GenerateFromReference;
} else if (mode == 2) {
emode = Nag_InitializeAndGenerate;
} else if (mode == 3) {
emode = Nag_GenerateWithoutReference;
}
lr = (emode == Nag_GenerateWithoutReference) ? 1 :
22 + 20 * ((Integer) sqrt(m * p * (1 - p)));
r = NAG_ALLOC(lr,double);

/* g05tac */
nag_rand_int_binomial(emode,n,m,p,r,lr,state,x,&fail);```
The Integer array state in the call to g05tac contains information on the base generator being used. This array must have been initialized prior to calling g05tac with a call to either g05kfc or g05kgc. The required length of the array state will depend on the base generator chosen during initialization.

### g05mkc

Withdrawn at Mark 24.
Replaced by g05tjc.

#### Old Code

```/* g05mkc */
nag_rand_withdraw_int_poisson(mode,lambda,n,x,igen,iseed,r,&fail);```

#### New Code

```if (mode == 0) {
emode = Nag_InitializeReference;
} else if (mode == 1) {
emode = Nag_GenerateFromReference;
} else if (mode == 2) {
emode = Nag_InitializeAndGenerate;
} else if (mode == 3) {
emode = Nag_GenerateWithoutReference;
}
lr = (emode == Nag_GenerateWithoutReference) ? 1 : 30 +
(Integer) (20 * sqrt(lambda) + lambda);
r = NAG_ALLOC(lr,double);

/* g05tjc */
nag_rand_int_poisson(emode,n,lambda,r,lr,state,x,&fail);```
The Integer array state in the call to g05tjc contains information on the base generator being used. This array must have been initialized prior to calling g05tjc with a call to either g05kfc or g05kgc. The required length of the array state will depend on the base generator chosen during initialization.

### g05mlc

Withdrawn at Mark 24.
Replaced by g05tec.

#### Old Code

```/* g05mlc */
nag_rand_withdraw_int_hypergeom(mode,ns,np,m,n,x,igen,iseed,r,&fail);```

#### New Code

```if (mode == 0) {
emode = Nag_InitializeReference;
} else if (mode == 1) {
emode = Nag_GenerateFromReference;
} else if (mode == 2) {
emode = Nag_InitializeAndGenerate;
} else if (mode == 3) {
emode = Nag_GenerateWithoutReference;
}
lr = (emode == Nag_GenerateWithoutReference) ? 1 : 28 + 20 *
((Integer) sqrt((ns * m * (np - m) * (np - ns)) /
(np * np * np)));
r = NAG_ALLOC(lr,double);

/* g05tec */
nag_rand_int_hypergeom(emode,n,ns,np,m,r,lr,state,x,&fail);```
The Integer array state in the call to g05tec contains information on the base generator being used. This array must have been initialized prior to calling g05tec with a call to either g05kfc or g05kgc. The required length of the array state will depend on the base generator chosen during initialization.

### g05mrc

Withdrawn at Mark 24.
Replaced by g05tgc.

#### Old Code

```/* g05mrc */
nag_rand_withdraw_int_multinomial(order,mode,m,k,p,n,x,pdx,igen,iseed,r,&fail);```

#### New Code

```if (mode == 0) {
emode = Nag_InitializeReference;
} else if (mode == 1) {
emode = Nag_GenerateFromReference;
} else if (mode == 2) {
emode = Nag_InitializeAndGenerate;
} else if (mode == 3) {
emode = Nag_GenerateWithoutReference;
}
pmax = p[0];
for (i = 1; i < k; i++)
pmax = (pmax > p[i]) ? p[i] : pmax;
lr = (emode == Nag_GenerateWithoutReference) ? 1 : 30 +
20 * ((Integer) sqrt(m * pmax * (1 - pmax)));
r = NAG_ALLOC(lr,double);

/* g05tgc */
nag_rand_int_multinomial(order,emode,n,m,k,p,r,lr,state,x,pdx,&fail);```
The Integer array state in the call to g05tgc contains information on the base generator being used. This array must have been initialized prior to calling g05tgc with a call to either g05kfc or g05kgc. The required length of the array state will depend on the base generator chosen during initialization.

### g05mzc

Withdrawn at Mark 24.
Replaced by g05tdc.

#### Old Code

```/* g05mzc */
nag_rand_withdraw_int_general(mode,p,np,ip1,comp_type,n,x,igen,iseed,r,&fail);```

#### New Code

```if (mode == 0) {
emode = Nag_InitializeReference;
} else if (mode == 1) {
emode = Nag_GenerateFromReference;
} else if (mode == 2) {
emode = Nag_InitializeAndGenerate;
}
itype = (comp_type == Nag_Compute_1) ? Nag_PDF : Nag_CDF;
lr = 10 + (Integer) (1.4 * np);
r = NAG_ALLOC(lr,double);

/* g05tdc */
nag_rand_int_general(emode,n,p,np,ip1,itype,r,lr,state,x,&fail);```
The Integer array state in the call to g05tdc contains information on the base generator being used. This array must have been initialized prior to calling g05tdc with a call to either g05kfc or g05kgc. The required length of the array state will depend on the base generator chosen during initialization.

### g05nac

Withdrawn at Mark 24.
Replaced by g05ncc.

#### Old Code

```/* g05nac */
nag_rand_withdraw_permute(index,n,igen,iseed,&fail);```

#### New Code

```/* g05ncc */
nag_rand_permute(index,n,state,&fail);```
The Integer array state in the call to g05ncc contains information on the base generator being used. This array must have been initialized prior to calling g05ncc with a call to either g05kfc or g05kgc. The required length of the array state will depend on the base generator chosen during initialization.

### g05nbc

Withdrawn at Mark 24.
Replaced by g05ndc.

#### Old Code

```/* g05nbc */
nag_rand_withdraw_sample(ipop,n,isampl,m,igen,iseed,&fail);```

#### New Code

```/* g05ndc */
nag_rand_sample(ipop,n,isampl,m,state,&fail);```
The Integer array state in the call to g05ndc contains information on the base generator being used. This array must have been initialized prior to calling g05ndc with a call to either g05kfc or g05kgc. The required length of the array state will depend on the base generator chosen during initialization.

### g05pac

Withdrawn at Mark 24.
Replaced by g05phc.

#### Old Code

```/* g05pac */
nag_rand_withdraw_times_arma(mode,xmean,p,phi,q,theta,avar,&var,n,x,
igen,iseed,r,&fail);```

#### New Code

```if (mode == 0) {
emode = Nag_InitializeReference;
} else if (mode == 1) {
emode = Nag_GenerateFromReference;
} else if (mode == 2) {
emode = Nag_InitializeAndGenerate;
}
lr = p + q + 6 * ((p < q + 1) ? q + 1 : p);
r = NAG_ALLOC(lr,double);

/* g05phc */
nag_rand_times_arma(emode,n,xmean,p,phi,q,theta,avar,r,lr,state,&var,x,
&fail);```
The Integer array state in the call to g05phc contains information on the base generator being used. This array must have been initialized prior to calling g05phc with a call to either g05kfc or g05kgc. The required length of the array state will depend on the base generator chosen during initialization.

### g05pcc

Withdrawn at Mark 24.
Replaced by g05pjc.

#### Old Code

```/* g05pcc */
nag_rand_withdraw_times_mv_varma(order,mode,k,xmean,p,phi,q,theta,
var,pdv,n,x,pdx,igen,iseed,r,&fail);```

#### New Code

```if (mode == 0) {
emode = Nag_InitializeReference;
} else if (mode == 1) {
emode = Nag_GenerateFromReference;
} else if (mode == 2) {
emode = Nag_InitializeAndGenerate;
} else if (mode == 3) {
emode = Nag_ReGenerateFromReference;
}
tmp1 = (p > q) ? p : q;
if (p == 0) {
tmp2 = k * (k + 1) / 2;
} else {
tmp2 = k*(k+1)/2 + (p-1)*k*k;
}
tmp3 = p + q;
if (k >= 6) {
lr = (5*tmp1*tmp1+1)*k*k + (4*tmp1+3)*k + 4;
} else {
tmp4 = k*tmp1*(k*tmp1+2);
tmp5 = k*k*tmp3*tmp3+tmp2*(tmp2+3)+k*k*(q+1);
lr = (tmp3*tmp3+1)*k*k + (4*tmp3+3)*k +
((tmp4 > tmp5) ? tmp4 : tmp5) + 4;
}
r = NAG_ALLOC(lr,double);

/* g05pjc */
nag_rand_times_mv_varma(order,emode,n,k,xmean,p,phi,q,theta,var,pdv,r,lr,
state,x,pdx,&fail);```
The Integer array state in the call to g05pjc contains information on the base generator being used. This array must have been initialized prior to calling g05pjc with a call to either g05kfc or g05kgc. The required length of the array state will depend on the base generator chosen during initialization.

### g05qac

Withdrawn at Mark 24.
Replaced by g05pxc.

#### Old Code

```/* g05qac */
nag_rand_withdraw_matrix_orthog(order,side,init,m,n,a,pda,igen,iseed,&fail);```

#### New Code

```if (order == Nag_RowMajor) {
/* g05pxc */
nag_rand_matrix_orthog(side,init,m,n,state,a,pda,&fail);
} else {
tside = (side == Nag_LeftSide) ? Nag_RightSide : Nag_LeftSide;
pda = m;

/* g05pxc */
nag_rand_matrix_orthog(tside,init,n,m,state,a,pda,&fail);
}```
The Integer array state in the call to g05pxc contains information on the base generator being used. This array must have been initialized prior to calling g05pxc with a call to either g05kfc or g05kgc. The required length of the array state will depend on the base generator chosen during initialization.

### g05qbc

Withdrawn at Mark 24.
Replaced by g05pyc.

#### Old Code

```/* g05qbc */
nag_rand_withdraw_matrix_corr(order,n,d,c,pdc,eps,igen,iseed,&fail);```

#### New Code

```/* g05pyc */
nag_rand_matrix_corr(n,d,eps,state,c,pdc,&fail);```
The Integer array state in the call to g05pyc contains information on the base generator being used. This array must have been initialized prior to calling g05pyc with a call to either g05kfc or g05kgc. The required length of the array state will depend on the base generator chosen during initialization.

### g05qdc

Withdrawn at Mark 24.
Replaced by g05pzc.

#### Old Code

```/* g05qdc */
nag_rand_withdraw_matrix_2waytable(order,mode,nrow,ncol,totr,totc,x,pdx,igen,
iseed,r,nr,&fail);```

#### New Code

```if (mode == 0) {
emode = Nag_InitializeReference;
} else if (mode == 1) {
emode = Nag_GenerateFromReference;
} else if (mode == 2) {
emode = Nag_InitializeAndGenerate;
}
for (i = 0, lr = 5; i < nrow; i++)
lr += totr[i];
r = NAG_ALLOC(lr,double);
if (order == Nag_RowMajor) {
/* g05pzc */
nag_rand_matrix_2waytable(emode,nrow,ncol,totr,totc,r,lr,state,x,pdx,
&fail);
} else {
pdx = nrow;

/* g05pzc */
nag_rand_matrix_2waytable(emode,ncol,nrow,totc,totr,r,lr,state,x,pdx,
&fail);
}```
The Integer array state in the call to g05pzc contains information on the base generator being used. This array must have been initialized prior to calling g05pzc with a call to either g05kfc or g05kgc. The required length of the array state will depend on the base generator chosen during initialization.

### g05rac

Withdrawn at Mark 24.
Replaced by g05rdc.

#### Old Code

```/* g05rac */
nag_rand_withdraw_copula_normal(order,mode,m,c,pdc,n,x,pdx,igen,iseed,r,lr,
&fail);```

#### New Code

```if (mode == 1) {
emode = Nag_InitializeReference;
} else if (mode == 2) {
emode = Nag_GenerateFromReference;
} else if (mode == 0) {
emode = Nag_InitializeAndGenerate;
}
lr = m * (m + 1) + 1;
r = NAG_ALLOC(lr,double);

/* g05rdc */
nag_rand_copula_normal(order,emode,n,m,c,pdc,r,lr,state,x,pdx,
&fail);```
The Integer array state in the call to g05rdc contains information on the base generator being used. This array must have been initialized prior to calling g05rdc with a call to either g05kfc or g05kgc. The required length of the array state will depend on the base generator chosen during initialization.

### g05rbc

Withdrawn at Mark 24.
Replaced by g05rcc.

#### Old Code

```/* g05rbc */
nag_rand_withdraw_copula_students_t(order,mode,df,m,c,pdc,n,x,pdx,igen,
iseed,r,lr,&fail);```

#### New Code

```if (mode == 1) {
emode = Nag_InitializeReference;
} else if (mode == 2) {
emode = Nag_GenerateFromReference;
} else if (mode == 0) {
emode = Nag_InitializeAndGenerate;
}

/* g05rcc */
nag_rand_copula_students_t(order,emode,n,df,m,c,pdc,r,lr,
state,x,pdx,&fail);```
The Integer array state in the call to g05rcc contains information on the base generator being used. This array must have been initialized prior to calling g05rcc with a call to either g05kfc or g05kgc. The required length of the array state will depend on the base generator chosen during initialization.

### g05yac

Withdrawn at Mark 24.
Replaced by g05ylc and g05ymc.
Faure quasi-random numbers:
Sobol quasi-random numbers:
Neiderreiter quasi-random numbers:

#### Old Code

```/* g05yac */
nag_rand_(state,seq,iskip,idim,quasi,&gf,&fail);```

#### New Code

```liref = (seq == Nag_QuasiRandom_Faure) ? 407 : 32 * idim + 7;
iref = NAG_ALLOC(liref,Integer);
seq = (seq == Nag_QuasiRandom_Sobol) ?
Nag_QuasiRandom_SobolA659 : seq;

if (state == Nag_QuasiRandom_Init) {
/* g05ylc */
nag_rand_quasi_init(seq,idim,iref,liref,iskip,&fail);
} else if (state == Nag_QuasiRandom_Cont) {
n = 1;
pdquasi = (order == Nag_RowMajor) ? idim : n;

/* g05ymc */
nag_rand_quasi_uniform(order,n,quasi,pdquasi,iref,&fail);
}```
g05yac has been split into two functions; g05ylc to initialize the quasi-random generators and g05ymc to generate the values. g05ymc will generate more than one realization at a time. Information is passed between g05ylc and g05ymc using the integer vector iref rather than the NAG defined structure gf. Therefore there is no longer any need to call a function to release memory as iref can be "freed" like any C array.

### g05ybc

Withdrawn at Mark 24.
Replaced by g05yjc and g05ylc.
Faure quasi-random numbers with Gaussian probability:
Sobol quasi-random numbers with Gaussian probability:
Neiderreiter quasi-random numbers with Gaussian probability:
Faure quasi-random numbers with log Normal probability:
Sobol quasi-random numbers with log Normal probability:
Neiderreiter quasi-random numbers with log Normal probability:

#### Old Code

```/* g05ybc */
nag_rand_(state,seq,lnorm,mean,std,iskip,idim,
quasi,&gf,&fail);```

#### New Code

```liref = (seq == Nag_QuasiRandom_Faure) ? 407 : 32 * idim + 7;
iref = NAG_ALLOC(liref,Integer);
seq = (seq == Nag_QuasiRandom_Sobol) ?
Nag_QuasiRandom_SobolA659 : seq;

if (state == Nag_QuasiRandom_Init) {
/* g05ylc */
nag_rand_quasi_init(seq,idim,iref,liref,iskip,&fail);
} else if (state == Nag_QuasiRandom_Cont) {
n = 1;
pdquasi = (order == Nag_RowMajor) ? idim : n;

if (lnorm == Nag_LogNormal) {
/* g05ykc */
nag_rand_quasi_lognormal(order,mean,std,n,quasi,pdquasi,iref,
&fail);
} else if (lnorm == Nag_Normal) {
/* g05yjc */
nag_rand_quasi_normal(order,mean,std,n,quasi,pdquasi,iref,&fail);
}
}```
g05ybc has been split into three functions; g05ylc to initialize the quasi-random generators, g05ykc to generate values from a log-normal distribution and g05yjc to generate values from a normal distribution. Both g05ykc and g05yjc will generate more than one realization at a time. Information is passed between g05ylc and g05ykc and g05yjc using the integer vector iref rather than the NAG defined structure gf. Therefore there is no longer any need to call a function to release memory as iref can be "freed" like any C array.

## G10 – Smoothing in Statistics

### g10bac

Withdrawn at Mark 26.
Replaced by g10bbc.
The replacement routine introduces new functionality with respect to the automatic selection of a suitable window width.

#### Old Code

`nag_smooth_withdraw_kerndens_gauss(n, x, window, low, high, ns, smooth, t, &fail);`

#### New Code

```assert(rcomm = NAG_ALLOC(ns+20,double));
nag_smooth_kerndens_gauss(n, x, Nag_WindowSupplied, &window, &low, &high, ns, smooth, t,
Nag_TRUE, rcomm, &fail);```

## X02 – Machine Constants

### X02DAC

Withdrawn at Mark 24.
There is no replacement for this function.

### X02DJC

Withdrawn at Mark 24.
There is no replacement for this function.

## X04 – Input/Output Utilities

### x04aec

Withdrawn at Mark 25.
There is no replacement for this function.

## X06 – OpenMP Utilities

### x06agc

Withdrawn at Mark 31.3.
Replaced by x06ajc.

#### Old Code

`nag_omp_set_nested(nesting)`

#### New Code

`nag_omp_set_max_active_levels(num, &ifail)`
Note: if nesting would be set to $0$ then num must be $1$. If nesting would be set to $1$ set num to the number of nested active parallel regions required.

### x06ahc

Withdrawn at Mark 31.3.
Replaced by x06akc.

#### Old Code

`nag_omp_get_nested()`

#### New Code

`nag_omp_get_max_active_levels()`
Note: if x06ahc() returned $0$, x06akc() will return $1$. If x06ahc() returned $1$, x06akc() will return the number of nested active parallel regions allowed.