Chapter Contents
NAG Toolbox

# Advice on Replacement Calls for Withdrawn/Superseded Routines

## C05 – Roots of One or More Transcendental Equations

Withdrawn at Mark 25.
Replaced by nag_roots_contfn_brent (c05ay).
```Old: function [f] = c05ad_f(xx)
...
end
...
New: function [f, user] = c05ay_f(xx, user)
...
end
...
[x, user, ifail] = c05ay(a, b, eps, eta, 'c05ay_f')```

### nag_roots_withdraw_contfn_brent_start (c05ag)

Withdrawn at Mark 25.
Replaced by nag_roots_contfn_brent_interval (c05au).
```Old: function [f] = c05ag_f(xx)
...
end
...
[x, a, b, ifail] = c05ag(x, h, eps, eta, 'c05ag_f')
New: function [f, user] = c05au_f(xx, user)
...
end
...
[x, a, b, user, ifail] = c05au(x, h, eps, eta, 'c05au_f')```

### nag_roots_withdraw_contfn_cntin_start (c05aj)

Withdrawn at Mark 25.
Replaced by nag_roots_contfn_cntin (c05aw).
```Old: function [f] = c05aj_f(xx)
...
end
...
[x, ifail] = c05aj(x, eps, eta, 'c05aj_f', nfmax)
New: function [f, user] = c05aw_f(xx, user)
...
end
...
[x, user, ifail] = c05aw(x, eps, eta, 'c05aw_f', nfmax)```

### nag_roots_withdraw_sys_func_easy (c05nb)

Withdrawn at Mark 25.
Replaced by nag_roots_sys_func_easy (c05qb).
```Old: function  [fvec, iflag] = c05nb_fcn(n, x, iflag)
...
end
...
[x, fvec, ifail] = c05nb('c05nb_fcn', x)
New: function  [fvec, user, iflag] = c05qb_fcn(n, x, user, iflag)
...
end
...
[x, fvec, user, ifail] = c05qb('c05qb_fcn', x)```

### nag_roots_withdraw_sys_func_expert (c05nc)

Withdrawn at Mark 25.
Replaced by nag_roots_sys_func_expert (c05qc).
```Old: function  [fvec, iflag] = c05nc_fcn(n, x, iflag)
...
end
...
[x, fvec, diag, nfev, fjac, r, qtf, ifail] = c05nc('c05nc_fcn', x, ...
ml, mu, diag, mode, nprint, lr)
New: function  [fvec, user, iflag] = c05qc_fcn(n, x, user, iflag)
...
end
...
[x, fvec, diag, nfev, fjac, r, qtf, ifail] = c05qc('c05qc_fcn', x, ...
ml, mu, mode, diag, nprint)```

### nag_roots_withdraw_sys_func_rcomm (c05nd)

Withdrawn at Mark 25.
Replaced by nag_roots_sys_func_rcomm (c05qd).
```Old: [irevcm, x, fvec, diag, fjac, r, qtf, w, ifail] = c05nd(irevcm, x, fvec, ...
ml, mu, diag, mode, fjac, r, qtf, w)
New: iwsav = zeros(17, 1, nag_int_name);
rwsav = zeros(4*n + 20, 1);
...
[irevcm, x, fvec, diag, fjac, r, qtf, iwsav, rwsav, ifail] = c05qd(irevcm, x, fvec, ...
ml, mu, mode, diag, fjac, r, qtf, iwsav, rwsav)```

### nag_roots_withdraw_sys_deriv_easy_old (c05pb)

Withdrawn at Mark 25.
Replaced by nag_roots_sys_deriv_easy (c05rb).
```Old: function  [fvec, fjac, iflag] = c05pb_fcn(n, x, fvec, fjac, ldfjac, iflag)
...
end
...
[x, fvec, fjac, ifail] = c05pb('c05pb_fcn', x)
New: function  [fvec, fjac, user, iflag] = c05rb_fcn(n, x, fvec, fjac, user, iflag)
...
end
...
[x, fvec, fjac, user, ifail] = c05rb('c05rb_fcn', x)```

### nag_roots_withdraw_sys_deriv_expert_old (c05pc)

Withdrawn at Mark 25.
Replaced by nag_roots_sys_deriv_expert (c05rc).
```Old: function  [fvec, fjac, iflag] = c05pc_fcn(n, x, fvec, fjac, ldfjac, iflag)
...
end
...
[x, fvec, fjac, diag, nfev, njev, r, qtf, ifail] = c05pc('c05pc_fcn', x, ...
diag, mode, nprint, lr)
New: function  [fvec, fjac, user, iflag] = c05rc_fcn(n, x, fvec, fjac, user, iflag)
...
end
...
[x, fvec, fjac, diag, nfev, njev, r, qtf, ifail] = c05rc('c05rc_fcn', x, ...
mode, diag, nprint)```

### nag_roots_withdraw_sys_deriv_rcomm (c05pd)

Withdrawn at Mark 25.
Replaced by nag_roots_sys_deriv_rcomm (c05rd).
```Old: [irevcm, x, fvec, diag, fjac, r, qtf, w, ifail] = c05pd(irevcm, x, fvec, ...
fjac, diag, mode, r, qtf, w)
New: iwsav = zeros(17, 1, nag_int_name);
rwsav = zeros(4*n + 10, 1);
...
[irevcm, x, fvec, diag, fjac, r, qtf, iwsav, rwsav, ifail] = c05rd(irevcm, x, fvec, ...
fjac, mode, diag, r, qtf, iwsav, rwsav)```

### nag_roots_withdraw_sys_deriv_check (c05za)

Withdrawn at Mark 25.
Replaced by nag_roots_sys_deriv_check (c05zd).
```OLD: [xp, err] = c05za(x, fvec, fjac, fvecp, mode);
NEW: [xp, err, ifail] = c05zd(mode, x, fvec, fjac, fvecp);
```
The array xp will now have dimension n regardless of the value of mode, and likewise err will now have dimension m regardless. The argument ifail is the standard NAG argument for error trapping.

## C06 – Summation of Series

### nag_sum_withdraw_chebyshev (c06db)

Withdrawn at Mark 25.
Replaced by nag_sum_chebyshev (c06dc).
```Old: for i=1:lx
[result(i)] = c06db(x(i),c,s);
end
New: xmin = -1.0, xmax = 1.0;

if (s == 1 || s == 2 || s == 3)
s_use = s;
else
s_use = 2;
end

[result, ifail] = c06dc(x,xmin,xmax,c,s_use);```
The old function c06db returns a single sum at a time, whereas the new function nag_sum_chebyshev (c06dc) returns a vector of lx values at once. The values supplied in x to nag_sum_chebyshev (c06dc) are un-normalized original variable values in the range $\left[{\mathbf{xmin}},{\mathbf{xmax}}\right]$. The argument ifail is the standard NAG argument for error trapping.

### nag_sum_fft_real_1d_nowork (c06ea)

Scheduled for withdrawal at Mark 26.
Replaced by nag_sum_fft_realherm_1d (c06pa).
```Old:[x, ifail] = c06ea(x)
New:[x, ifail] = c06pa('f', x, n)```
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}\right)←{\mathbf{x}}\left(\mathit{i}\right)$, for $\mathit{i}=0,1,\dots ,{\mathbf{n}}/2$ and
${\mathbf{x}}\left(2×\mathit{i}+1\right)←{\mathbf{x}}\left({\mathbf{n}}-\mathit{i}\right)$, for $\mathit{i}=1,2,\dots ,\left({\mathbf{n}}+1\right)/2$.

### nag_sum_fft_hermitian_1d_nowork (c06eb)

Scheduled for withdrawal at Mark 26.
Replaced by nag_sum_fft_realherm_1d (c06pa).
```Old: [x, ifail] = c06eb(x)
New: [x, ifail] = c06pa('b', x, n);```
The input values of x are stored in a different order with real and imaginary parts stored contiguously. Also nag_sum_fft_realherm_1d (c06pa) 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}\right)←{\mathbf{x}}\left(\mathit{i}\right)$, for $\mathit{i}=0,1,\dots ,{\mathbf{n}}/2$ and
${\mathbf{x}}\left(2×\mathit{i}+1\right)←{\mathbf{x}}\left({\mathbf{n}}-\mathit{i}\right)$, for $\mathit{i}=1,2,\dots ,\left({\mathbf{n}}-1\right)/2$.

### nag_sum_fft_complex_1d_nowork (c06ec)

Scheduled for withdrawal at Mark 26.
Replaced by nag_sum_fft_complex_1d (c06pc).
```Old: [x, y, ifail] = c06ec(x, y)
New: [z, ifail] = c06pc('f', z);```
z is a complex array of length n such that $\text{z}\left(\mathit{i}\right)=\mathrm{complex}\left(\text{x}\left(\mathit{i}\right),\text{y}\left(\mathit{i}\right)\right)$, for $\mathit{i}=0,1,\dots {\mathbf{n}}-1$ on input and output.

### nag_sum_convcorr_real_nowork (c06ek)

Scheduled for withdrawal at Mark 26.
Replaced by nag_sum_convcorr_real (c06fk).
```Old: [x, y, ifail] = c06ek(job, x, y)
New: [x, y, ifail] = c06fk(job, x, y)```

### nag_sum_fft_complex_1d_multi_rfmt (c06fr)

Scheduled for withdrawal at Mark 26.
Replaced by nag_sum_fft_complex_1d_multi_col (c06ps).
```Old: [x, y, trig, ifail] = c06fr(m, n, x, y, init, trig)
New: [z, ifail] = c06pr('f', m, n, complex(x,y))
x = real(z)
y = imag(z)```

### nag_sum_fft_complex_2d_sep (c06fu)

Scheduled for withdrawal at Mark 26.
Replaced by nag_sum_fft_complex_2d (c06pu).
```Old: [x, y, trigm, trign, ifail] = c06fu(m, n, x, y, init, trigm, trign)
New: [z, ifail] = c06pr('f', m, n, complex(x, y));     x = real(z)
y = imag(z)```

### nag_sum_conjugate_hermitian_rfmt (c06gb)

Scheduled for withdrawal at Mark 26.
There is no replacement for this routine.

### nag_sum_conjugate_complex_sep (c06gc)

Scheduled for withdrawal at Mark 26.
There is no replacement for this routine.

### nag_sum_conjugate_hermitian_mult_rfmt (c06gq)

Scheduled for withdrawal at Mark 26.
There is no replacement for this routine.

### nag_sum_convert_herm2complex_sep (c06gs)

Scheduled for withdrawal at Mark 26.
There is no replacement for this routine.

### nag_sum_fft_real_sine (c06ha)

Scheduled for withdrawal at Mark 26.
Replaced by nag_sum_fft_sine (c06re).
```Old: [x, trig, ifail] = c06ha(m, n, x, init, trig)
New: y(1:m*(n-1)) = x(1:m*(n-1))
[y, ifail] = c06ra(m, n, y)
x = y(1:m*n)```
where $\mathrm{y}$ is a real array of lengths $\mathrm{m}×\left(\mathrm{n}+2\right)$.

### nag_sum_fft_real_cosine (c06hb)

Scheduled for withdrawal at Mark 26.
Replaced by nag_sum_fft_cosine (c06rf).
```Old: [x, trig, ifail] = c06hb(m, n, x, init, trig)
New: y(1:m*(n+1)) = x(1:m*(n+1))
[y, ifail] = c06rb(m, n, y)
x = y(1:m*(n+1)```

### nag_sum_fft_real_qtrsine (c06hc)

Scheduled for withdrawal at Mark 26.
Replaced by nag_sum_fft_qtrsine (c06rg).
```Old: [x, trig, ifail] = c06hc(direct, m, n, x, init, trig)
New: y(1:m*n) = x(1:m*n)
[y, ifail] = c06ra(m, n, y)
x = y(1:m*n)```
where $\mathrm{y}$ is a real array of length $\mathrm{m}×\left(\mathrm{n}+2\right)$.

### nag_sum_fft_real_qtrcosine (c06hd)

Scheduled for withdrawal at Mark 26.
Replaced by nag_sum_fft_qtrcosine (c06rh).
```Old: [x, trig, ifail] = c06hd(direct, m, n, x, init, trig)
New: y(1:m*n) = x(1:m*n)
[y, ifail] = c06ra(m, n, y)
x = y(1:m*n)```
where $\mathrm{y}$ is a real array of length $\mathrm{m}×\left(\mathrm{n}+2\right)$.

Scheduled for withdrawal at Mark 26.
```  Old: [result, ifail] = d01ba(d01xxx, a, b, n, @fun)

function [f] = fun(x)
f = ...
New: % set key according to quadrature formula       % key =  0 : (d01xxx='d01baz')       % key = -3 : (d01xxx='d01bay')       % key = -4 : (d01xxx='d01baw')       % key = -5 : (d01xxx='d01bax')       % key = abs(key) for normal weights       key = 0       [result, user, ifail] = d01ua(key, a, b, n, @f, 'user', user)
function [fv, iflag, user] = f(x, nx, iflag, user)         % see example below
...
fv = ... ```
user can be used to pass information to the user-supplied function f.
iflag is an integer which you may use to force an immediate exit from nag_quad_1d_gauss_vec (d01ua) 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.
```  function [fv, iflag, user] = f(x, nx, iflag, user)
fv = fun(x)```

Scheduled for withdrawal at Mark 26.
```Old: [weight, abscis, ifail] = d01bb('d01xxx', a, b, itype, n)
New: [weight, abscis, ifail] = d01tb(key, a, b, n)```
The supplied functions d01xxx and the argument itype have been combined into a single argument key. ${\mathbf{key}}<0$ is equivalent to $\text{ITYPE}=1$ (adjusted weights). ${\mathbf{key}}>0$ is equivalent to $\mathrm{itype}=0$ (normal weights). $\left|{\mathbf{key}}\right|$ indicates the quadrature rule.
• $\left|{\mathbf{key}}\right|=0$ : Gauss–Legendre ($\mathbf{d01xxx}='\mathrm{d01baz}'$)
• $\left|{\mathbf{key}}\right|=3$ : Gauss–Laguerre ($\mathbf{d01xxx}='\mathrm{d01bax}'$)
• $\left|{\mathbf{key}}\right|=4$ : Gauss–Hermite ($\mathbf{d01xxx}='\mathrm{d01baw}'$)
• $\left|{\mathbf{key}}\right|=5$ : Rational Gauss ($\mathbf{d01xxx}='\mathrm{d01bay}'$)

### d01rb

Scheduled for withdrawal at Mark 27.
Replaced by No replacement required.
See Example in nag_quad_1d_gen_vec_multi_rcomm (d01ra) for further details.

## D02 – Ordinary Differential Equations

### nag_ode_ivp_rk_range (d02pc)

Scheduled for withdrawal at Mark 26.
Replaced by nag_ode_ivp_rkts_range (d02pe) and associated D02P functions.
```Old: [work, ifail] = d02pv(tstart, ystart, tend, tol, thres, ...
...
[tgot, ygot, ypgot, ymax, work, ifail] = ...
d02pc(@f, neq, twant, ygot, ymax, work)
New: if not(errass)
method = -method
end
[iwsav, rwsav, ifail] = ...
d02pq(tstart, tend, yinit, tol, thresh, method)
...
[tgot, ygot, ypgot, ymax, user, iwsav, rwsav, ifail] = ...
d02pe(@f2, twant, ygot, ymax, iwsav, rwsav)```
iuser is available to allow you to pass information to the user defined function f2.
The definition of F2 (see f in nag_ode_ivp_rkts_range (d02pe)) can use the original function f as follows:
The definition of f2 can use the original function f as follows:
```function [yp, user] = f2(t, n, y, user)
yp = f(t, y)```

### nag_ode_ivp_rk_onestep (d02pd)

Scheduled for withdrawal at Mark 26.
Replaced by nag_ode_ivp_rkts_onestep (d02pf) and associated D02P functions.
```Old: [work, ifail] = d02pv(tstart, ystart, tend, tol, thresh, ...
[tnow, ynow, ypnow, work, ifail] = d02pd(@f, neq, work)

New: if not(errass)
method = -method
end
[iwsav, rwsav, ifail] = ...
d02pq(tstart, tend, yinit, tol, thresh, method)
[tnow, ynow, ypnow, user, iwsav, rwsav, ifail] = ...
d02pf(@f2, n, iwsav, rwsav);
```
user is available to allow you to pass information to the user defined function f2.
The definition of f2 can use the original function f as follows:
```function [yp, user] = f(t, n, y, user)
yp = f(t, y)
```

### nag_ode_ivp_rk_setup (d02pv)

Scheduled for withdrawal at Mark 26.
Replaced by nag_ode_ivp_rkts_setup (d02pq).
See d02pc, d02pd for further information.

### nag_ode_ivp_rk_reset_tend (d02pw)

Scheduled for withdrawal at Mark 26.
Replaced by nag_ode_ivp_rkts_reset_tend (d02pr).
```Old: [ifail] = d02pw(tendnu)
New: [iwsav, rwsav, ifail] = d02pr(tendnu, iwsav, rwsav)
```
iwsav and rwsav are arrays returned by nag_ode_ivp_rkts_setup (d02pq).

### nag_ode_ivp_rk_interp (d02px)

Scheduled for withdrawal at Mark 26.
Replaced by nag_ode_ivp_rkts_interp (d02ps).
```Old: [ywant, ypwant, work, wrkint, ifail] = ...
d02px(neq, twant, reqest, nwant, @f, work, wrkint)
New: if (reqest=='S' .or. reqest=='s')
ideriv = nag_int(0)
elseif (reqest=='D' .or. reqest=='d')
ideriv = nag_int(1)
else
ideriv = nag_int(2)
end
[ywant, ypwant, wcomm, user, iwsav, rwsav, ifail] = ...
d02ps(n, twant(j), ideriv, nwant, @f2, workint, iwsav, rwsav)
```
iwsav and rwsav are arrays returned by nag_ode_ivp_rkts_setup (d02pq).
user is available to allow you to pass information to the user defined function f2.
wcomm is a double array of length lwcomm. See the function document for nag_ode_ivp_rkts_interp (d02ps) for further information.
The definition of f2 can use the original function f as follows:
```function [yp, user] = f2(t, n, y, user)
yp = f(t, y)
```

### nag_ode_ivp_rk_diag (d02py)

Scheduled for withdrawal at Mark 26.
Replaced by nag_ode_ivp_rkts_diag (d02pt).
```Old: [totfcn, stpcst, waste, stpsok, hnext, ifail] = d02py
New: [fevals, stepcost, waste, stepsok, hnext, iwsav, ifail] = ...
d02pt(iwsav, rwsav)
```
iwsav and rwsav are arrays returned by nag_ode_ivp_rkts_setup (d02pq).

### nag_ode_ivp_rk_errass (d02pz)

Scheduled for withdrawal at Mark 26.
Replaced by nag_ode_ivp_rkts_errass (d02pu).
```Old: [rmserr, errmax, terrmx, ifail] = d02pz(n, work)
New: [rmserr, errmax, terrmx, iwsav, rwsav, ifail] = ...
d02pu(n, iwsav, rwsav)
```
n must be unchanged from that passed to nag_ode_ivp_rkts_setup (d02pq).
iwsav and rwsav are arrays returned by nag_ode_ivp_rkts_setup (d02pq).

### nag_ode_bvp_coll_nlin (d02tk)

Scheduled for withdrawal at Mark 27.
Replaced by nag_ode_bvp_coll_nlin_solve (d02tl).
```Old:  [rcomm, icomm, ifail] = ...
d02tk(ffun, fjac, gafun, gbfun, gajac, gbjac, guess, rcomm, icomm)
New: [rcomm, icomm, user, ifail] = ...
nag_ode_bvp_coll_nlin_solve (d02tl)(ffun, fjac, gafun, gbfun, gajac, gbjac, guess, rcomm, icomm, 'user', user)```
The additional optional parameter user is not used by nag_ode_bvp_coll_nlin_solve (d02tl), but is passed to ffun, fjac, gafun, gbfun, gajac, gbjac and guess which now also have this additional optional parameter.

## E04 – Minimizing or Maximizing a Function

### nag_opt_withdraw_uncon_simplex (e04cc)

Withdrawn at Mark 24.
Replaced by nag_opt_uncon_simplex (e04cb).
```Old: [x, f, user, ifail] = e04cc(x, tol, funct, monit2, maxcal, 'n', n, 'user', user)
New: [x, f, user, ifail] = e04cb(x, tolf, tolx, funct, monit3, maxcal, 'n', n, 'user', user) ```
```function user = monit3(fmin, fmax, sim, n, ncall, serror, vratio, user)
user = monit2(fmin,fmax,sim,n,n+1,ncall,user);
% Add code here to monitor the values of serror and vratio, if necessary```

### (e04un)

Withdrawn at Mark 22.
Replaced by nag_opt_lsq_gencon_deriv (e04us).
The specification of the subroutine objfun must also be changed as follows:
```Old: [iter, istate, c, cjac, f, fjac, clamda, objf, r, x, user, ...
ifail] = ...
e04un(a, bl, bu, y, confun, objfun, istate, cjac, fjac, clamda, r, ...
x, 'm', m, 'n', n, 'nclin', nclin, 'ncnln', ncnln, 'user', user)
New: [iter, istate, c, cjac, f, fjac, clamda, objf, r, x, user, ...
lwsav, iwsav, rwsav, ifail] = ...
e04us(a, bl, bu, y, confun, objfun, istate, cjac, fjac, clamda, r, ...
x, lwsav, iwsav, rwsav, 'm', m, 'n', n, 'nclin', nclin, ...
'ncnln', ncnln, 'user', user)```
The specification of the subroutine objfun must also be changed as follows:
```Old: [mode, f, fjac, user] = objfun(mode, m, n, ldfj, x, fjac, nstate, user)
New: [mode, f, fjac, user] = objfun(mode, m, n, ldfj, needfi, x, fjac, nstate, user) ```
See the function documents for further information.

### nag_opt_withdraw_check_funs (e04zc)

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

## F02 – Eigenvalues and Eigenvectors

### (f02bj)

Withdrawn at Mark 23.
Replaced by nag_lapack_dggev (f08wa).
```Old: [a, b, alfr, alfi, beta, v, iter, ifail] = f02bj(a, b, eps1, matv, 'n', n);
New: if matv
jobvr = 'v';
else
jobvr = 'n';
end
[a, b, alfr, alfi, beta, vl, vr, info] = f08wa('n', jobvr, a, b, 'n', n);```

### (f02ea)

Withdrawn at Mark 23.
Replaced by nag_lapack_dgees (f08pa).
```Old: [a, wr, wi, z, ifail] = f02ea(job, a, 'n', n)
New: if (job == 'n')
jobvs = 'n';
else
jobvs = 'v';
end
[a, sdim, wr, wi, vs, info] = f08pa(jobvs, 'n', select, a, 'n', n);

function [result] = select(wr, wi)
result = true;```

### (f02eb)

Withdrawn at Mark 23.
Replaced by nag_lapack_dgeev (f08na).
```Old: [a, wr, wi, vr, vi, ifail] = f02eb(job, a, 'n', n);
New: if (job == 'n')
jobvr = 'n';
else
jobvr = 'v';
end
[a, wr, wi, vl, vr, info] = f08na('n', jobvr, a, 'n', n);  ```
Note that Eigenvector information is stored differently in vr. See the function documents for further details.

### (f02fa)

Withdrawn at Mark 23.
Replaced by nag_lapack_dsyev (f08fa).
```Old: [a, w, ifail] = f02fa(job, uplo, a, 'n', n);
New: [a, w, info] = f08fa(jobz, uplo, a, 'n', n);```

### (f02fc)

Withdrawn at Mark 23.
Replaced by nag_lapack_dsyevx (f08fb).
```Old: [a, m, w, z, ifail] = f02fc(job, range, uplo, a, wl, wu, il, iu, mest, 'n', n);
New: [a, m, w, z, jfail, info] = f08fb(job, range, uplo, a, wl, wu, il, iu, abstol, 'n', n);```

### (f02fd)

Withdrawn at Mark 23.
Replaced by nag_lapack_dsygv (f08sa).
```Old: [a, b, w, ifail] = f02fd(itype, job, uplo, a, b, 'n', n);
New: [a, b, w, info] = f08sa(itype, job, uplo, a, b, 'n', n);```

### (f02fh)

Withdrawn at Mark 23.
Replaced by nag_lapack_dsbgv (f08ua).
```Old: [a, b, d, ifail] = f02fh(ma, a, mb, b, 'n', n);
New: [a, b, d, z, info] = f08ua('n', 'u', ma, mb, a, b, 'n', n);```
The order of eigenvalues in d changes from descending to ascending.

### (f02ga)

Withdrawn at Mark 23.
Replaced by nag_lapack_zgees (f08pn).
```Old: [a, w, z, ifail] = f02ga(job, a, 'n', n);
New: if (job == 'n')
jobvs = 'n';
else
jobvs = 'v';
end
[a, sdim, w, z, info] = f08pn(jobvs, 'n', select, a, 'n', n);

function [result] = select(c)
result = true;```

### (f02gb)

Withdrawn at Mark 23.
Replaced by nag_lapack_zgeev (f08nn).
```Old: [a, w, v, ifail] = f02gb(job, a, 'n', n);
New: [a, w, vl, v, info] = f08nn('n', job, a, 'n', n);```

### (f02gj)

Withdrawn at Mark 23.
Replaced by nag_lapack_zggev (f08wn).
```Old: [ar, ai, br, bi, alfr, alfi, beta, vr, vi, iter, ifail] = ...
f02gj(ar, ai, br, bi, eps1, matv, 'n', n);
New: if matv
jobvr = 'v';
else
jobvr = 'n';
end
[a, b, alpha, beta1, vl, v, info] = ...
f08wn('n', jobvr, complex(ar,ai), complex(br,bi), 'n', n);
% Note that the results are single complex objects, rather than the
% real, imaginary pairs returned by f02gj```
Note that the separated double and imaginary parts of input and output data in f02gj has been replaced by combined complex types in nag_lapack_zggev (f08wn).

### (f02ha)

Withdrawn at Mark 23.
Replaced by nag_lapack_zheev (f08fn).
```Old: [a, w, ifail] = f02ha(job, uplo, a, 'n', n);
New: [a, w, info] = f08fn(job, uplo, a, 'n', n);```

### (f02hc)

Withdrawn at Mark 23.
Replaced by nag_lapack_zheevx (f08fp).
```Old: [a, m, w, z, ifail] = f02hc(job, range, uplo, a, wl, wu, il, iu, mest, 'n', n);
New: [a, m, w, z, jfail, info] = f08fp(job, range, uplo, a, wl, wu, il, iu, abstol, 'n', n); ```

### (f02hd)

Withdrawn at Mark 23.
Replaced by nag_lapack_zhegv (f08sn).
```Old: [a, b, w, ifail] = f02hd(itype, job, uplo, a, b, 'n', n);
New: [a, b, w, info] = f08sn(itype, job, uplo, a, b, 'n', n);```

### nag_eigen_real_band_geneig (f02sd)

Scheduled for withdrawal at Mark 27.
Replaced by nag_sparseig_real_band_solve (f12ag) and nag_sparseig_real_symm_band_solve (f12fg).
```Old: [a, b, vec, d, ifail] = f02sd(ma1, mb1, a, b, sym, relep, rmu, d, 'n', n);
New: if B_symm_def
[icomm, comm, ifail] = f12af(n, nev, ncv);
[icomm, comm, ifail] = f12ad( 'Shifted Real', icomm, comm);
[icomm, comm, ifail] = f12ad( 'Generalized', icomm, comm);
[nconv, dr, di, z, resid, v, comm, icomm, ifail] = ...
f12ag(kl, ku, ab, mb, sigmar, sigmai, resid, comm, icomm);
vec = v(:,1);
else
c = a - rmu*b;
[c, ipiv, info] = f07bd(n, kl, ku, c);
x = zeros(n,1); mx = x;
[icomm, comm, ifail] = f12aa( n, nev, ncv);
while (irevcm ~= 5)
[irevcm, resid, v, x, mx, nshift, comm, icomm, ifail] = ...
f12ab(irevcm, resid, v, x, mx, comm, icomm);
if (irevcm == -1 || irevcm == 1)
[mx] = bx(kl,ku,b,x); ! where bx performs banded B*x (dgbmv) operation
[x, info] = f07be(trans, kl, ku, c, ipiv, mx);
end
end
[nconv, dr, di, ~, ~, comm, icomm, ifail] = ...
f12ac(rmu, 0, resid, v, comm, icomm);
lr = dr(1)/(dr(1)^2+di(1)^2) + rmu;
end```

### nag_eigen_real_gen_qu_svd (f02wd)

Scheduled for withdrawal at Mark 27.
Replaced by nag_eigen_real_triang_svd (f02wu) and nag_lapack_dgeqrf (f08ae).
The Householder $QU$ factorization part of the functionality can be achieved with nag_lapack_dgeqrf (f08ae). The action ${Q}^{\mathrm{T}}b$ can be computed by a call to nag_lapack_dormqr (f08ag). The orthogonal matrix $Q$ can be explicitly constructed, in-place, by a subsequent call to nag_lapack_dorgqr (f08af).
If the singular value decomposition (SVD) of $U$ is required, the result of nag_lapack_dgeqrf (f08ae) must be fed to nag_eigen_real_triang_svd (f02wu), remembering that the first orthogonal matrix of the SVD is called $Q$ in nag_eigen_real_triang_svd (f02wu) and $R$ in f02wd
```old: [z, qtb, svd, irank, tau, sv, r, pt, work, ifail] = f02wd(a, wantb, b, tol, svd, wantr, wantpt, lwork);
new: [z, tau, info] = f08ae(a);
if wantb
[c, info] = f08ag('Left', 'Transpose', z, tau, b);
end
if ~svd
[q, info] = f08af(z, tau);
else
[pt, qtb, r, sv, work, ifail] = f02wu(z, b, wantr, wantpt,'n',n);
irank = numel(sv(abs(sv)>x02aj));
end```

### (f02we)

Withdrawn at Mark 23.
Replaced by nag_lapack_dgesvd (f08kb).
```Old: [a, b, q, sv, pt, work, ifail] = f02we(a, b, wantq, wantp, 'm', m, 'n', n, 'ncolb', ncolb);
New: if wantq
jobu = 'a';
else
jobu = 'n';
end
if wantp
jobvt = 'a';
else
jobvt = 'n';
end
[a, sv, u, pt, info] = f08kb(jobu, jobvt, a, 'm', m, 'n', n);```
Please note that the facility to return ${Q}^{\mathrm{T}}B$ is not provided so arguments $\mathrm{wantb}$ and $\mathrm{b}$ are not required. Instead, nag_lapack_dgesvd (f08kb) 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.

### (f02xe)

Withdrawn at Mark 23.
Replaced by nag_lapack_zgesvd (f08kp).
```Old: [a, b, q, sv, ph, rwork, ifail] = f02xe(a, b, wantq, wantp, 'm', m, 'n', n, 'ncolb', ncolb);
New: if wantq
jobu = 'a';
else
jobu = 'n';
end
if wantp
jobvt = 'a';
else
jobvt = 'n';
end
[a, sv, q, ph, info] = f08kp(jobu, jobvt, a, 'm', m, 'n', n);```
Please note that the facility to return ${Q}^{\mathrm{H}}B$ is not provided so arguments wantb and $\mathrm{b}$ are not required. Instead, nag_lapack_zgesvd (f08kp) 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

### nag_det_withdraw_real_gen (f03aa)

Withdrawn at Mark 25.
Replaced by nag_lapack_dgetrf (f07ad) and nag_det_real_gen (f03ba).
```OLD: [a, det, ifail] = f03aa(a);
NEW: ...
[d, id, ifail] = f03ba(a, ipiv);
det = d*2^id;
```

### nag_det_withdraw_real_sym (f03ab)

Withdrawn at Mark 25.
Replaced by nag_lapack_dpotrf (f07fd) and nag_det_real_sym (f03bf).
```OLD: [a, det, ifail] = f03ab(a);
NEW: ...
[a, info] = f07fd('u', a);
[d, id, ifail] = f03bf(a);
det = d*2^id;
```
Note: the upper triangular part of $A$, stored in a, has been replaced here by its Cholesky factorization; the lower triangular part of $A$ can be used and overwritten by replacing 'u' by 'l' in the call to nag_lapack_dpotrf (f07fd) above.

### nag_det_withdraw_real_band_sym (f03ac)

Withdrawn at Mark 25.
Replaced by nag_lapack_dpbtrf (f07hd) and nag_det_real_band_sym (f03bh).
```OLD: [det, rl, ifail] = f03ac(a, m);
NEW: ...
[ab, info] = f07hd('l', kd, ab);
[d, id, ifail] = f03bh('l', kd, ab);
det = d*2^id;`
```
Note: the storage of $A$ in arrays a and ab is different. In fact ${\mathbf{ab}}\left(\mathit{i},\mathit{j}\right)=\mathrm{a}\left(\mathit{j},\mathit{i}\right)$, for $\mathit{i}=1,2,\dots ,m$ and $\mathit{j}=\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,i-m\right),\dots ,i$ which conforms to the LAPACK banded storage scheme. The factorization is returned in ab rather than in a separate array (rl). The upper part of matrix $A$ can also be stored in ab on input to nag_lapack_dpbtrf (f07hd).

Withdrawn at Mark 25.
Replaced by nag_lapack_zgetrf (f07ar) and nag_det_complex_gen (f03bn).
```OLD: [a, detr, deti, ifail] = f03ad(a);
New: ...
[a, ipiv, info] = f07ar(a);
[d, id, ifail] = f03bn(a, ipiv);
detr = real(d)*2^id;
deti = imag(d)*2^id;
```
Note: the real and imaginary parts of the determinant are independently scaled.

### nag_det_withdraw_real_sym_fac (f03ae)

Withdrawn at Mark 25.
Replaced by nag_lapack_dpotrf (f07fd) and nag_det_real_sym (f03bf).
```OLD: [a, p, d1, id, ifail] = f03ae(a);
NEW: ...
[a, info] = f07fd('u', a);
[d, id, ifail] = f03bf(a);
```
Note: the upper triangular part of $A$, stored in a, has been replaced here by its Cholesky factorization; the lower triangular part of $A$ can be used and overwritten by replacing ${\mathbf{uplo}}=\text{'U'}$ by ${\mathbf{uplo}}=\text{'L'}$ in the call to nag_lapack_dpotrf (f07fd) above.

### nag_det_withdraw_real_gen_fac (f03af)

Withdrawn at Mark 25.
Replaced by nag_lapack_dgetrf (f07ad) and nag_det_real_gen (f03ba).
```OLD: [a, d1, id, p, ifail] = f03af(epsilon, a);
NEW: ...
[d, id, ifail] = f03ba(a, ipiv);
```
Note: real array p has been replaced by the integer array ipiv for holding the pivots of the factorization.

## F04 – Simultaneous Linear Equations

### (f04aa)

Withdrawn at Mark 23.
Replaced by nag_lapack_dgesv (f07aa).
```Old: [a, c, ifail] = f04aa(a, b, 'n', n, 'm', m);
New: [a, ipiv, b, info] = f07aa(a, b, 'n', n, 'nrhs_p', nrhs_p);```
Note that the answer is now in b.

### (f04ac)

Withdrawn at Mark 23.
Replaced by nag_lapack_dpbsv (f07ha).
```Old: [c, rl, ifail] = f04ac(a, b, m, 'n', n, 'ir', ir, 'm1', m1);
New: [ab, b, info] = f07ha('u', n, ab, b, 'n', n, 'nrhs_p', nrhs_p) ;```
Note that a and ab are stored differently. With the 'U' option, ab may be regarded as the transpose of a. Note also that the answer is now stored in b.

Withdrawn at Mark 23.
Replaced by nag_lapack_zgesv (f07an).
```Old: [a, c, ifail] = f04ad(a, b, 'n', n, 'm', m);
New: [a, ipiv, b, info] = f07an(a, b, 'n', n, 'nrhs_p', nrhs_p);```
Note that the answer is now in b.

### nag_linsys_withdraw_real_posdef_solve_ref (f04af)

Withdrawn at Mark 25.
There is no replacement for this routine.
The factorization and solution of a positive definite linear system can be handled by calls to functions from Chapter F07, e.g., nag_lapack_dposvx (f07fb).
For example:
```OLD: ...
[a, p, d1, id, ifail] = f03ae(a);
[x, bb, k, ifail] = f04af(a, p, b, epsilon);
NEW: ...
[a, af, equed, s, b, x, rcond, ferr, berr, info] = ...
f07fb('e', 'u', a, af, 'y', s, b);
[d, id, ifail] = f03bf(a);
```

### nag_linsys_withdraw_real_posdef_solve (f04ag)

Withdrawn at Mark 25.
There is no replacement for this routine.
The factorization and solution of a positive definite linear system can be handled by calls to functions from Chapter F07, e.g., nag_lapack_dposv (f07fa).
For example:
```OLD: ...
[a, p, d1, id, ifail] = f03ae(a);
[x] = f04ag(a, p, b);
NEW: ...
[a, b, info] = f07fa('u', a, b);
[d, id, ifail] = f03bf(a);
```

### nag_linsys_withdraw_real_square_solve_ref (f04ah)

Withdrawn at Mark 25.
There is no replacement for this routine.
The factorization and solution of a real general linear system can be handled by calls to functions from the Chapter F07, e.g., nag_lapack_dgesvx (f07ab).
For example:
```OLD: ...
[a, d1, id, p, ifail] = f03af(epsilon, a);
[x, bb, k, ifail] = f04ah(a, aa, p, b, epsilon);
NEW: ...
[a, af, ipiv, equed, r, c, b, x, rcond, ferr, berr, work, info] = ...
f07ab('equil', 'no trans', a, af, ipiv, 'yes', r, c, b);
[d, id, ifail] = f03ba(a, ipiv);
```

### nag_linsys_withdraw_real_square_solve (f04aj)

Withdrawn at Mark 25.
There is no replacement for this routine.
The factorization and solution of a real general linear system can be handled by calls to functions from Chapter F07, e.g., nag_lapack_dgesv (f07aa).
For example:
```OLD: ...
[a, d1, id, p, ifail] = f03af(epsilon, a);
[b] = f04aj(a, p, b);
NEW: ...
[a, ipiv, bOut, info] = f07aa(a, b);
[d, id, ifail] = f03ba(a, ipiv);
```

### (f04ar)

Withdrawn at Mark 23.
Replaced by nag_lapack_dgesv (f07aa).
```Old: [a, c, ifail] = f04ar(a, b, 'n', n);
New; [a, ipiv, b, info] = f07aa(a, b, 'n', n, 'nrhs_p', nrhs_p);```
Note that the answer is now in b.

### (f04ea)

Withdrawn at Mark 23.
Replaced by nag_lapack_dgtsv (f07ca).
```Old: [d, du, dl, b, ifail] = f04ea(d, du, dl, b, 'n', n);
New: [dl, d, du, b, info] = f07ca(dl(2), d, du(2), b, 'n', n, 'nrhs_p', nrhs_p);```
Note that the answer is now in b.

### (f04fa)

Withdrawn at Mark 23.
Replaced by nag_lapack_dptsv (f07ja), or nag_lapack_dpttrf (f07jd) and nag_lapack_dpttrs (f07je).
```Old: [d, e, b, ifail] = f04fa(job, d, e, b, 'n', n);
[d, e, info] = f07jd(d, e, 'n', n);
New: if (job == 0)
[d, e, b, info] = f07ja(d, e, b, 'n', n, 'nrhs_p', nrhs_p);
else
% [d, e, info] = f07jd(d, e, 'n', n);
[b, info] = f07je(d, e, b, 'n', n, 'nrhs_p', nrhs_p);
end```
Note that the answer is now in b.

### (f04ja)

Withdrawn at Mark 23.
Replaced by nag_lapack_dgelss (f08ka).
```Old: [a, b, sigma, irank, work, ifail] = f04ja(a, b, tol, lwork, 'm', m, 'n', n);
New: [a, b, s, rank, info] = f08ka(a, b, rcond, 'm', m, 'n', n, 'nrhs_p', nrhs_p);```
Note that the answer is now in b, singular values are in s instead of work, and the standard error is not computed.

### (f04jd)

Withdrawn at Mark 23.
Replaced by nag_lapack_dgelss (f08ka).
```Old: [a, b, sigma, irank, work, ifail] = f04jd(a, b, tol, lwork, 'm', m, 'n', n);
New: [a, b, s, irank, info] = f08ka(a, b, rcond, 'm', m, 'n', n, 'nrhs_p', nrhs_p);```
Note that the answer is now in b, singular values are in s instead of work, and the standard error is not computed.

### (f04jl)

Withdrawn at Mark 23.
Replaced by nag_lapack_dggglm (f08zb).
```Old: [a, b, d, x, y, ifail] = f04jl(a, b, d, 'm', m, 'n', n, 'p', p);
New: [a, b, d, x, y, info] = f08zb(a, b, d, 'm', m, 'n', n, 'p', p);```

### (f04jm)

Withdrawn at Mark 23.
Replaced by nag_lapack_dgglse (f08za).
```Old: [a, b, c, d, x, ifail] = f04jm(a, b, c, d, 'm', m, 'n', n, 'p', p);
New: [a, b, c, d, x, info] = f08za(a, b, c, d, 'm', m, 'n', n, 'p', p);```

### (f04kl)

Withdrawn at Mark 23.
Replaced by nag_lapack_zggglm (f08zp).
```Old: [a, b, d, x, y, ifail] = f04kl(a, b, d, 'm', m, 'n', n, 'p', p);
New: [a, b, d, x, y, info] = f08zp(a, b, d, 'm', m, 'n', n, 'p', p);```

### (f04km)

Withdrawn at Mark 23.
Replaced by nag_lapack_zgglse (f08zn).
```Old: [a, b, c, d, x, ifail] = f04km(a, b, c, d, 'm', m, 'n', n, 'p', p);
New: [a, b, c, d, x, info] = f08zn(a, b, c, d, 'm', m, 'n', n, 'p', p);```

### nag_linsys_real_norm_rcomm (f04yc)

Scheduled for withdrawal at Mark 26.
Replaced by nag_linsys_real_gen_norm_rcomm (f04yd) .
```Old: [icase, x, estnrm, work, iwork, ifail] = ...
f04yc(icase, x, estnrm, work, iwork)
New: [irevcm, x, y, estnrm, work, iwork, ifail] = ...
f04yd(irevcm, x, y, estnrm, seed, work, iwork)
```
nag_linsys_real_gen_norm_rcomm (f04yd) returns an estimate of the $1$-norm of a rectangular $M×N$ matrix, whereas f04yc only works with square matrices. The real array X, which was previously used to return matrix–vector products to f04yc, has been replaced with two real arrays ${\mathbf{x}}\left({\mathbf{ldx}},*\right)$ and ${\mathbf{y}}\left({\mathbf{ldy}},*\right)$ which are used to return matrix-matrix products to nag_linsys_real_gen_norm_rcomm (f04yd). Here, ${\mathbf{ldx}}\ge {\mathbf{n}}$, ${\mathbf{ldy}}\ge {\mathbf{m}}$ and the second dimensions of x and y are at least of size t, where you can choose argument t. The sizes of the workspace arrays work and iwork have been increased to ${\mathbf{m}}×{\mathbf{t}}$ and $2×{\mathbf{n}}+5×{\mathbf{t}}+20$ respectively. The integer seed provides a seed for the random number generator used by nag_linsys_real_gen_norm_rcomm (f04yd). The integer icase has been replaced by irevcm, which can take the values $0$, $1$ or $2$. See the function documentation for nag_linsys_real_gen_norm_rcomm (f04yd) further details about the reverse communication interface.

### nag_linsys_complex_norm_rcomm (f04zc)

Scheduled for withdrawal at Mark 26.
Replaced by nag_linsys_complex_gen_norm_rcomm (f04zd).
```Old: [icase, x, estnrm, work, ifail] = f04zc(icase, x, estnrm, work)
New: [irevcm, x, y, estnrm, work, rwork, iwork, ifail] = ...
f04zd(irevcm, x, y, estnrm, seed, work, rwork, iwork)
```
nag_linsys_complex_gen_norm_rcomm (f04zd) returns an estimate of the $1$norm of a rectangular $M×N$ matrix, whereas f04zc only works with square matrices. The complex array X, which was previously used to return matrix–vector products to f04zc, has been replaced with two complex arrays ${\mathbf{x}}\left({\mathbf{ldx}},*\right)$ and ${\mathbf{y}}\left({\mathbf{ldy}},*\right)$ which are used to return matrix-matrix products to nag_linsys_complex_gen_norm_rcomm (f04zd). Here, ${\mathbf{ldx}}\ge {\mathbf{n}}$, ${\mathbf{ldy}}\ge {\mathbf{m}}$ and the second dimensions of x and y are at least of size t, where you can choose the argument t. The sizes of the workspace arrays work and iwork have been increased to ${\mathbf{m}}×{\mathbf{t}}$ and $2×{\mathbf{n}}+5×{\mathbf{t}}+20$ respectively and there is an additional real workspace array rwork of size $2×{\mathbf{n}}$. The integer seed provides a seed for the random number generator used by nag_linsys_complex_gen_norm_rcomm (f04zd). The integer icase has been replaced by irevcm, which can take the values $0$, $1$ or $2$. See the function documentation for nag_linsys_complex_gen_norm_rcomm (f04zd) for further details about the reverse communication interface.

## F11 – Large Scale Linear Systems

### (f11ga)

Withdrawn at Mark 22.
Replaced by nag_sparse_real_symm_basic_setup (f11gd).
```Old: [lwreq, ifail] = f11ga(method, precon, n, tol, maxitn, anorm, sigmax, ...
maxits, monit, 'sigcmp', sigcmp, 'norm_p', norm_p, ...
'weight', weight, 'iterm', iterm, 'sigtol', sigtol)
New: [lwreq, work, ifail] = f11gd(method, precon, n, tol, maxitn, anorm, sigmax, ...
maxits, monit, 'sigcmp', sigcmp, 'norm_p', norm_p, ...
'weight', weight, 'iterm', iterm, 'sigtol', sigtol) ```
nag_sparse_real_symm_basic_setup (f11gd) returns an additional argument, work.
See the function document for further information.

### (f11gb)

Withdrawn at Mark 22.
Replaced by nag_sparse_real_symm_basic_solver (f11ge).
```Old: [irevcm, u, v, work, ifail] = f11gb(irevcm, u, v, work, 'n', n, 'lwork', lwork)
New: [irevcm, u, v, work, ifail] = f11ge(irevcm, u, v, wgt, work);```
wgt must be a one-dimensional double array of length at least $n$ (the order of the matrix) if weights are to be used in the termination criterion, and $1$ otherwise. Note that the call to nag_sparse_real_symm_basic_solver (f11ge) requires the weights to be supplied in ${\mathbf{wgt}}\left(1:n\right)$ rather than ${\mathbf{work}}\left(1:n\right)$.

### (f11gc)

Withdrawn at Mark 22.
Replaced by nag_sparse_real_symm_basic_diag (f11gf).
```Old: [itn, stplhs, stprhs, anorm, sigmax, its, sigerr, ifail] = f11gc();
New: [itn, stplhs, stprhs, anorm, sigmax, its, sigerr, ifail] = f11gf(work);```
nag_sparse_real_symm_basic_diag (f11gf) takes an additional argument, work.
See the function document for further information.

## G01 – Simple Calculations on Statistical Data

### nag_stat_summary_1var (g01aa)

Scheduled for withdrawal at Mark 26.
Replaced by nag_stat_summary_onevar (g01at).
```Old: [xmean, s2, s3, s4, xmin, xmax, iwt, wtsum, ifail] = g01aa(x)
New: pn = nag_int(0)
[pn, xmean, xsd, xskew, xkurt, xmin, xmax, rcomm, ifail] = ...
g01at(x, pn, rcomm)
iwt = pn
wtsum = rcomm(1)
```

## G05 – Random Number Generators

### (g05ca)

Withdrawn at Mark 22.
Replaced by nag_rand_dist_uniform01 (g05sa).
```Old: for i=1:n
x(i) = g05ca;
end
New: [state, x, ifail] = g05sa(n, state);```
The integer array state in the call to nag_rand_dist_uniform01 (g05sa) contains information on the base generator being used. This array must have been initialized prior to calling nag_rand_dist_uniform01 (g05sa) with a call to either nag_rand_init_repeat (g05kf) or nag_rand_init_nonrepeat (g05kg). Due to changes in the underlying code the sequence of values produced by nag_rand_dist_uniform01 (g05sa) is likely to be different from those produced by g05ca.

### (g05cb)

Withdrawn at Mark 22.
Replaced by nag_rand_init_repeat (g05kf).
```Old: g05cb(ii);
New: genid = nag_int(ii);
subid = nag_int(1);
seed  = [nag_int(1)];
[state, ifail] = g05kf(genid, subid, seed);```
The integer array state in the call to nag_rand_init_repeat (g05kf) 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 nag_rand_init_repeat (g05kf) is likely to be different from a sequence produced by a generator initialized by g05cb, even if the same value for ii is used.

### (g05cc)

Withdrawn at Mark 22.
Replaced by nag_rand_init_nonrepeat (g05kg).
```Old: g05cc;
New: genid = nag_int(1);
subid = nag_int(1);
[state, ifail] = g05kg(genid, subid);```
The integer array state in the call to nag_rand_init_nonrepeat (g05kg) contains information on the base generator being used. The base generator is chosen via the integer arguments genid and subid.

### (g05cf)

Withdrawn at Mark 22.
There is no replacement for this routine.
```Old: [ia, xi, ifail] = g05cf(ni, nx);
New: cstate = state;```
The state of the base generator for the group of functions nag_rand_init_repeat (g05kf), nag_rand_init_nonrepeat (g05kg), nag_rand_init_leapfrog (g05kh), nag_rand_init_skipahead (g05kj), nag_rand_permute (g05nc), nag_rand_sample (g05nd), nag_rand_times_garch_asym1 (g05pd)nag_rand_matrix_2waytable (g05pz), nag_rand_copula_students_t (g05rc)nag_rand_multivar_normal (g05rz), 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).

### (g05cg)

Withdrawn at Mark 22.
There is no replacement for this routine.
```Old: [ifail] = g05cg(ia, xa, 'ni', ni, 'nx', nx)
New: lstate = cstate(1);
state(1:lstate) = cstate(1:lstate);```
The state of the base generator for the group of functions nag_rand_init_repeat (g05kf), nag_rand_init_nonrepeat (g05kg), nag_rand_init_leapfrog (g05kh), nag_rand_init_skipahead (g05kj), nag_rand_permute (g05nc), nag_rand_sample (g05nd), nag_rand_times_garch_asym1 (g05pd)nag_rand_matrix_2waytable (g05pz), nag_rand_copula_students_t (g05rc)nag_rand_multivar_normal (g05rz), 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).

### (g05da)

Withdrawn at Mark 22.
Replaced by nag_rand_dist_uniform (g05sq).
```Old: for i=1:n
x(i) = g05da(aa,bb);
end
New: [a, b] = sort([aa, bb]);
[state, x, ifail] = g05sq(n, a, b, state);```
The old function g05da returns a single variate at a time, whereas the new function nag_rand_dist_uniform (g05sq) returns a vector of n values in one go. In nag_rand_dist_uniform (g05sq) 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 g05da.
The integer array state in the call to nag_rand_dist_uniform (g05sq) contains information on the base generator being used. This array must have been initialized prior to calling nag_rand_dist_uniform (g05sq) with a call to either nag_rand_init_repeat (g05kf) or nag_rand_init_nonrepeat (g05kg). Due to changes in the underlying code the sequence of values produced by nag_rand_dist_uniform (g05sq) is likely to be different from those produced by g05da.

### (g05db)

Withdrawn at Mark 22.
Replaced by nag_rand_dist_exp (g05sf).
```Old: for i=1:n
x(i) = g05db(a);
end
New: [state, x, ifail] = g05sf(n, abs(a), state);```
The old function g05db returns a single variate at a time, whereas the new function nag_rand_dist_exp (g05sf) returns a vector of n values in one go. In nag_rand_dist_exp (g05sf) argument a must be non-negative, this was not the case for the equivalent argument in g05db.
The integer array state in the call to nag_rand_dist_exp (g05sf) contains information on the base generator being used. This array must have been initialized prior to calling nag_rand_dist_exp (g05sf) with a call to either nag_rand_init_repeat (g05kf) or nag_rand_init_nonrepeat (g05kg). Due to changes in the underlying code the sequence of values produced by nag_rand_dist_exp (g05sf) is likely to be different from those produced by g05db.

### (g05dc)

Withdrawn at Mark 22.
Replaced by nag_rand_dist_logistic (g05sl).
```Old: for  i=1:n
x(i) = g05dc(a,b);
end
New: [state, x, ifail] = g05sl(n, a, abs(b), state);```
The old function g05dc returns a single variate at a time, whereas the new function nag_rand_dist_logistic (g05sl) returns a vector of n values in one go. In nag_rand_dist_logistic (g05sl) the spread (argument a) must be positive, this was not the case for the equivalent arguments in g05dc.
The integer array state in the call to nag_rand_dist_logistic (g05sl) contains information on the base generator being used. This array must have been initialized prior to calling nag_rand_dist_logistic (g05sl) with a call to either nag_rand_init_repeat (g05kf) or nag_rand_init_nonrepeat (g05kg). Due to changes in the underlying code the sequence of values produced by nag_rand_dist_logistic (g05sl) is likely to be different from those produced by g05dc.

### (g05dd)

Withdrawn at Mark 22.
Replaced by nag_rand_dist_normal (g05sk).
```Old: for i=1:n
x(i) = g05dd(xmu, sd);
end
New: [state, x, ifail] = g05sk(n, xmu, sd^2, state);```
The old function g05dd returns a single variate at a time, whereas the new function nag_rand_dist_normal (g05sk) returns a vector of n values in one go. nag_rand_dist_normal (g05sk) expects the variance of the Normal distribution (argument var), compared to g05dd which expected the standard deviation.
The integer array state in the call to nag_rand_dist_normal (g05sk) contains information on the base generator being used. This array must have been initialized prior to calling nag_rand_dist_normal (g05sk) with a call to either nag_rand_init_repeat (g05kf) or nag_rand_init_nonrepeat (g05kg). Due to changes in the underlying code the sequence of values produced by nag_rand_dist_normal (g05sk) is likely to be different from those produced by g05dd.

### (g05de)

Withdrawn at Mark 22.
Replaced by nag_rand_dist_lognormal (g05sm).
```Old: for i=1:n
x(i) = g05de(xmu, sd);
end
New: [state, x, ifail] = g05sm(n, xmu, sd^2, state);```
The old function g05de returns a single variate at a time, whereas the new function nag_rand_dist_lognormal (g05sm) returns a vector of n values in one go. nag_rand_dist_lognormal (g05sm) expects the variance of the corresponding Normal distribution (argument var), compared to g05de which expected the standard deviation.
The integer array state in the call to nag_rand_dist_lognormal (g05sm) contains information on the base generator being used. This array must have been initialized prior to calling nag_rand_dist_lognormal (g05sm) with a call to either nag_rand_init_repeat (g05kf) or nag_rand_init_nonrepeat (g05kg). Due to changes in the underlying code the sequence of values produced by nag_rand_dist_lognormal (g05sm) is likely to be different from those produced by g05de.

### (g05df)

Withdrawn at Mark 22.
Replaced by nag_rand_dist_cauchy (g05sc).
```Old: for i=1:n
x(i) = g05df(xmed, b);
end
New: [state, x, ifail] = g05sc(n, xmed, abs(b), state);```
The old function g05df returns a single variate at a time, whereas the new function nag_rand_dist_cauchy (g05sc) returns a vector of n values in one go. nag_rand_dist_cauchy (g05sc) expects the semi-interquartile range (argument semiqr) to be non-negative, this was not the case for the equivalent argument in g05df.
The integer array state in the call to nag_rand_dist_cauchy (g05sc) contains information on the base generator being used. This array must have been initialized prior to calling nag_rand_dist_cauchy (g05sc) with a call to either nag_rand_init_repeat (g05kf) or nag_rand_init_nonrepeat (g05kg). Due to changes in the underlying code the sequence of values produced by nag_rand_dist_cauchy (g05sc) is likely to be different from those produced by g05df.

### (g05dh)

Withdrawn at Mark 22.
Replaced by nag_rand_dist_chisq (g05sd).
```Old: for i=1:n
[x(i), ifail] = g05dh(df);
end
New: [state, x, ifail] = g05sd(n, df, state);```
The old function g05dh returns a single variate at a time, whereas the new function nag_rand_dist_chisq (g05sd) returns a vector of n values in one go.
The integer array state in the call to nag_rand_dist_chisq (g05sd) contains information on the base generator being used. This array must have been initialized prior to calling nag_rand_dist_chisq (g05sd) with a call to either nag_rand_init_repeat (g05kf) or nag_rand_init_nonrepeat (g05kg). Due to changes in the underlying code the sequence of values produced by nag_rand_dist_chisq (g05sd) is likely to be different from those produced by g05dh.

### (g05dj)

Withdrawn at Mark 22.
Replaced by nag_rand_dist_students_t (g05sn).
```Old: for i=1:n
[x(i), ifail] = g05dj(df);
end
New: [state, x, ifail] = g05sn(n, df, state);```
The old function g05dj returns a single variate at a time, whereas the new function nag_rand_dist_students_t (g05sn) returns a vector of n values in one go.
The integer array state in the call to nag_rand_dist_students_t (g05sn) contains information on the base generator being used. This array must have been initialized prior to calling nag_rand_dist_students_t (g05sn) with a call to either nag_rand_init_repeat (g05kf) or nag_rand_init_nonrepeat (g05kg). Due to changes in the underlying code the sequence of values produced by nag_rand_dist_students_t (g05sn) is likely to be different from those produced by g05dj.

### (g05dk)

Withdrawn at Mark 22.
Replaced by nag_rand_dist_f (g05sh).
```Old: for i=1:n
[x(i), ifail] = g05df(df1, df2);
end
New: [state, x, ifail] = g05sh(n, df1, df2, state);```
The old function g05dk returns a single variate at a time, whereas the new function nag_rand_dist_f (g05sh) returns a vector of n values in one go.
The integer array state in the call to nag_rand_dist_f (g05sh) contains information on the base generator being used. This array must have been initialized prior to calling nag_rand_dist_f (g05sh) with a call to either nag_rand_init_repeat (g05kf) or nag_rand_init_nonrepeat (g05kg). Due to changes in the underlying code the sequence of values produced by nag_rand_dist_f (g05sh) is likely to be different from those produced by g05dk.

### (g05dp)

Withdrawn at Mark 22.
Replaced by nag_rand_dist_weibull (g05ss).
```Old: for i=1:n
[x(i), ifail] = g05pd(a, b);
end
New: [state, x, ifail] = g05ss(n, a, b, state);```
The old function g05dp returns a single variate at a time, whereas the new function nag_rand_dist_weibull (g05ss) returns a vector of n values in one go.
The integer array state in the call to nag_rand_dist_weibull (g05ss) contains information on the base generator being used. This array must have been initialized prior to calling nag_rand_dist_weibull (g05ss) with a call to either nag_rand_init_repeat (g05kf) or nag_rand_init_nonrepeat (g05kg). Due to changes in the underlying code the sequence of values produced by nag_rand_dist_weibull (g05ss) is likely to be different from those produced by g05dp.

### (g05dr)

Withdrawn at Mark 22.
Replaced by nag_rand_int_poisson_varmean (g05tk).
```Old: for i=1:n
[x(i), ifail] = g05dr(lambda);
end
New: [r, state, x, ifail] = g05tj(nag_int(3), n, lambda, r, state);```
The old function g05dr returns a single variate at a time, whereas the new function nag_rand_int_poisson (g05tj) returns a vector of n values in one go. For efficiency, the new function can make use of a reference vector, r. If, as in this case, the integer argument mode is set to 3, the real reference vector r is not referenced.
The integer array state in the call to nag_rand_int_poisson (g05tj) contains information on the base generator being used. This array must have been initialized prior to calling nag_rand_int_poisson (g05tj) with a call to either nag_rand_init_repeat (g05kf) or nag_rand_init_nonrepeat (g05kg). Due to changes in the underlying code the sequence of values produced by nag_rand_int_poisson (g05tj) is likely to be different from those produced by g05dr.

### (g05dy)

Withdrawn at Mark 22.
Replaced by nag_rand_int_uniform (g05tl).
```Old: for i=1:n
x(i) = g05dy(aa, bb);
end
New: [a, b] = sort([aa, bb]);
[state, x, ifail] = g05tl(n, a, b, state);```
The old function g05dy returns a single variate at a time, whereas the new function nag_rand_int_uniform (g05tl) returns a vector of n values in one go. In nag_rand_int_uniform (g05tl) 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 g05dy.
The integer array state in the call to nag_rand_int_uniform (g05tl) contains information on the base generator being used. This array must have been initialized prior to calling nag_rand_int_uniform (g05tl) with a call to either nag_rand_init_repeat (g05kf) or nag_rand_init_nonrepeat (g05kg). Due to changes in the underlying code the sequence of values produced by nag_rand_int_uniform (g05tl) is likely to be different from those produced by g05dy.

### (g05dz)

Withdrawn at Mark 22.
Replaced by nag_rand_logical (g05tb).
```Old: for i=1:n
x(i) = g05dz(pp);
end
New: p = max(0, min(pp, 1));
[state, x, ifail] = g05tb(n, p, state);```
The old function g05dz returns a single variate at a time, whereas the new function nag_rand_logical (g05tb) returns a vector of n values in one go. The double argument p in nag_rand_logical (g05tb) must not be less than zero or greater than one, this was not the case for the equivalent argument in g05dz.
The integer array state in the call to nag_rand_logical (g05tb) contains information on the base generator being used. This array must have been initialized prior to calling nag_rand_logical (g05tb) with a call to either nag_rand_init_repeat (g05kf) or nag_rand_init_nonrepeat (g05kg). Due to changes in the underlying code the sequence of values produced by nag_rand_logical (g05tb) is likely to be different from those produced by g05dz.

### (g05ea)

Withdrawn at Mark 22.
Replaced by nag_rand_multivar_normal (g05rz).
```Old: [r1, ifail] = g05ea(xmu, c, eps, lr1, 'n', m);
New: [r, state, x, ifail] = g05rz(nag_int(0), n, xmu, c, r, state, 'm', m, 'lr', lr);```
The old function g05ea sets up a reference vector for use by g05ez. The functionality of both these functions has been combined into the single new function nag_rand_multivar_normal (g05rz). Setting ${\mathbf{mode}}=0$ in the call to nag_rand_multivar_normal (g05rz) only sets up the double reference vector r and hence mimics the functionality of g05ea.
The length of the double reference vector, r, in nag_rand_multivar_normal (g05rz) must be at least ${\mathbf{m}}×\left({\mathbf{m}}+1\right)+1$. In contrast to the equivalent argument in g05ea, this array must be allocated in the calling program.

### (g05eb)

Withdrawn at Mark 22.
Replaced by nag_rand_int_uniform (g05tl).
There is no direct replacement for function g05eb. g05eb sets up a reference vector for use by g05ey, this reference vector is no longer required. The replacement function for g05ey is nag_rand_int_uniform (g05tl).

### (g05ec)

Withdrawn at Mark 22.
Replaced by nag_rand_int_poisson (g05tj).
```Old: [r1, ifail] = g05ec(lambda, lr1);
for i=1:n
x(i) = g05ey(r1);
end
New: [r, state, x, ifail] = g05tj(nag_int(2), n, lambda, r, state);```
The old function g05ec sets up a reference vector for use by g05ey. The replacement function nag_rand_int_poisson (g05tj) is now used to both set up a reference vector and generate the required variates. Setting ${\mathbf{mode}}=0$ in the call to nag_rand_int_poisson (g05tj) sets up the double reference vector r and hence mimics the functionality of g05ec. Setting ${\mathbf{mode}}=1$ generates a series of variates from a reference vector mimicking the functionality of g05ey for this particular distribution. Setting ${\mathbf{mode}}=2$ initializes the reference vector and generates the variates in one go.
The function g05ey returns a single variate at a time, whereas the new function nag_rand_int_poisson (g05tj) returns a vector of n values in one go.
The length of the double reference vector, r, in nag_rand_int_poisson (g05tj), must be allocated in the calling program in contrast to the equivalent argument in g05ec, see the documentation for more details.
The integer array state in the call to nag_rand_int_poisson (g05tj) contains information on the base generator being used. This array must have been initialized prior to calling nag_rand_int_poisson (g05tj) with a call to either nag_rand_init_repeat (g05kf) or nag_rand_init_nonrepeat (g05kg). Due to changes in the underlying code the sequence of values produced by nag_rand_int_poisson (g05tj) is likely to be different from those produced by a combination of g05ec and g05ey.

### (g05ed)

Withdrawn at Mark 22.
Replaced by nag_rand_int_binomial (g05ta).
```Old: [r1, ifail] = g05ed(m, p, lr1);
for i=1:n
x(i) = g05ey(r1);
end
New: [r, state, x, ifail] = g05ta(nag_int(2), n, m, p, r, state);```
The old function g05ed sets up a reference vector for use by g05ey. The replacement function nag_rand_int_binomial (g05ta) is now used to both set up a reference vector and generate the required variates. Setting ${\mathbf{mode}}=0$ in the call to nag_rand_int_binomial (g05ta) sets up the double reference vector r and hence mimics the functionality of g05ed. Setting ${\mathbf{mode}}=1$ generates a series of variates from a reference vector mimicking the functionality of g05ey for this particular distribution. Setting ${\mathbf{mode}}=2$ initializes the reference vector and generates the variates in one go.
The function g05ey returns a single variate at a time, whereas the new function nag_rand_int_binomial (g05ta) returns a vector of n values in one go.
The length of the double reference vector, r, in nag_rand_int_binomial (g05ta), needs to be a different length from the equivalent argument in g05ed, see the documentation for more details.
The integer array state in the call to nag_rand_int_binomial (g05ta) contains information on the base generator being used. This array must have been initialized prior to calling nag_rand_int_binomial (g05ta) with a call to either nag_rand_init_repeat (g05kf) or nag_rand_init_nonrepeat (g05kg). Due to changes in the underlying code the sequence of values produced by nag_rand_int_binomial (g05ta) is likely to be different from those produced by a combination of g05ed and g05ey.

### (g05ee)

Withdrawn at Mark 22.
Replaced by nag_rand_int_negbin (g05th).
```Old: [r1, ifail] = g05ee(m, p, lr1);
for i=1:n
x(i) = g05ey(r1);
end
New: [r, state, x, ifail] = g05th(nag_int(2), n, m, p, r, state);```
The old function g05ee sets up a reference vector for use by g05ey. The replacement function nag_rand_int_negbin (g05th) is now used to both set up a reference vector and generate the required variates. Setting ${\mathbf{mode}}=0$ in the call to nag_rand_int_negbin (g05th) sets up the double reference vector r and hence mimics the functionality of g05ee. Setting ${\mathbf{mode}}=1$ generates a series of variates from a reference vector mimicking the functionality of g05ey for this particular distribution. Setting ${\mathbf{mode}}=2$ initializes the reference vector and generates the variates in one go.
The function g05ey returns a single variate at a time, whereas the new function nag_rand_int_negbin (g05th) returns a vector of n values in one go.
The length of the double reference vector, r, in nag_rand_int_negbin (g05th), needs to be a different length from the equivalent argument in g05ee, see the documentation for nag_rand_int_negbin (g05th) for more details.
The integer array state in the call to nag_rand_int_negbin (g05th) contains information on the base generator being used. This array must have been initialized prior to calling nag_rand_int_negbin (g05th) with a call to either nag_rand_init_repeat (g05kf) or nag_rand_init_nonrepeat (g05kg). Due to changes in the underlying code the sequence of values produced by nag_rand_int_negbin (g05th) is likely to be different from those produced by a combination of g05ee and g05ey.

### (g05ef)

Withdrawn at Mark 22.
Replaced by nag_rand_int_hypergeom (g05te).
```Old: [r1, ifail] = g05ef(ns, m, np, lr1);
for i=1:n
x(i) = g05ey(r1);
end
New: [r, state, x, ifail] = g05te(nag_int(2), n, ns, np, m, r, state);```
The old function g05ef sets up a reference vector for use by g05ey. The replacement function nag_rand_int_hypergeom (g05te) is now used to both set up a reference vector and generate the required variates. Setting ${\mathbf{mode}}=0$ in the call to nag_rand_int_hypergeom (g05te) sets up the double reference vector r and hence mimics the functionality of g05ef. Setting ${\mathbf{mode}}=1$ generates a series of variates from a reference vector mimicking the functionality of g05ey for this particular distribution. Setting ${\mathbf{mode}}=2$ initializes the reference vector and generates the variates in one go.
The function g05ey returns a single variate at a time, whereas the new function nag_rand_int_hypergeom (g05te) returns a vector of n values in one go.
The length of the double reference vector, r, in nag_rand_int_hypergeom (g05te), needs to be a different length from the equivalent argument in g05ef, see the documentation for more details.
The integer array state in the call to nag_rand_int_hypergeom (g05te) contains information on the base generator being used. This array must have been initialized prior to calling nag_rand_int_hypergeom (g05te) with a call to either nag_rand_init_repeat (g05kf) or nag_rand_init_nonrepeat (g05kg). Due to changes in the underlying code the sequence of values produced by nag_rand_int_hypergeom (g05te) is likely to be different from those produced by a combination of g05ef and g05ey.

### (g05eg)

Withdrawn at Mark 22.
Replaced by nag_rand_times_arma (g05ph).
```Old: [r, var, ifail] = g05eg(e, a, b, nr, 'na', na, 'nb', nb)
New: theta = zeros(iq, 1);
avar = b(1)^2;
if avar > 0
for i=1:nb-1
theta(i) = -b(i+1)/b(1);
end
end
mode = nag_int(0);
[r, state, var, x, ifail] = g05ph(mode, n, e, na, a, nb-1, theta, avar, r, state);```
The double vector theta must be of length at least ${\mathbf{iq}}=\mathrm{nb}-1$.
The old function g05eg sets up a reference vector for use by g05ew. The replacement function nag_rand_times_arma (g05ph) is now used to both set up a reference vector and generate the required variates. Setting ${\mathbf{mode}}=0$ in the call to nag_rand_times_arma (g05ph) sets up the double reference vector r and hence mimics the functionality of g05eg. When ${\mathbf{mode}}=0$, the integer array state in the call to nag_rand_times_arma (g05ph) need not be set.

### (g05eh)

Withdrawn at Mark 22.
Replaced by nag_rand_permute (g05nc).
```Old: [index, ifail] = g05eh(index, 'n', n);
New: [index, state, ifail] = g05nc(index, state, 'n', n);```
The integer array state in the call to nag_rand_permute (g05nc) contains information on the base generator being used. This array must have been initialized prior to calling nag_rand_permute (g05nc) with a call to either nag_rand_init_repeat (g05kf) or nag_rand_init_nonrepeat (g05kg). Due to changes in the underlying code the sequence of values produced by nag_rand_permute (g05nc) is likely to be different from those produced by g05eh.

### (g05ej)

Withdrawn at Mark 22.
Replaced by nag_rand_sample (g05nd).
```Old: [iz, ifail] = g05ej(ia, m, 'n', n);
New: [iz, state, ifail] = g05nd(ia, m, state, 'n', n);```
The integer array state in the call to nag_rand_sample (g05nd) contains information on the base generator being used. This array must have been initialized prior to calling nag_rand_sample (g05nd) with a call to either nag_rand_init_repeat (g05kf) or nag_rand_init_nonrepeat (g05kg). Due to changes in the underlying code the sequence of values produced by nag_rand_sample (g05nd) is likely to be different from those produced by g05ej.

### (g05ew)

Withdrawn at Mark 22.
Replaced by nag_rand_times_arma (g05ph).
```Old: [r, var, ifail] = g05eg(e, a, b, nr, 'na', na, 'nb', nb)
for i=1:n
[x(i), ifail] = g05ew(r);
end
New: theta = zeros(iq, 1);
avar = b(1)^2;
if avar > 0
for i=1:nb-1
theta(i) = -b(i+1)/b(1);
end
end
mode = nag_int(2);
[r, state, var, x, ifail] = g05ph(mode, n, e, na, a, nb-1, theta, avar, r,
state);
```
The double vector theta must be of length at least ${\mathbf{iq}}=\mathrm{nb}-1$.
The old function g05eg sets up a reference vector for use by g05ew. The replacement function nag_rand_times_arma (g05ph) is now used to both set up a reference vector and generate the required variates. Setting the integer argument mode to 0 in the call to nag_rand_times_arma (g05ph) sets up the double reference vector r and hence mimics the functionality of g05eg. Setting mode to 1 generates a series of variates from a reference vector mimicking the functionality of g05ew. Setting mode to 2 initializes the reference vector and generates the variates in one go.
The integer array state in the call to nag_rand_times_arma (g05ph) contains information on the base generator being used. This array must have been initialized prior to calling nag_rand_times_arma (g05ph) with a call to either nag_rand_init_repeat (g05kf) or nag_rand_init_nonrepeat (g05kg). Due to changes in the underlying code the sequence of values produced by nag_rand_times_arma (g05ph) is likely to be different from those produced by g05eg.

### (g05ex)

Withdrawn at Mark 22.
Replaced by nag_rand_int_general (g05td).
```Old: [r1, ifail] = g05ex(p, ip1, itype, lr1, 'np', np)
for i=1:n
x(i) = g05ey(r1);
end
New: mode = nag_int(2);
[r, state, x, ifail] = g05td(mode, n, p, ip1, itype, r, state, 'np', np);```
The old function g05ex sets up a reference vector for use by g05ey. The replacement function nag_rand_int_general (g05td) is now used to both set up a reference vector and generate the required variates. Setting ${\mathbf{mode}}=0$ in the call to nag_rand_int_general (g05td) sets up the double reference vector r and hence mimics the functionality of g05ex. Setting ${\mathbf{mode}}=1$ generates a series of variates from a reference vector mimicking the functionality of g05ey for this particular distribution. Setting ${\mathbf{mode}}=2$ initializes the reference vector and generates the variates in one go.
The function g05ey returns a single variate at a time, whereas the new function nag_rand_int_general (g05td) returns a vector of n values in one go.
The length of the double reference vector, r, in nag_rand_int_general (g05td) must be allocated in the calling program in contrast to the equivalent argument in g05ex, see the documentation for more details.
The integer array state in the call to nag_rand_int_general (g05td) contains information on the base generator being used. This array must have been initialized prior to calling nag_rand_int_general (g05td) with a call to either nag_rand_init_repeat (g05kf) or nag_rand_init_nonrepeat (g05kg). Due to changes in the underlying code the sequence of values produced by nag_rand_int_general (g05td) is likely to be different from those produced by a combination of g05ex, g05ey.

### (g05ey)

Withdrawn at Mark 22.
Replaced by nag_rand_int_general (g05td).
There is no direct replacement function for g05ey.
g05ey 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 g05eb, which have themselves been superseded. In order to replace a call to g05ey you must identify which NAG function generated the reference vector being used and look up its replacement. For example, to replace a call to g05ey preceded by a call to g05eb, as in:
```    [r, ifail] = g05eb(m, n, nr);
x = g05ey(r);```
you would need to look at the replacement function for g05eb.

### (g05ez)

Withdrawn at Mark 22.
Replaced by nag_rand_multivar_normal (g05rz).
```Old: [r1, ifail] = g05ea(xmu, c, eps, lr1, 'n', n);
for i=1:n
[x(i,1:m), ifail] = g05ez(m, r);
end
New: mode = nag_int(2);
[r, state, x, ifail] = g05rz(mode, n, xmu, c, r, state, 'm', m, 'lr', lr);```
The old function g05ea sets up a reference vector for use by g05ez. The functionality of both these functions has been combined into the single new function nag_rand_multivar_normal (g05rz). Setting ${\mathbf{mode}}=2$ in the call to nag_rand_multivar_normal (g05rz) sets up the double reference vector r and generates the draws from the multivariate Normal distribution in one go.
The old function g05ez returns a single (m-dimensional vector) draw from the multivariate Normal distribution at a time, whereas the new function nag_rand_multivar_normal (g05rz) returns an n by m matrix of n draws in one go.
The integer array state in the call to nag_rand_multivar_normal (g05rz) contains information on the base generator being used. This array must have been initialized prior to calling nag_rand_multivar_normal (g05rz) with a call to either nag_rand_init_repeat (g05kf) or nag_rand_init_nonrepeat (g05kg). Due to changes in the underlying code the sequence of values produced by nag_rand_multivar_normal (g05rz) is likely to be different from those produced by g05ez.

### (g05fa)

Withdrawn at Mark 22.
Replaced by nag_rand_dist_uniform (g05sq).
```Old: [x] = g05fa(aa, bb, n);
New: [a, b] = sort([aa, bb]);
[state, x, ifail] = g05sq(n, a, b, state);```
In nag_rand_dist_uniform (g05sq) 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 g05fa.
The integer array state in the call to nag_rand_dist_uniform (g05sq) contains information on the base generator being used. This array must have been initialized prior to calling nag_rand_dist_uniform (g05sq) with a call to either nag_rand_init_repeat (g05kf) or nag_rand_init_nonrepeat (g05kg). Due to changes in the underlying code the sequence of values produced by nag_rand_dist_uniform (g05sq) is likely to be different from those produced by g05fa.

### (g05fb)

Withdrawn at Mark 22.
Replaced by nag_rand_dist_exp (g05sf).
```Old: x = g05fb(a, n);
New: [state, x, ifail] = g05sf(n, abs(a), state);```
In nag_rand_dist_exp (g05sf) argument a must be non-negative, this was not the case for the equivalent argument in g05fb.
The integer array state in the call to nag_rand_dist_exp (g05sf) contains information on the base generator being used. This array must have been initialized prior to calling nag_rand_dist_exp (g05sf) with a call to either nag_rand_init_repeat (g05kf) or nag_rand_init_nonrepeat (g05kg). Due to changes in the underlying code the sequence of values produced by nag_rand_dist_exp (g05sf) is likely to be different from those produced by g05fb.

### (g05fd)

Withdrawn at Mark 22.
Replaced by nag_rand_dist_normal (g05sk).
```Old: x = g05fd(xmu, sd, n);
New: var = sd^2;
[state, x, ifail] = g05sk(n, xmu, var, state);```
nag_rand_dist_normal (g05sk) expects the variance of the Normal distribution (argument var), compared to g05fd which expected the standard deviation.
The integer array state in the call to nag_rand_dist_normal (g05sk) contains information on the base generator being used. This array must have been initialized prior to calling nag_rand_dist_normal (g05sk) with a call to either nag_rand_init_repeat (g05kf) or nag_rand_init_nonrepeat (g05kg). Due to changes in the underlying code the sequence of values produced by nag_rand_dist_normal (g05sk) is likely to be different from those produced by g05fd.

### (g05fe)

Withdrawn at Mark 22.
Replaced by nag_rand_dist_beta (g05sb).
```Old: [x, ifail] = g05fe(a, b, n);
New: [state, x, ifail] = g05sb(n, a, b, state);```
The integer array state in the call to nag_rand_dist_beta (g05sb) contains information on the base generator being used. This array must have been initialized prior to calling nag_rand_dist_beta (g05sb) with a call to either nag_rand_init_repeat (g05kf) or nag_rand_init_nonrepeat (g05kg). Due to changes in the underlying code the sequence of values produced by nag_rand_dist_beta (g05sb) is likely to be different from those produced by g05fe.

### (g05ff)

Withdrawn at Mark 22.
Replaced by nag_rand_dist_gamma (g05sj).
```Old: [x, ifail] = g05ff(a, b, n);
New: [state, x, ifail] = g05sj(n, a, b, state);```
The integer array state in the call to nag_rand_dist_gamma (g05sj) contains information on the base generator being used. This array must have been initialized prior to calling nag_rand_dist_gamma (g05sj) with a call to either nag_rand_init_repeat (g05kf) or nag_rand_init_nonrepeat (g05kg). Due to changes in the underlying code the sequence of values produced by nag_rand_dist_gamma (g05sj) is likely to be different from those produced by g05ff.

### (g05fs)

Withdrawn at Mark 22.
Replaced by nag_rand_dist_vonmises (g05sr).
```Old: [x, ifail] = g05sf(vk, n);
New: [state, x, ifail] = g05sr(n, vk, state);```
The integer array state in the call to nag_rand_dist_vonmises (g05sr) contains information on the base generator being used. This array must have been initialized prior to calling nag_rand_dist_vonmises (g05sr) with a call to either nag_rand_init_repeat (g05kf) or nag_rand_init_nonrepeat (g05kg). Due to changes in the underlying code the sequence of values produced by nag_rand_dist_vonmises (g05sr) is likely to be different from those produced by g05fs.

### (g05ga)

Withdrawn at Mark 22.
Replaced by nag_rand_matrix_orthog (g05px).
```Old: [a, ifail] = g05ga(side, init, m, a, 'n', n);
New: [state, a, ifail] = g05px(side, init, state, a, 'm', m, 'n', n);```
The integer array state in the call to nag_rand_matrix_orthog (g05px) contains information on the base generator being used. This array must have been initialized prior to calling nag_rand_matrix_orthog (g05px) with a call to either nag_rand_init_repeat (g05kf) or nag_rand_init_nonrepeat (g05kg). Due to changes in the underlying code the sequence of values produced by nag_rand_matrix_orthog (g05px) is likely to be different from those produced by g05ga.

### (g05gb)

Withdrawn at Mark 22.
Replaced by nag_rand_matrix_corr (g05py).
```Old: [c, ifail] = g05gb(d, 'n', n, 'eps', eps);
New: [state, c, ifail] = g05py(d, state, 'n', n, 'eps', eps) ```
The integer array state in the call to nag_rand_matrix_corr (g05py) contains information on the base generator being used. This array must have been initialized prior to calling nag_rand_matrix_corr (g05py) with a call to either nag_rand_init_repeat (g05kf) or nag_rand_init_nonrepeat (g05kg). Due to changes in the underlying code the sequence of values produced by nag_rand_matrix_corr (g05py) is likely to be different from those produced by g05gb.

### (g05hd)

Withdrawn at Mark 22.
Replaced by nag_rand_times_mv_varma (g05pj).
```Old: [w, ref, ifail] = g05hd(mode, ip, iq, mean, par, qq, n, ref, 'k', k, 'lpar', lpar, 'lref', lref)
New: if mode = 'c'
imode = nag_int(0);
else
imode = nag_int(1);
end
ll = 0;
for l=1:ip
for i=1:k
for j=1:k
ll = ll+1;
phi(i, j, l) = par(ll);
end
end
end
for l=1:iq-1
for i=1:k
for j=1:k
ll = ll+1;
theta(i, j, l) = par(ll);
end
end
end
xmean = zeros(k, 1);
if mean = 'm'
xmean = par(ll+1:ll+k+1);
end
[ref, state, x, ifail] = g05pj(imode, n, xmean, ip, phi, iq, theta, ...
qq, ref, state, 'k', k, 'lr', lr) ```
The integer argument imode should be set to 0, 1 or 3 in place of the argument mode having settings of 'S', 'C' or 'R' respectively. The double array phi should have length at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{ip}}×\left({\mathbf{k}}×{\mathbf{k}}\right)\right)$; if dimensioned as ${\mathbf{phi}}\left({\mathbf{k}},{\mathbf{k}},{\mathbf{ip}}\right)$ (as in the above example) then ${\mathbf{phi}}\left(i,j,l\right)$ will contain the element $\mathrm{par}\left(\left(l-1\right)×k×k+\left(i-1\right)×k+j\right)$. The double array theta should have length at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{iq}}×\left({\mathbf{k}}×{\mathbf{k}}\right)\right)$; if dimensioned as ${\mathbf{theta}}\left({\mathbf{k}},{\mathbf{k}},{\mathbf{iq}}\right)$ (as in the above example) then ${\mathbf{theta}}\left(i,j,l\right)$ will contain the element $\mathrm{par}\left(\mathrm{ip}×k×k+\left(l-1\right)×k×k+\left(i-1\right)×k+j\right)$. The double array xmean should have length at least k; if $\mathrm{mean_p}=\text{'M'}$ then ${\mathbf{xmean}}\left(i\right)$ will contain the element $\mathrm{par}\left(\mathrm{ip}+\mathrm{iq}×k×k+i\right)$, otherwise xmean should contain an array of zero values.
The integer array state in the call to nag_rand_times_mv_varma (g05pj) contains information on the base generator being used. This array must have been initialized prior to calling nag_rand_times_mv_varma (g05pj) with a call to either nag_rand_init_repeat (g05kf) or nag_rand_init_nonrepeat (g05kg). Due to changes in the underlying code the sequence of values produced by nag_rand_times_mv_varma (g05pj) is likely to be different from those produced by g05hd.

### nag_rand_withdraw_times_garch_asym1 (g05hk)

Withdrawn at Mark 24.
Replaced by nag_rand_times_garch_asym1 (g05pd).
```Old: [ht, et, rvec, iseed, rwsav, ifail] = g05hk(dist, num, ip, iq, theta, gamma, df, fcall, rvec, igen, iseed, rwsav)
New: [ht, et, r, state, ifail] = g05pd(dist, num, ip, iq, theta, gamma, df, fcall, r, state, 'lr', lr)```
The integer array state in the call to nag_rand_times_garch_asym1 (g05pd) contains information on the base generator being used. This array must have been initialized prior to calling nag_rand_times_garch_asym1 (g05pd) with a call to either nag_rand_init_repeat (g05kf) or nag_rand_init_nonrepeat (g05kg). Due to changes in the underlying code the sequence of values produced by nag_rand_times_garch_asym1 (g05pd) is likely to be different from those produced by g05hk.

### nag_rand_withdraw_times_garch_asym2 (g05hl)

Withdrawn at Mark 24.
Replaced by nag_rand_times_garch_asym2 (g05pe).
```Old: [ht, et, rvec, iseed, rwsav, ifail] = g05hl(dist, num, ip, iq, theta, gamma, df, fcall, rvec, igen, iseed, rwsav);
New: [ht, et, r, state, ifail] = g05pe(dist, num, ip, iq, theta, gamma, df, fcall, r, state, 'lr', lr);```
The integer array state in the call to nag_rand_times_garch_asym2 (g05pe) contains information on the base generator being used. This array must have been initialized prior to calling nag_rand_times_garch_asym2 (g05pe) with a call to either nag_rand_init_repeat (g05kf) or nag_rand_init_nonrepeat (g05kg). Due to changes in the underlying code the sequence of values produced by nag_rand_times_garch_asym2 (g05pe) is likely to be different from those produced by g05hl.

### nag_rand_withdraw_times_garch_gjr (g05hm)

Withdrawn at Mark 24.
Replaced by nag_rand_times_garch_gjr (g05pf).
```Old: [ht, et, rvec, iseed, rwsav, ifail] = g05hm(dist, num, ip, iq, theta, gamma, df, fcall, rvec, igen, iseed, rwsav);
New: [ht, et, r, state, ifail] = g05pf(dist, num, ip, iq, theta, gamma, df, fcall, r, state, 'lr', lr); ```
The integer array state in the call to nag_rand_times_garch_gjr (g05pf) contains information on the base generator being used. This array must have been initialized prior to calling nag_rand_times_garch_gjr (g05pf) with a call to either nag_rand_init_repeat (g05kf) or nag_rand_init_nonrepeat (g05kg). Due to changes in the underlying code the sequence of values produced by nag_rand_times_garch_gjr (g05pf) is likely to be different from those produced by g05hm.

### nag_rand_withdraw_times_garch_exp (g05hn)

Withdrawn at Mark 24.
Replaced by nag_rand_times_garch_exp (g05pg).
```Old: [ht, et, rvec, iseed, rwsav, ifail] = g05hn(dist, num, ip, iq, theta, df, fcall, rvec, igen, iseed, rwsav);
New: [ht, et, r, state, ifail] = g05pg(dist, num, ip, iq, theta, df, fcall, r, state, 'lr', lr);```
The integer array state in the call to nag_rand_times_garch_exp (g05pg) contains information on the base generator being used. This array must have been initialized prior to calling nag_rand_times_garch_exp (g05pg) with a call to either nag_rand_init_repeat (g05kf) or nag_rand_init_nonrepeat (g05kg).

### nag_rand_withdraw_dist_uniform01 (g05ka)

Withdrawn at Mark 24.
Replaced by nag_rand_dist_uniform01 (g05sa).
```Old: for i=1:n
[x(i), iseed] = g05ka(igen, iseed);
end
New: [state, x, ifail] = g05sa(n, state);```
The old function g05ka returns a single variate at a time, whereas the new function nag_rand_dist_uniform01 (g05sa) returns a vector of n values in one go.
The integer array state in the call to nag_rand_dist_uniform01 (g05sa) contains information on the base generator being used. This array must have been initialized prior to calling nag_rand_dist_uniform01 (g05sa) with a call to either nag_rand_init_repeat (g05kf) or nag_rand_init_nonrepeat (g05kg).

### nag_rand_withdraw_init_repeat (g05kb)

Withdrawn at Mark 24.
Replaced by nag_rand_init_repeat (g05kf).
```Old: [igen, iseed] = g05kb(igen, iseed);
New: if (igen == 0)
[state, ifail] = g05kf(nag_int(1), nag_int(1), iseed, 'lseed', lseed);
else
[state, ifail] = g05kf(nag_int(1), igen, iseed, 'lseed', lseed);
end```

### nag_rand_withdraw_init_nonrepeat (g05kc)

Withdrawn at Mark 24.
Replaced by nag_rand_init_nonrepeat (g05kg).
```Old: [igen, iseed] = g05kc(igen);
New: if (igen == 0)
[state, ifail] = g05kg(nag_int(1), nag_int(1));
else
[state, ifail] = g05kg(nag_int(2), igen);
end```

### nag_rand_withdraw_logical (g05ke)

Withdrawn at Mark 24.
Replaced by nag_rand_logical (g05tb).
```Old: for i=1:n
[x(i), iseed, ifail] = g05ke(p, igen, iseed);
end
New: [state, x, ifail] = g05tb(n, p, state);```
The old function g05ke returns a single variate at a time, whereas the new function nag_rand_logical (g05tb) returns a vector of n values in one go.
The integer array state in the call to nag_rand_logical (g05tb) contains information on the base generator being used. This array must have been initialized prior to calling nag_rand_logical (g05tb) with a call to either nag_rand_init_repeat (g05kf) or nag_rand_init_nonrepeat (g05kg).

### nag_rand_withdraw_dist_normal (g05la)

Withdrawn at Mark 24.
Replaced by nag_rand_dist_normal (g05sk).
```Old: [x, iseed, ifail] = g05la(xmu, var, n, igen, iseed);
New: [state, x, ifail] = g05sk(n, xmu, var, state);```
The integer array state in the call to nag_rand_dist_normal (g05sk) contains information on the base generator being used. This array must have been initialized prior to calling nag_rand_dist_normal (g05sk) with a call to either nag_rand_init_repeat (g05kf) or nag_rand_init_nonrepeat (g05kg).

### nag_rand_withdraw_dist_students_t (g05lb)

Withdrawn at Mark 24.
Replaced by nag_rand_dist_students_t (g05sn).
```Old: [x, iseed, ifail] = g05lb(df, n, igen, iseed);
New: [state, x, ifail] = g05sn(n, df, state);```
The integer array state in the call to nag_rand_dist_students_t (g05sn) contains information on the base generator being used. This array must have been initialized prior to calling nag_rand_dist_students_t (g05sn) with a call to either nag_rand_init_repeat (g05kf) or nag_rand_init_nonrepeat (g05kg).

### nag_rand_withdraw_dist_chisq (g05lc)

Withdrawn at Mark 24.
Replaced by nag_rand_dist_chisq (g05sd).
```Old: [x, iseed, ifail] = g05lc(df, n, igen, iseed);
New: [state, x, ifail] = g05sd(n, df, state);```
The integer array state in the call to nag_rand_dist_chisq (g05sd) contains information on the base generator being used. This array must have been initialized prior to calling nag_rand_dist_chisq (g05sd) with a call to either nag_rand_init_repeat (g05kf) or nag_rand_init_nonrepeat (g05kg).

### nag_rand_withdraw_dist_f (g05ld)

Withdrawn at Mark 24.
Replaced by nag_rand_dist_f (g05sh).
```Old: [x, iseed, ifail] = g05ld(df1, df2, n, igen, iseed);
New: [state, x, ifail] = g05sh(n, df1, df2, state);```
The integer array state in the call to nag_rand_dist_f (g05sh) contains information on the base generator being used. This array must have been initialized prior to calling nag_rand_dist_f (g05sh) with a call to either nag_rand_init_repeat (g05kf) or nag_rand_init_nonrepeat (g05kg).

### nag_rand_withdraw_dist_beta (g05le)

Withdrawn at Mark 24.
Replaced by nag_rand_dist_beta (g05sb).
```Old: [x, iseed, ifail] = g05le(a, b, n, igen, iseed);
New: [state, x, ifail] = g05sb(n, a, b, state);```
The integer array state in the call to nag_rand_dist_beta (g05sb) contains information on the base generator being used. This array must have been initialized prior to calling nag_rand_dist_beta (g05sb) with a call to either nag_rand_init_repeat (g05kf) or nag_rand_init_nonrepeat (g05kg).

### nag_rand_withdraw_dist_gamma (g05lf)

Withdrawn at Mark 24.
Replaced by nag_rand_dist_gamma (g05sj).
```Old: [x, iseed, ifail] = g05lf(a, b, n, igen, iseed);
New: [state, x, ifail] = g05sj(n, a, b, state);```
The integer array state in the call to nag_rand_dist_gamma (g05sj) contains information on the base generator being used. This array must have been initialized prior to calling nag_rand_dist_gamma (g05sj) with a call to either nag_rand_init_repeat (g05kf) or nag_rand_init_nonrepeat (g05kg).

### nag_rand_withdraw_dist_uniform (g05lg)

Withdrawn at Mark 24.
Replaced by nag_rand_dist_uniform (g05sq).
```Old: [x, iseed, ifail] = g05lg(a, b, n, igen, iseed);
New: [state, x, ifail] = g05sq(n, a, b, state);```
The integer array state in the call to nag_rand_dist_uniform (g05sq) contains information on the base generator being used. This array must have been initialized prior to calling nag_rand_dist_uniform (g05sq) with a call to either nag_rand_init_repeat (g05kf) or nag_rand_init_nonrepeat (g05kg).

### nag_rand_withdraw_dist_triangular (g05lh)

Withdrawn at Mark 24.
Replaced by nag_rand_dist_triangular (g05sp).
```Old: [x, iseed, ifail] = g05lh(xmin, xmax, xmed, n, igen, iseed);
New: [state, x, ifail] = g05sp(n, xmin, xmed, xmax, state);```
The integer array state in the call to nag_rand_dist_triangular (g05sp) contains information on the base generator being used. This array must have been initialized prior to calling nag_rand_dist_triangular (g05sp) with a call to either nag_rand_init_repeat (g05kf) or nag_rand_init_nonrepeat (g05kg).

### nag_rand_withdraw_dist_exp (g05lj)

Withdrawn at Mark 24.
Replaced by nag_rand_dist_exp (g05sf).
```Old: [x, iseed, ifail] = g05lj(a, n, igen, iseed);
New: [state, x, ifail] = g05sf(n, a, state);```
The integer array state in the call to nag_rand_dist_exp (g05sf) contains information on the base generator being used. This array must have been initialized prior to calling nag_rand_dist_exp (g05sf) with a call to either nag_rand_init_repeat (g05kf) or nag_rand_init_nonrepeat (g05kg).

### nag_rand_withdraw_dist_lognormal (g05lk)

Withdrawn at Mark 24.
Replaced by nag_rand_dist_lognormal (g05sm).
```Old: [x, iseed, ifail] = g05lk(xmu, var, n, igen, iseed);
New: [state, x, ifail] = g05sm(n, xmu, var, state);```
The integer array state in the call to nag_rand_dist_lognormal (g05sm) contains information on the base generator being used. This array must have been initialized prior to calling nag_rand_dist_lognormal (g05sm) with a call to either nag_rand_init_repeat (g05kf) or nag_rand_init_nonrepeat (g05kg).

### nag_rand_withdraw_dist_cauchy (g05ll)

Withdrawn at Mark 24.
Replaced by nag_rand_dist_gamma (g05sj).
```Old: [x, iseed, ifail] = g05ll(xmed, semiqr, n, igen, iseed);
New: [state, x, ifail] = g05sc(n, xmed, semiqr, state);```
The integer array state in the call to nag_rand_dist_cauchy (g05sc) contains information on the base generator being used. This array must have been initialized prior to calling nag_rand_dist_cauchy (g05sc) with a call to either nag_rand_init_repeat (g05kf) or nag_rand_init_nonrepeat (g05kg).

### nag_rand_withdraw_dist_weibull (g05lm)

Withdrawn at Mark 24.
Replaced by nag_rand_dist_weibull (g05ss).
```Old: [x, iseed, ifail] = g05lm(a, b, n, igen, iseed);
New: [state, x, ifail] = g05ss(n, a, b, state);```
The integer array state in the call to nag_rand_dist_weibull (g05ss) contains information on the base generator being used. This array must have been initialized prior to calling nag_rand_dist_weibull (g05ss) with a call to either nag_rand_init_repeat (g05kf) or nag_rand_init_nonrepeat (g05kg).

### nag_rand_withdraw_dist_logistic (g05ln)

Withdrawn at Mark 24.
Replaced by nag_rand_dist_logistic (g05sl).
```Old: [x, iseed, ifail] = g05ln(a, b, n, igen, iseed);
New: [state, x, ifail] = g05sl(n, a, b, state);```
The integer array state in the call to nag_rand_dist_logistic (g05sl) contains information on the base generator being used. This array must have been initialized prior to calling nag_rand_dist_logistic (g05sl) with a call to either nag_rand_init_repeat (g05kf) or nag_rand_init_nonrepeat (g05kg).

### nag_rand_withdraw_dist_vonmises (g05lp)

Withdrawn at Mark 24.
Replaced by nag_rand_dist_vonmises (g05sr).
```Old: [x, iseed, ifail] = g05lp(vk, n, igen, iseed);
New: [state, x, ifail] = g05sr(n, vk, state);```
The integer array state in the call to nag_rand_dist_vonmises (g05sr) contains information on the base generator being used. This array must have been initialized prior to calling nag_rand_dist_vonmises (g05sr) with a call to either nag_rand_init_repeat (g05kf) or nag_rand_init_nonrepeat (g05kg).

### nag_rand_withdraw_dist_expmix (g05lq)

Withdrawn at Mark 24.
Replaced by nag_rand_dist_expmix (g05sg).
```Old: [x, iseed, ifail] = g05lq(a, wgt, n, igen, iseed, 'nmix', nmix);
New: [state, x, ifail] = g05sg(n, a, wgt, state, 'nmix', nmix);```
The integer array state in the call to nag_rand_dist_expmix (g05sg) contains information on the base generator being used. This array must have been initialized prior to calling nag_rand_dist_expmix (g05sg) with a call to either nag_rand_init_repeat (g05kf) or nag_rand_init_nonrepeat (g05kg).

### nag_rand_withdraw_multivar_students_t (g05lx)

Withdrawn at Mark 24.
Replaced by nag_rand_multivar_students_t (g05ry).
```Old: [x, iseed, r, ifail] = g05lx(mode, df, xmu, c, n, igen, iseed, r, 'm', m, 'lr', lr);
New: [r, state, x, ifail] = g05ry(mode, n, df, xmu, c, r, state, 'm', m, 'lr', lr);```
The integer array state in the call to nag_rand_multivar_students_t (g05ry) contains information on the base generator being used. This array must have been initialized prior to calling nag_rand_multivar_students_t (g05ry) with a call to either nag_rand_init_repeat (g05kf) or nag_rand_init_nonrepeat (g05kg).

### nag_rand_withdraw_multivar_normal (g05ly)

Withdrawn at Mark 24.
Replaced by nag_rand_multivar_normal (g05rz).
```Old: [x, iseed, r, ifail] = g05ly(mode, xmu, c, n, igen, iseed, r, 'm', m, 'lr', lr);
New: [r, state, x, ifail] = g05rz(mode, n, xmu, c, r, state, 'm', m, 'lr', lr);```
The integer array state in the call to nag_rand_multivar_normal (g05rz) contains information on the base generator being used. This array must have been initialized prior to calling nag_rand_multivar_normal (g05rz) with a call to either nag_rand_init_repeat (g05kf) or nag_rand_init_nonrepeat (g05kg).

### nag_rand_withdraw_multivar_normal_svec (g05lz)

Withdrawn at Mark 24.
Replaced by nag_rand_multivar_normal (g05rz).
```Old: [x, iseed, r, ifail] = g05lz(mode, xmu, c, igen, iseed, r, 'n', n);
New: n = nag_int(1);
[r, state, x, ifail] = g05rz(mode, n, xmu, c, r, state, 'm', m, 'lr', lr); ```
The integer array state in the call to nag_rand_multivar_normal (g05rz) contains information on the base generator being used. This array must have been initialized prior to calling nag_rand_multivar_normal (g05rz) with a call to either nag_rand_init_repeat (g05kf) or nag_rand_init_nonrepeat (g05kg).

### nag_rand_withdrawn_int_uniform (g05ma)

Withdrawn at Mark 24.
Replaced by nag_rand_int_uniform (g05tl).
```Old: [x, iseed, ifail] = g05ma(a, b, n, igen, iseed);
New: [state, x, ifail] = g05tl(n, a, b, state);```
The integer array state in the call to nag_rand_int_uniform (g05tl) contains information on the base generator being used. This array must have been initialized prior to calling nag_rand_int_uniform (g05tl) with a call to either nag_rand_init_repeat (g05kf) or nag_rand_init_nonrepeat (g05kg).

### nag_rand_withdraw_int_geom (g05mb)

Withdrawn at Mark 24.
Replaced by nag_rand_int_geom (g05tc).
```Old: [x, iseed, r, ifail] = g05mb(mode, p, n, igen, iseed, r);
New: [r, state, x, ifail] = g05tc(mode, n, p, r, state);```
g05mb returned the number of trials required to get the first success, whereas nag_rand_int_geom (g05tc) returns the number of failures before the first success, therefore the value returned by nag_rand_int_geom (g05tc) is one less than the equivalent value returned from g05mb.
The integer array state in the call to nag_rand_int_geom (g05tc) contains information on the base generator being used. This array must have been initialized prior to calling nag_rand_int_geom (g05tc) with a call to either nag_rand_init_repeat (g05kf) or nag_rand_init_nonrepeat (g05kg).

### nag_rand_withdraw_int_negbin (g05mc)

Withdrawn at Mark 24.
Replaced by nag_rand_int_negbin (g05th).
```Old: [x, iseed, r, ifail] = g05mc(mode, m, p, n, igen, iseed, r);
New: [r, state, x, ifail] = g05th(mode, n, m, p, r, state);```
The integer array state in the call to nag_rand_int_negbin (g05th) contains information on the base generator being used. This array must have been initialized prior to calling nag_rand_int_negbin (g05th) with a call to either nag_rand_init_repeat (g05kf) or nag_rand_init_nonrepeat (g05kg).

### nag_rand_withdraw_int_log (g05md)

Withdrawn at Mark 24.
Replaced by nag_rand_int_log (g05tf).
```Old: [x, iseed, r, ifail] = g05md(mode, a, n, igen, iseed, r);
New: [r, state, x, ifail] = g05tf(mode, n, a, r, state);```
The integer array state in the call to nag_rand_int_log (g05tf) contains information on the base generator being used. This array must have been initialized prior to calling nag_rand_int_log (g05tf) with a call to either nag_rand_init_repeat (g05kf) or nag_rand_init_nonrepeat (g05kg).

### nag_rand_withdraw_int_poisson_varmean (g05me)

Withdrawn at Mark 24.
Replaced by nag_rand_int_poisson_varmean (g05tk).
```Old: [x, iseed, ifail] = g05me(vlamda, igen, iseed, 'm', m);
New: [state, x, ifail] = g05tk(vlamda, state, 'm', m);```
The integer array state in the call to nag_rand_int_poisson_varmean (g05tk) contains information on the base generator being used. This array must have been initialized prior to calling nag_rand_int_poisson_varmean (g05tk) with a call to either nag_rand_init_repeat (g05kf) or nag_rand_init_nonrepeat (g05kg).

### nag_rand_withdraw_int_binomial (g05mj)

Withdrawn at Mark 24.
Replaced by nag_rand_int_binomial (g05ta).
```Old: [x, iseed, r, ifail] = g05mj(mode, m, p, n, igen, iseed, r);
New: [r, state, x, ifail] = g05ta(mode, n, m, p, r, state);```
The integer array state in the call to nag_rand_int_binomial (g05ta) contains information on the base generator being used. This array must have been initialized prior to calling nag_rand_int_binomial (g05ta) with a call to either nag_rand_init_repeat (g05kf) or nag_rand_init_nonrepeat (g05kg).

### nag_rand_withdraw_int_poisson (g05mk)

Withdrawn at Mark 24.
Replaced by nag_rand_int_poisson (g05tj).
```Old: [x, iseed, r, ifail] = g05mk(mode, lambda, n, igen, iseed, r);
New: [r, state, x, ifail] = g05tj(mode, n, lambda, r, state);```
The integer array state in the call to nag_rand_int_poisson (g05tj) contains information on the base generator being used. This array must have been initialized prior to calling nag_rand_int_poisson (g05tj) with a call to either nag_rand_init_repeat (g05kf) or nag_rand_init_nonrepeat (g05kg).

### nag_rand_withdraw_int_hypergeom (g05ml)

Withdrawn at Mark 24.
Replaced by nag_rand_int_hypergeom (g05te).
```Old: [x, iseed, r, ifail] = g05ml(mode, ns, np, m, n, igen, iseed, r);
New: [r, state, x, ifail] = g05te(mode, n, ns, np, m, r, state);```
The integer array state in the call to nag_rand_int_hypergeom (g05te) contains information on the base generator being used. This array must have been initialized prior to calling nag_rand_int_hypergeom (g05te) with a call to either nag_rand_init_repeat (g05kf) or nag_rand_init_nonrepeat (g05kg).

### nag_rand_withdraw_int_multinomial (g05mr)

Withdrawn at Mark 24.
Replaced by nag_rand_int_multinomial (g05tg).
```Old: [x, iseed, r, ifail] = g05mr(mode, m, p, n, igen, iseed, r, 'k', k);
New: [r, state, x, ifail] = g05tg(mode, n, m, p, r, state, 'k', k);```
The integer array state in the call to nag_rand_int_multinomial (g05tg) contains information on the base generator being used. This array must have been initialized prior to calling nag_rand_int_multinomial (g05tg) with a call to either nag_rand_init_repeat (g05kf) or nag_rand_init_nonrepeat (g05kg).

### nag_rand_withdraw_int_general (g05mz)

Withdrawn at Mark 24.
Replaced by nag_rand_int_general (g05td).
```Old: [x, iseed, r, ifail] = g05mz(mode, p, ip1, itype, n, igen, iseed, r, 'np', np);
New: [r, state, x, ifail] = g05td(mode, n, p, ip1, itype, r, state, 'np', np);```
The integer array state in the call to nag_rand_int_general (g05td) contains information on the base generator being used. This array must have been initialized prior to calling nag_rand_int_general (g05td) with a call to either nag_rand_init_repeat (g05kf) or nag_rand_init_nonrepeat (g05kg).

### nag_rand_withdraw_permute (g05na)

Withdrawn at Mark 24.
Replaced by nag_rand_permute (g05nc).
```Old: [index, iseed, ifail] = g05na(index, igen, iseed, 'n', n);
New: [index, state, ifail] = g05nc(index, state, 'n', n);```
The integer array state in the call to nag_rand_permute (g05nc) contains information on the base generator being used. This array must have been initialized prior to calling nag_rand_permute (g05nc) with a call to either nag_rand_init_repeat (g05kf) or nag_rand_init_nonrepeat (g05kg).

### nag_rand_withdraw_sample (g05nb)

Withdrawn at Mark 24.
Replaced by nag_rand_sample (g05nd).
```Old: [isampl, iseed, ifail] = g05nb(ipop, m, igen, iseed, 'n', n);
New: [isampl, state, ifail] = g05nd(ipop, m, state, 'n', n);```
The integer array state in the call to nag_rand_sample (g05nd) contains information on the base generator being used. This array must have been initialized prior to calling nag_rand_sample (g05nd) with a call to either nag_rand_init_repeat (g05kf) or nag_rand_init_nonrepeat (g05kg).

### nag_rand_withdraw_times_arma (g05pa)

Withdrawn at Mark 24.
Replaced by nag_rand_times_arma (g05ph).
```Old: [var, x, iseed, r, ifail] = g05pa(mode, xmean, phi, theta, avar, n, igen, iseed, r, 'ip', ip, 'iq', iq);
New: [r, state, var, x, ifail] = g05ph(mode, n, xmean, ip, phi, iq, theta, avar, r, state);```
The integer array state in the call to nag_rand_times_arma (g05ph) contains information on the base generator being used. This array must have been initialized prior to calling nag_rand_times_arma (g05ph) with a call to either nag_rand_init_repeat (g05kf) or nag_rand_init_nonrepeat (g05kg).

### nag_rand_withdraw_times_mv_varma (g05pc)

Withdrawn at Mark 24.
Replaced by nag_rand_times_mv_varma (g05pj).
```Old: [x, iseed, r, ifail] = g05pc(mode, xmean, ip, phi, iq, theta, var, n, igen, iseed, r, 'k', k);
New: [r, state, x, ifail] = g05pj(mode, n, xmean, ip, phi, iq, theta, var, r, state, 'k', k, 'lr', lr);```
The integer array state in the call to nag_rand_times_mv_varma (g05pj) contains information on the base generator being used. This array must have been initialized prior to calling nag_rand_times_mv_varma (g05pj) with a call to either nag_rand_init_repeat (g05kf) or nag_rand_init_nonrepeat (g05kg).

### nag_rand_withdraw_matrix_orthog (g05qa)

Withdrawn at Mark 24.
Replaced by nag_rand_matrix_orthog (g05px).
```Old: [a, iseed, ifail] = g05qa(side, init, a, igen, iseed, 'm', m, 'n', n);
New: [state, a, ifail] = g05px(side, init, state, a, 'm', m, 'n', n);```
The integer array state in the call to nag_rand_matrix_orthog (g05px) contains information on the base generator being used. This array must have been initialized prior to calling nag_rand_matrix_orthog (g05px) with a call to either nag_rand_init_repeat (g05kf) or nag_rand_init_nonrepeat (g05kg).

### nag_rand_withdraw_matrix_corr (g05qb)

Withdrawn at Mark 24.
Replaced by nag_rand_matrix_corr (g05py).
```Old: [c, iseed, ifail] = g05qb(d, igen, iseed, 'n', n, 'eps', eps);
New: [state, c, ifail] = g05py(d, state, 'n', n, 'eps', eps)```
The integer array state in the call to nag_rand_matrix_corr (g05py) contains information on the base generator being used. This array must have been initialized prior to calling nag_rand_matrix_corr (g05py) with a call to either nag_rand_init_repeat (g05kf) or nag_rand_init_nonrepeat (g05kg).

### nag_rand_withdraw_matrix_2waytable (g05qd)

Withdrawn at Mark 24.
Replaced by nag_rand_matrix_2waytable (g05pz).
```Old: [x, iseed, r, ifail] = g05qd(mode, totr, totc, igen, iseed, r, 'nrow', nrow, 'ncol', ncol, 'nr', nr);
New: [r, state, x, ifail] = g05pz(mode, totr, totc, r, state, 'nrow', nrow, 'ncol', ncol, 'lr', lr);```
The integer array state in the call to nag_rand_matrix_2waytable (g05pz) contains information on the base generator being used. This array must have been initialized prior to calling nag_rand_matrix_2waytable (g05pz) with a call to either nag_rand_init_repeat (g05kf) or nag_rand_init_nonrepeat (g05kg).

### nag_rand_withdraw_copula_normal (g05ra)

Withdrawn at Mark 24.
Replaced by nag_rand_copula_normal (g05rd).
```Old: [x, iseed, r, ifail] = g05ra(mode, c, n, igen, iseed, r, 'm', m, 'lr', lr);
New: [r, state, x, ifail] = g05rd(mode, n, c, r, state, 'm', m, 'lr', lr);```
The integer array state in the call to nag_rand_copula_normal (g05rd) contains information on the base generator being used. This array must have been initialized prior to calling nag_rand_copula_normal (g05rd) with a call to either nag_rand_init_repeat (g05kf) or nag_rand_init_nonrepeat (g05kg).

### nag_rand_withdraw_copula_students_t (g05rb)

Withdrawn at Mark 24.
Replaced by nag_rand_copula_students_t (g05rc).
```Old: [x, iseed, r, ifail] = g05rb(mode, df, c, n, igen, iseed, r, 'm', m, 'lr', lr);
New: [r, state, x, ifail] = g05rc(mode, n, df, c, r, state, 'm', m, 'lr', lr);```
The integer array state in the call to nag_rand_copula_students_t (g05rc) contains information on the base generator being used. This array must have been initialized prior to calling nag_rand_copula_students_t (g05rc) with a call to either nag_rand_init_repeat (g05kf) or nag_rand_init_nonrepeat (g05kg).

### (g05ya)

Withdrawn at Mark 23.
Replaced by nag_rand_quasi_init (g05yl) and nag_rand_quasi_uniform (g05ym).
 Faure quasi-random numbers ```Old: [quas, iref, ifail] = g05ya(true, 'f', iskip, idim, iref); New: [iref, ifail] = g05yl(nag_int(4), idim, iskip);``` ```Old: [quas, iref, ifail] = g05ya(false, 'f', iskip, idim, iref); New: [quas, iref, ifail] = g05ym(nag_int(1), nag_int(2), iref);``` Sobol quasi-random numbers ```Old: [quas, iref, ifail] = g05ya(true, 's', iskip, idim, iref); New: [iref, ifail] = g05yl(nag_int(2), idim, iskip);``` ```Old: [quas, iref, ifail] = g05ya(false, 's', iskip, idim, iref); New: [quas, iref, ifail] = g05ym(nag_int(1), nag_int(2), iref);``` Neiderreiter quasi-random numbers ```Old: [quas, iref, ifail] = g05ya(true, 'n', iskip, idim, iref); New: [iref, ifail] = g05yl(nag_int(3), idim, iskip);``` ```Old: [quas, iref, ifail] = g05ya(false, 'n', iskip, idim, iref); New: [quas, iref, ifail] = g05ym(nag_int(1), nag_int(2), iref);```

### (g05yb)

Withdrawn at Mark 23.
Replaced by nag_rand_quasi_init (g05yl) and either nag_rand_quasi_normal (g05yj) or nag_rand_quasi_lognormal (g05yk).
This function has been replaced by a suite of functions consisting of the relevant initialization function followed by one of two possible generator functions.
 Faure quasi-random numbers with Gaussian probability: ```Old: [quasi, iref, ifail] = g05yb(true, 'f', false, mean, std, iskip, iref, 'idim', idim); New: [iref, ifail] = g05yl(nag_int(4), idim, iskip);``` ```Old: [quasi, iref, ifail] = g05yb(false, 'f', false, mean, std, iskip, iref, 'idim', idim); New: [quasi, iref, ifail] = g05yj(mean, std, n, iref);``` Sobol quasi-random numbers with Gaussian probability: ```Old: [quasi, iref, ifail] = g05yb(true, 's', false, mean, std, iskip, iref, 'idim', idim); New: [iref, ifail] = g05yl(nag_int(2), idim, iskip);``` ```Old: [quasi, iref, ifail] = g05yb(false, 's', false, mean, std, iskip, iref, 'idim', idim); New: [quasi, iref, ifail] = g05yj(mean, std, n, iref);``` Neiderreiter quasi-random numbers with Gaussian probability: ```Old: [quasi, iref, ifail] = g05yb(true, 'n', false, mean, std, iskip, iref, 'idim', idim); New: [iref, ifail] = g05yl(nag_int(3), idim, iskip);``` ```Old: [quasi, iref, ifail] = g05yb(false, 'n', false, mean, std, iskip, iref, 'idim', idim); New: [quasi, iref, ifail] = g05yj(mean, std, n, iref);``` Faure quasi-random numbers with log Normal probability: ```Old: [quasi, iref, ifail] = g05yb(true, 'f', true, mean, std, iskip, iref, 'idim', idim); New: [iref, ifail] = g05yl(nag_int(4), idim, iskip);``` ```Old: [quasi, iref, ifail] = g05yb(false, 'f', true, mean, std, iskip, iref, 'idim', idim); New: [quasi, iref, ifail] = g05yk(mean, std, n, iref);``` Sobol quasi-random numbers with log Normal probability: ```Old: [quasi, iref, ifail] = g05yb(true, 's', true, mean, std, iskip, iref, 'idim', idim); New: [iref, ifail] = g05yl(nag_int(2), idim, iskip);``` ```Old: [quasi, iref, ifail] = g05yb(false, 's', true, mean, std, iskip, iref, 'idim', idim); New: [quasi, iref, ifail] = g05yk(mean, std, n, iref);``` Neiderreiter quasi-random numbers with log Normal probability: ```Old: [quasi, iref, ifail] = g05yb(true, 'n', true, mean, std, iskip, iref, 'idim', idim); New: [iref, ifail] = g05yl(nag_int(3), idim, iskip);``` ```Old: [quasi, iref, ifail] = g05yb(false, 'n', true, mean, std, iskip, iref, 'idim', idim); New: [quasi, iref, ifail] = g05yk(mean, std, n, iref);```

### nag_rand_withdraw_quasi_faure_init (g05yc)

Withdrawn at Mark 24.
Replaced by nag_rand_quasi_init (g05yl).
```Old: [iref, ifail] = g05yc(idim);
New: [iref, ifail] = g05yl(nag_int(4), idim, iskip);```

### nag_rand_withdraw_quasi_faure_uniform (g05yd)

Withdrawn at Mark 24.
Replaced by nag_rand_quasi_uniform (g05ym).
```Old: [quasi, iref, ifail] = g05yd(n, iref);
New: [quas, iref, ifail] = g05ym(n, rcord, iref);```

### nag_rand_withdraw_quasi_sobol_init (g05ye)

Withdrawn at Mark 24.
Replaced by nag_rand_quasi_init (g05yl).
```Old: [iref, ifail] = g05ye(idim, iskip);
New: [iref, ifail] = g05yl(nag_int(2), idim, iskip);```

### nag_rand_withdraw_quasi_sobol_uniform (g05yf)

Withdrawn at Mark 24.
Replaced by nag_rand_quasi_uniform (g05ym).
```Old: [quasi, iref, ifail] = g05yf(n, iref);
New: [quas, iref, ifail] = g05ym(n, rcord, iref);```

### nag_rand_withdraw_quasi_nied_init (g05yg)

Withdrawn at Mark 24.
Replaced by nag_rand_quasi_init (g05yl).
```Old: [iref, ifail] = g05yg(idim, iskip);
New: [iref, ifail] = g05yl(nag_int(3), idim, iskip);```

### nag_rand_withdraw_quasi_nied_uniform (g05yh)

Withdrawn at Mark 24.
Replaced by nag_rand_quasi_uniform (g05ym).
```Old: [quasi, iref, ifail] = g05yh(n, iref);
New: [quas, iref, ifail] = g05ym(n, rcord, iref);```

### (g05za)

Withdrawn at Mark 22.
There is no replacement for this routine.
g05za was used to select the underlying generator for the old style random number generation functions. These functions are no longer available and hence no direct replacement function for g05za is required. See nag_rand_init_repeat (g05kf) and nag_rand_init_nonrepeat (g05kg) for details on how to select the underlying generator for the newer style functions.

## G10 – Smoothing in Statistics

### nag_smooth_kerndens_gauss (g10ba)

Scheduled for withdrawal at Mark 27.
Replaced by nag_smooth_kerndens_gauss2 (g10bb).
```Old: g10ba(x,window,slo,shi,usefft,fft)

New: rcomm=zeros(ns+20)
nag_smooth_kerndens_gauss2 (g10bb)(x,1,rcomm)
```

## G13 – Time Series Analysis

### nag_tsa_withdraw_multi_varma_estimate (g13dc)

Withdrawn at Mark 24.
Replaced by nag_tsa_multi_varma_estimate (g13dd).
```Old: [par, qq, niter, rlogl, v, g, cm, ifail] = ...
g13dc(ip, iq, mean, par, qq, w, parhld, exact, iprint, cgetol, ishow, ...
'k', k, 'n', n, 'npar', npar, 'maxcal', maxcal)
New: [par, qq, niter, rlogl, v, g, cm, ifail] = ...
g13dd(ip, iq, mean, par, qq, w, parhld, exact, iprint, cgetol, ishow, ...
'k', k, 'n', n, 'npar', npar, 'maxcal', maxcal) ```
This replacement is caused by changes in the underlying Fortran interface (removal of workspace arguments) which have no effect on the MATLAB toolbox interface.

## X02 – Machine Constants

### nag_machine_withdraw_underflow (x02da)

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

### nag_machine_withdraw_model_rounds (x02dj)

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

Chapter Contents
NAG Toolbox

© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015