NAG CL Interface
f11brc (complex_gen_basic_setup)
1
Purpose
f11brc is a setup function, the first in a suite of three functions for the iterative solution of a complex general (nonHermitian) system of simultaneous linear equations.
f11brc must be called before
f11bsc, the iterative solver. The third function in the suite,
f11btc, can be used to return additional information about the computation.
These three functions are suitable for the solution of large sparse general (nonHermitian) systems of equations.
2
Specification
void 
f11brc (Nag_SparseNsym_Method method,
Nag_SparseNsym_PrecType precon,
Nag_NormType norm,
Nag_SparseNsym_Weight weight,
Integer iterm,
Integer n,
Integer m,
double tol,
Integer maxitn,
double anorm,
double sigmax,
Integer monit,
Integer *lwreq,
Complex work[],
Integer lwork,
NagError *fail) 

The function may be called by the names: f11brc, nag_sparse_complex_gen_basic_setup or nag_sparse_nherm_basic_setup.
3
Description
The suite consisting of the functions
f11brc,
f11bsc and
f11btc is designed to solve the general (nonHermitian) system of simultaneous linear equations
$Ax=b$ of order
$n$, where
$n$ is large and the coefficient matrix
$A$ is sparse.
f11brc is a setup function which must be called before
f11bsc, the iterative solver. The third function in the suite,
f11btc, can be used to return additional information about the computation. A choice of methods is available:
 restarted generalized minimum residual method (RGMRES);
 conjugate gradient squared method (CGS);
 biconjugate gradient stabilized ($\ell $) method (BiCGSTAB($\ell $));
 transposefree quasiminimal residual method (TFQMR).
3.1
Restarted Generalized Minimum Residual Method (RGMRES)
The restarted generalized minimum residual method (RGMRES) (see
Saad and Schultz (1986),
Barrett et al. (1994) and
Dias da Cunha and Hopkins (1994)) starts from the residual
${r}_{0}=bA{x}_{0}$, where
${x}_{0}$ is an initial estimate for the solution (often
${x}_{0}=0$). An orthogonal basis for the Krylov subspace
$\mathrm{span}\left\{{A}^{\mathit{k}}{r}_{0}\right\}$, for
$\mathit{k}=0,1,\dots $, is generated explicitly: this is referred to as Arnoldi's method (see
Arnoldi (1951)). The solution is then expanded onto the orthogonal basis so as to minimize the residual norm
${\Vert bAx\Vert}_{2}$. The lack of symmetry of
$A$ implies that the orthogonal basis is generated by applying a ‘long’ recurrence relation, whose length increases linearly with the iteration count. For all but the most trivial problems, computational and storage costs can quickly become prohibitive as the iteration count increases. RGMRES limits these costs by employing a restart strategy: every
$m$ iterations at most, the Arnoldi process is restarted from
${r}_{l}=bA{x}_{l}$, where the subscript
$l$ denotes the last available iterate. Each group of
$m$ iterations is referred to as a ‘superiteration’. The value of
$m$ is chosen in advance and is fixed throughout the computation. Unfortunately, an optimum value of
$m$ cannot easily be predicted.
3.2
Conjugate Gradient Squared Method (CGS)
The conjugate gradient squared method (CGS) (see
Sonneveld (1989),
Barrett et al. (1994) and
Dias da Cunha and Hopkins (1994)) is a development of the biconjugate gradient method where the nonsymmetric Lanczos method is applied to reduce the coefficients matrix to tridiagonal form: two biorthogonal sequences of vectors are generated starting from the residual
${r}_{0}=bA{x}_{0}$, where
${x}_{0}$ is an initial estimate for the solution (often
${x}_{0}=0$) and from the
shadow residual ${\hat{r}}_{0}$
corresponding to the arbitrary problem
${A}^{\mathrm{H}}\hat{x}=\hat{b}$, where
$\hat{b}$ can be any vector, but in practice is chosen so that
${r}_{0}={\hat{r}}_{0}$. In the course of the iteration, the residual and shadow residual
${r}_{i}={P}_{i}\left(A\right){r}_{0}$ and
${\hat{r}}_{i}={P}_{i}\left({A}^{\mathrm{H}}\right){\hat{r}}_{0}$ are generated, where
${P}_{i}$
is a polynomial of order
$i$, and biorthogonality is exploited by computing the vector product
${\rho}_{i}=\left({\hat{r}}_{i},{r}_{i}\right)=\left({P}_{i}\left({A}^{\mathrm{H}}\right){\hat{r}}_{0},\phantom{\rule{0ex}{0ex}}{P}_{i}\left(A\right){r}_{0}\right)=\left({\hat{r}}_{0},{P}_{i}^{2}\left(A\right){r}_{0}\right)$. Applying the ‘contraction’ operator
${P}_{i}\left(A\right)$ twice, the iteration coefficients can still be recovered without advancing the solution of the shadow problem, which is of no interest. The CGS method often provides fast convergence; however, there is no reason why the contraction operator should also reduce the once reduced vector
${P}_{i}\left(A\right){r}_{0}$: this may well lead to a highly irregular convergence which may result in large cancellation errors.
3.3
BiConjugate Gradient Stabilized ($\ell $) Method (BiCGSTAB($\ell $))
The biconjugate gradient stabilized (
$\ell $) method
(BiCGSTAB(
$\ell $)) (see
Van der Vorst (1989),
Sleijpen and Fokkema (1993) and
Dias da Cunha and Hopkins (1994)) is similar to the CGS method above. However, instead of generating the sequence
$\left\{{P}_{i}^{2}\left(A\right){r}_{0}\right\}$, it generates the sequence
$\left\{{Q}_{i}\left(A\right){P}_{i}\left(A\right){r}_{0}\right\}$, where the
${Q}_{i}\left(A\right)$ are polynomials chosen to minimize the residual
after the application of the contraction operator
${P}_{i}\left(A\right)$. Two main steps can be identified for each iteration: an OR (Orthogonal Residuals) step where a basis of order
$\ell $ is generated by a BiCG iteration and an MR (Minimum Residuals) step where the residual is minimized over the basis generated, by a method akin to GMRES. For
$\ell =1$, the method corresponds to the BiCGSTAB method of
Van der Vorst (1989). For
$\ell >1$, more information about complex eigenvalues of the iteration matrix can be taken into account, and this may lead to improved convergence and robustness. However, as
$\ell $ increases, numerical instabilities may arise. For this reason, a maximum value of
$\ell =10$ is imposed, but probably
$\ell =4$ is sufficient in most cases.
3.4
Transposefree Quasiminimal Residual Method (TFQMR)
The transposefree quasiminimal residual method (TFQMR) (see
Freund and Nachtigal (1991) and
Freund (1993)) is conceptually derived from the CGS method. The residual is minimized over the space of the residual vectors generated by the CGS iterations under the simplifying assumption that residuals are almost orthogonal. In practice, this is not the case but theoretical analysis has proved the validity of the method. This has the effect of remedying the rather irregular convergence behaviour with wild oscillations in the residual norm that can degrade the numerical performance and robustness of the CGS method. In general, the TFQMR method can be expected to converge at least as fast as the CGS method, in terms of number of iterations, although each iteration involves a higher operation count. When the CGS method exhibits irregular convergence, the TFQMR method can produce much smoother, almost monotonic convergence curves. However, the close relationship between the CGS and TFQMR method implies that the
overall speed of convergence is similar for both methods. In some cases, the TFQMR method may converge faster than the CGS method.
3.5
General Considerations
For each method, a sequence of solution iterates $\left\{{x}_{i}\right\}$ is generated such that, hopefully, the sequence of the residual norms $\left\{\Vert {r}_{i}\Vert \right\}$ converges to a required tolerance. Note that, in general, convergence, when it occurs, is not monotonic.
In the RGMRES and BiCGSTAB(
$\ell $) methods above, your program must provide the
maximum number of basis vectors used,
$m$ or
$\ell $, respectively; however, a
smaller number of basis vectors may be generated and used when the stability of the solution process requires this (see
Section 9).
Faster convergence can be achieved using a
preconditioner (see
Golub and Van Loan (1996) and
Barrett et al. (1994)). A preconditioner maps the original system of equations onto a different system, say
with, hopefully, better characteristics with respect to its speed of convergence: for example, the condition number of the coefficients matrix can be improved or eigenvalues in its spectrum can be made to coalesce. An orthogonal basis for the Krylov subspace
$\mathrm{span}\left\{{\overline{A}}^{\mathit{k}}{\overline{r}}_{0}\right\}$, for
$\mathit{k}=0,1,\dots $, is generated and the solution proceeds as outlined above. The algorithms used are such that the solution and residual iterates of the original system are produced, not their preconditioned counterparts. Note that an unsuitable preconditioner or no preconditioning at all may result in a very slow rate, or lack, of convergence. However, preconditioning involves a tradeoff between the reduction in the number of iterations required for convergence and the additional computational costs per iteration. Also, setting up a preconditioner may involve nonnegligible overheads.
A
left preconditioner
${M}^{1}$ can be used by the RGMRES, CGS and TFQMR methods, such that
$\overline{A}={M}^{1}A\sim {I}_{n}$ in
(1), where
${I}_{n}$ is the identity matrix of order
$n$; a
right preconditioner
${M}^{1}$ can be used by the BiCGSTAB(
$\ell $) method, such that
$\overline{A}=A{M}^{1}\sim {I}_{n}$. These are formal definitions, used only in the design of the algorithms; in practice, only the means to compute the matrix–vector products
$v=Au$ and
$v={A}^{\mathrm{H}}u$ (the latter only being required when an estimate of
${\Vert A\Vert}_{1}$ or
${\Vert A\Vert}_{\infty}$ is computed internally), and to solve the preconditioning equations
$Mv=u$ are required, i.e., explicit information about
$M$, or its inverse is not required at any stage.
The first termination criterion
is available for all four methods. In
(2),
$p=1$,
$\infty \text{ or}2$ and
$\tau $ denotes a userspecified tolerance subject to
$\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(10,\sqrt{n}\right)$,
$\epsilon \le \tau <1$, where
$\epsilon $ is the
machine precision. Facilities are provided for the estimation of the norm of the coefficients matrix
${\Vert A\Vert}_{1}$ or
${\Vert A\Vert}_{\infty}$, when this is not known in advance, by applying Higham's method (see
Higham (1988)). Note that
${\Vert A\Vert}_{2}$ cannot be estimated internally. This criterion uses an error bound derived from
backward error analysis to ensure that the computed solution is the exact solution of a problem as close to the original as the termination tolerance requires. Termination criteria employing bounds derived from
forward error analysis are not used because any such criteria would require information about the condition number
$\kappa \left(A\right)$ which is not easily obtainable.
The second termination criterion
is available for all methods except TFQMR. In
(3),
${\sigma}_{1}\left(\overline{A}\right)={\Vert \overline{A}\Vert}_{2}$ is the largest singular value of the (preconditioned) iteration matrix
$\overline{A}$. This termination criterion monitors the progress of the solution of the preconditioned system of equations and is less expensive to apply than criterion
(2) for the BiCGSTAB(
$\ell $) method with
$\ell >1$. Only the RGMRES method provides facilities to estimate
${\sigma}_{1}\left(\overline{A}\right)$ internally, when this is not supplied (see
Section 9).
Termination criterion
(2) is the recommended choice, despite its additional costs per iteration when using the BiCGSTAB(
$\ell $) method with
$\ell >1$. Also, if the norm of the initial estimate is much larger than the norm of the solution, that is, if
$\Vert {x}_{0}\Vert \gg \Vert x\Vert $, a dramatic loss of significant digits could result in complete lack of convergence. The use of criterion
(2) will enable the detection of such a situation, and the iteration will be restarted at a suitable point. No such restart facilities are provided for criterion
(3).
Optionally, a vector
$w$ of userspecified weights can be used in the computation of the vector norms in termination criterion
(2), i.e.,
${{\Vert v\Vert}_{p}}^{\left(w\right)}={\Vert {v}^{\left(w\right)}\Vert}_{p}$, where
${\left({v}^{\left(w\right)}\right)}_{\mathit{i}}={w}_{\mathit{i}}{v}_{\mathit{i}}$, for
$\mathit{i}=1,2,\dots ,n$. Note that the use of weights increases the computational costs.
The sequence of calls to the functions comprising the suite is enforced: first, the setup function
f11brc must be called, followed by the solver
f11bsc.
f11btc can be called either when
f11bsc is carrying out a monitoring step or after
f11bsc has completed its tasks. Incorrect sequencing will raise an error condition.
In general, it is not possible to recommend one method in preference to another. RGMRES is often used in the solution of systems arising from PDEs. On the other hand, it can easily stagnate when the size
$m$ of the orthogonal basis is too small, or the preconditioner is not good enough. CGS can be the fastest method, but the computed residuals can exhibit instability which may greatly affect the convergence and quality of the solution. BiCGSTAB(
$\ell $) seems robust and reliable, but it can be slower than the other methods: if a preconditioner is used and
$\ell >1$, BiCGSTAB(
$\ell $) computes the solution of the preconditioned system
${\overline{x}}_{k}=M{x}_{k}$: the preconditioning equations must be solved to obtain the required solution. The algorithm employed limits to
$10\%$ or less, when no intermediate monitoring is requested, the number of times the preconditioner has to be thus applied compared with the total number of applications of the preconditioner. TFQMR can be viewed as a more robust variant of the CGS method: it shares the CGS method speed but avoids the CGS fluctuations in the residual, which may give rise to instability. Also, when the termination criterion
(2) is used, the CGS, BiCGSTAB(
$\ell $) and TFQMR methods will restart the iteration automatically when necessary in order to solve the given problem.
4
References
Arnoldi W (1951) The principle of minimized iterations in the solution of the matrix eigenvalue problem Quart. Appl. Math. 9 17–29
Barrett R, Berry M, Chan T F, Demmel J, Donato J, Dongarra J, Eijkhout V, Pozo R, Romine C and Van der Vorst H (1994) Templates for the Solution of Linear Systems: Building Blocks for Iterative Methods SIAM, Philadelphia
Dias da Cunha R and Hopkins T (1994) PIM 1.1 — the parallel iterative method package for systems of linear equations user's guide — Fortran 77 version Technical Report Computing Laboratory, University of Kent at Canterbury, Kent, UK
Freund R W (1993) A transposefree quasiminimal residual algorithm for nonHermitian linear systems SIAM J. Sci. Comput. 14 470–482
Freund R W and Nachtigal N (1991) QMR: a QuasiMinimal Residual Method for NonHermitian Linear Systems Numer. Math. 60 315–339
Golub G H and Van Loan C F (1996) Matrix Computations (3rd Edition) Johns Hopkins University Press, Baltimore
Higham N J (1988) FORTRAN codes for estimating the onenorm of a real or complex matrix, with applications to condition estimation ACM Trans. Math. Software 14 381–396
Saad Y and Schultz M (1986) GMRES: a generalized minimal residual algorithm for solving nonsymmetric linear systems SIAM J. Sci. Statist. Comput. 7 856–869
Sleijpen G L G and Fokkema D R (1993) BiCGSTAB$\left(\ell \right)$ for linear equations involving matrices with complex spectrum ETNA 1 11–32
Sonneveld P (1989) CGS, a fast Lanczostype solver for nonsymmetric linear systems SIAM J. Sci. Statist. Comput. 10 36–52
Van der Vorst H (1989) BiCGSTAB, a fast and smoothly converging variant of BiCG for the solution of nonsymmetric linear systems SIAM J. Sci. Statist. Comput. 13 631–644
5
Arguments

1:
$\mathbf{method}$ – Nag_SparseNsym_Method
Input

On entry: the iterative method to be used.
 ${\mathbf{method}}=\mathrm{Nag\_SparseNsym\_RGMRES}$
 Restarted generalized minimum residual method.
 ${\mathbf{method}}=\mathrm{Nag\_SparseNsym\_CGS}$
 Conjugate gradient squared method.
 ${\mathbf{method}}=\mathrm{Nag\_SparseNsym\_BiCGSTAB}$
 Biconjugate gradient stabilized ($\ell $) method.
 ${\mathbf{method}}=\mathrm{Nag\_SparseNsym\_TFQMR}$
 Transposefree quasiminimal residual method.
Constraint:
${\mathbf{method}}=\mathrm{Nag\_SparseNsym\_RGMRES}$, $\mathrm{Nag\_SparseNsym\_CGS}$, $\mathrm{Nag\_SparseNsym\_BiCGSTAB}$ or $\mathrm{Nag\_SparseNsym\_TFQMR}$.

2:
$\mathbf{precon}$ – Nag_SparseNsym_PrecType
Input

On entry: determines whether preconditioning is used.
 ${\mathbf{precon}}=\mathrm{Nag\_SparseNsym\_NoPrec}$
 No preconditioning.
 ${\mathbf{precon}}=\mathrm{Nag\_SparseNsym\_Prec}$
 Preconditioning.
Constraint:
${\mathbf{precon}}=\mathrm{Nag\_SparseNsym\_NoPrec}$ or $\mathrm{Nag\_SparseNsym\_Prec}$.

3:
$\mathbf{norm}$ – Nag_NormType
Input

On entry: defines the matrix and vector norm to be used in the termination criteria.
 ${\mathbf{norm}}=\mathrm{Nag\_OneNorm}$
 ${l}_{1}$ norm.
 ${\mathbf{norm}}=\mathrm{Nag\_InfNorm}$
 ${l}_{\infty}$ norm.
 ${\mathbf{norm}}=\mathrm{Nag\_TwoNorm}$
 ${l}_{2}$ norm.
Suggested values:
 if ${\mathbf{iterm}}=1$, ${\mathbf{norm}}=\mathrm{Nag\_InfNorm}$;
 if ${\mathbf{iterm}}=2$, ${\mathbf{norm}}=\mathrm{Nag\_TwoNorm}$.
Constraints:
 if ${\mathbf{iterm}}=1$, ${\mathbf{norm}}=\mathrm{Nag\_OneNorm}$, $\mathrm{Nag\_InfNorm}$ or $\mathrm{Nag\_TwoNorm}$;
 if ${\mathbf{iterm}}=2$, ${\mathbf{norm}}=\mathrm{Nag\_TwoNorm}$.

4:
$\mathbf{weight}$ – Nag_SparseNsym_Weight
Input

On entry: specifies whether a vector
$w$ of usersupplied weights is to be used in the computation of the vector norms required in termination criterion
(2) (
${\mathbf{iterm}}=1$):
${{\Vert v\Vert}_{p}}^{\left(w\right)}={\Vert {v}^{\left(w\right)}\Vert}_{p}$, where
${v}_{\mathit{i}}^{\left(w\right)}={w}_{\mathit{i}}{v}_{\mathit{i}}$, for
$\mathit{i}=1,2,\dots ,n$. The suffix
$p=1,2,\infty $ denotes the vector norm used, as specified by the argument
norm. Note that weights cannot be used when
${\mathbf{iterm}}=2$, i.e., when criterion
(3) is used.
 ${\mathbf{weight}}=\mathrm{Nag\_SparseNsym\_Weighted}$
 Usersupplied weights are to be used and must be supplied on initial entry to f11bsc.
 ${\mathbf{weight}}=\mathrm{Nag\_SparseNsym\_UnWeighted}$
 All weights are implicitly set equal to one. Weights do not need to be supplied on initial entry to f11bsc.
Suggested value:
${\mathbf{weight}}=\mathrm{Nag\_SparseNsym\_UnWeighted}$.
Constraints:
 if ${\mathbf{iterm}}=1$, ${\mathbf{weight}}=\mathrm{Nag\_SparseNsym\_Weighted}$ or $\mathrm{Nag\_SparseNsym\_UnWeighted}$;
 if ${\mathbf{iterm}}=2$, ${\mathbf{weight}}=\mathrm{Nag\_SparseNsym\_UnWeighted}$.

5:
$\mathbf{iterm}$ – Integer
Input

On entry: defines the termination criterion to be used.
 ${\mathbf{iterm}}=1$
 Use the termination criterion defined in (2).
 ${\mathbf{iterm}}=2$
 Use the termination criterion defined in (3).
Suggested value:
${\mathbf{iterm}}=1$.
Constraints:
 if ${\mathbf{method}}=\mathrm{Nag\_SparseNsym\_TFQMR}$ or ${\mathbf{weight}}=\mathrm{Nag\_SparseNsym\_Weighted}$ or ${\mathbf{norm}}\ne \mathrm{Nag\_TwoNorm}$, ${\mathbf{iterm}}=1$;
 otherwise ${\mathbf{iterm}}=1$ or $2$.
Note: ${\mathbf{iterm}}=2$ is only appropriate for a restricted set of choices for
method,
norm and
weight; that is
${\mathbf{norm}}=\mathrm{Nag\_TwoNorm}$,
${\mathbf{weight}}=\mathrm{Nag\_SparseNsym\_UnWeighted}$ and
${\mathbf{method}}\ne \mathrm{Nag\_SparseNsym\_TFQMR}$.

6:
$\mathbf{n}$ – Integer
Input

On entry: $n$, the order of the matrix $A$.
Constraint:
${\mathbf{n}}>0$.

7:
$\mathbf{m}$ – Integer
Input

On entry: if
${\mathbf{method}}=\mathrm{Nag\_SparseNsym\_RGMRES}$,
m is the dimension
$m$ of the restart subspace.
If
${\mathbf{method}}=\mathrm{Nag\_SparseNsym\_BiCGSTAB}$,
m is the order
$\ell $ of the polynomial BiCGSTAB method.
Otherwise,
m is not referenced.
Constraints:
 if ${\mathbf{method}}=\mathrm{Nag\_SparseNsym\_RGMRES}$, $0<{\mathbf{m}}\le \mathrm{min}\phantom{\rule{0.125em}{0ex}}\left({\mathbf{n}},50\right)$;
 if ${\mathbf{method}}=\mathrm{Nag\_SparseNsym\_BiCGSTAB}$, $0<{\mathbf{m}}\le \mathrm{min}\phantom{\rule{0.125em}{0ex}}\left({\mathbf{n}},10\right)$.

8:
$\mathbf{tol}$ – double
Input

On entry: the tolerance $\tau $ for the termination criterion. If ${\mathbf{tol}}\le 0.0,\tau =\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(\sqrt{\epsilon},\sqrt{n}\epsilon \right)$ is used, where $\epsilon $ is the machine precision. Otherwise $\tau =\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left({\mathbf{tol}},10\epsilon ,\sqrt{n}\epsilon \right)$ is used.
Constraint:
${\mathbf{tol}}<1.0$.

9:
$\mathbf{maxitn}$ – Integer
Input

On entry: the maximum number of iterations.
Constraint:
${\mathbf{maxitn}}>0$.

10:
$\mathbf{anorm}$ – double
Input

On entry: if
${\mathbf{anorm}}>0.0$, the value of
${\Vert A\Vert}_{p}$ to be used in the termination criterion
(2) (
${\mathbf{iterm}}=1$).
If
${\mathbf{anorm}}\le 0.0$,
${\mathbf{iterm}}=1$ and
${\mathbf{norm}}=\mathrm{Nag\_OneNorm}$ or
$\mathrm{Nag\_InfNorm}$, then
${\Vert A\Vert}_{1}={\Vert A\Vert}_{\infty}$ is estimated internally by
f11bsc.
If
${\mathbf{iterm}}=2$,
anorm is not referenced.
Constraint:
if ${\mathbf{iterm}}=1$ and ${\mathbf{norm}}=\mathrm{Nag\_TwoNorm}$, ${\mathbf{anorm}}>0.0$.

11:
$\mathbf{sigmax}$ – double
Input

On entry: if
${\mathbf{iterm}}=2$, the largest singular value
${\sigma}_{1}$ of the preconditioned iteration matrix; otherwise,
sigmax is not referenced.
If ${\mathbf{sigmax}}\le 0.0$, ${\mathbf{iterm}}=2$ and ${\mathbf{method}}=\mathrm{Nag\_SparseNsym\_RGMRES}$, the value of ${\sigma}_{1}$ will be estimated internally.
Constraint:
if ${\mathbf{method}}=\mathrm{Nag\_SparseNsym\_CGS}$ or $\mathrm{Nag\_SparseNsym\_BiCGSTAB}$ and ${\mathbf{iterm}}=2$, ${\mathbf{sigmax}}>0.0$.

12:
$\mathbf{monit}$ – Integer
Input

On entry: if
${\mathbf{monit}}>0$, the frequency at which a monitoring step is executed by
f11bsc: if
${\mathbf{method}}=\mathrm{Nag\_SparseNsym\_CGS}$ or
$\mathrm{Nag\_SparseNsym\_TFQMR}$, a monitoring step is executed every
monit iterations; otherwise, a monitoring step is executed every
monit superiterations (groups of up to
$m$ or
$\ell $ iterations for RGMRES or BiCGSTAB(
$\ell $), respectively).
There are some additional computational costs involved in monitoring the solution and residual vectors when the BiCGSTAB($\ell $) method is used with $\ell >1$.
Constraint:
${\mathbf{monit}}\le {\mathbf{maxitn}}$.

13:
$\mathbf{lwreq}$ – Integer *
Output

On exit: the minimum amount of workspace required by
f11bsc. (See also
Section 5 in
f11bsc.)

14:
$\mathbf{work}\left[{\mathbf{lwork}}\right]$ – Complex
Communication Array

On exit: the array
work is initialized by
f11brc. It must
not be modified before calling the next function in the suite, namely
f11bsc.

15:
$\mathbf{lwork}$ – Integer
Input

On entry: the dimension of the array
work.
Constraint:
${\mathbf{lwork}}\ge 120$.
Note: although the minimum value of
lwork ensures the correct functioning of
f11brc, a larger value is required by the other functions in the suite, namely
f11bsc and
f11btc. The required value is as follows:
Method 
Requirements 
RGMRES 
${\mathbf{lwork}}=120+n\left(m+3\right)+m\left(m+5\right)+1$, where $m$ is the dimension of the basis. 
CGS 
${\mathbf{lwork}}=120+7n$. 
BiCGSTAB($\ell $) 
${\mathbf{lwork}}=120+\left(2n+\ell \right)\left(\ell +2\right)+p$, where $\ell $ is the order of the method. 
TFQMR 
${\mathbf{lwork}}=120+10n$, 
where
$p=2n$ 
if $\ell >1$ and ${\mathbf{iterm}}=2$ was supplied. 
$p=n$ 
if $\ell >1$ and a preconditioner is used or ${\mathbf{iterm}}=2$ was supplied. 
$p=0$ 
otherwise. 

16:
$\mathbf{fail}$ – NagError *
Input/Output

The NAG error argument (see
Section 7 in the Introduction to the NAG Library CL Interface).
6
Error Indicators and Warnings
 NE_ALLOC_FAIL

Dynamic memory allocation failed.
See
Section 3.1.2 in the Introduction to the NAG Library CL Interface for further information.
 NE_BAD_PARAM

On entry, argument $\u2329\mathit{\text{value}}\u232a$ had an illegal value.
 NE_CONSTRAINT

On entry, ${\mathbf{iterm}}=1$, ${\mathbf{norm}}=\mathrm{Nag\_TwoNorm}$ and ${\mathbf{anorm}}=\u2329\mathit{\text{value}}\u232a$.
Constraint: if ${\mathbf{iterm}}=1$ and ${\mathbf{norm}}=\mathrm{Nag\_TwoNorm}$, ${\mathbf{anorm}}>0.0$.
On entry, ${\mathbf{iterm}}=2$, ${\mathbf{method}}=\u2329\mathit{\text{value}}\u232a$ and ${\mathbf{sigmax}}=\u2329\mathit{\text{value}}\u232a$.
Constraint: if ${\mathbf{iterm}}=2$ and ${\mathbf{method}}=\mathrm{Nag\_SparseNsym\_CGS}$ or $\mathrm{Nag\_SparseNsym\_BiCGSTAB}$, ${\mathbf{sigmax}}>0.0$.
 NE_ENUM_3_INT

On entry, ${\mathbf{method}}=\u2329\mathit{\text{value}}\u232a$, ${\mathbf{weight}}=\u2329\mathit{\text{value}}\u232a$, ${\mathbf{norm}}=\u2329\mathit{\text{value}}\u232a$ and ${\mathbf{iterm}}=\u2329\mathit{\text{value}}\u232a$.
Constraint: if ${\mathbf{method}}=\mathrm{Nag\_SparseNsym\_TFQMR}$ or ${\mathbf{weight}}=\mathrm{Nag\_SparseNsym\_Weighted}$ or ${\mathbf{norm}}\ne \mathrm{Nag\_TwoNorm}$, ${\mathbf{iterm}}=1$. Otherwise, ${\mathbf{iterm}}=1$ or $2$.
 NE_ENUM_INT_2

On entry, ${\mathbf{m}}=\u2329\mathit{\text{value}}\u232a$ and ${\mathbf{method}}=\u2329\mathit{\text{value}}\u232a$.
Constraint: if ${\mathbf{method}}=\mathrm{Nag\_SparseNsym\_RGMRES}$ or $\mathrm{Nag\_SparseNsym\_BiCGSTAB}$, ${\mathbf{m}}>0$.
On entry, ${\mathbf{m}}=\u2329\mathit{\text{value}}\u232a$, ${\mathbf{n}}=\u2329\mathit{\text{value}}\u232a$ and ${\mathbf{method}}=\u2329\mathit{\text{value}}\u232a$.
Constraint: if ${\mathbf{method}}=\mathrm{Nag\_SparseNsym\_RGMRES}$, ${\mathbf{m}}\le \mathrm{min}\phantom{\rule{0.125em}{0ex}}\left({\mathbf{n}},50\right)$. If ${\mathbf{method}}=\mathrm{Nag\_SparseNsym\_BiCGSTAB}$, ${\mathbf{m}}\le \mathrm{min}\phantom{\rule{0.125em}{0ex}}\left({\mathbf{n}},10\right)$.
 NE_INT

On entry, ${\mathbf{lwork}}=\u2329\mathit{\text{value}}\u232a$.
Constraint: ${\mathbf{lwork}}\ge 120$.
On entry, ${\mathbf{maxitn}}=\u2329\mathit{\text{value}}\u232a$.
Constraint: ${\mathbf{maxitn}}>0$.
On entry, ${\mathbf{n}}=\u2329\mathit{\text{value}}\u232a$.
Constraint: ${\mathbf{n}}>0$.
 NE_INT_2

On entry, ${\mathbf{monit}}=\u2329\mathit{\text{value}}\u232a$ and ${\mathbf{maxitn}}=\u2329\mathit{\text{value}}\u232a$.
Constraint: ${\mathbf{monit}}\le {\mathbf{maxitn}}$.
 NE_INTERNAL_ERROR

An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact
NAG for assistance.
See
Section 7.5 in the Introduction to the NAG Library CL Interface for further information.
 NE_NO_LICENCE

Your licence key may have expired or may not have been installed correctly.
See
Section 8 in the Introduction to the NAG Library CL Interface for further information.
 NE_OUT_OF_SEQUENCE

f11brc has been called out of sequence: either
f11brc has been called twice or
f11bsc has not terminated its current task.
 NE_REAL

On entry, ${\mathbf{tol}}=\u2329\mathit{\text{value}}\u232a$.
Constraint: ${\mathbf{tol}}<1.0$.
7
Accuracy
Not applicable.
8
Parallelism and Performance
f11brc is not threaded in any implementation.
RGMRES can estimate internally the maximum singular value ${\sigma}_{1}$ of the iteration matrix, using ${\sigma}_{1}\sim {\Vert T\Vert}_{1}$, where $T$ is the upper triangular matrix obtained by $QR$ factorization of the upper Hessenberg matrix generated by the Arnoldi process. The computational costs of this computation are negligible when compared to the overall costs.
Loss of orthogonality in the RGMRES method, or of biorthogonality in the BiCGSTAB(
$\ell $) method may degrade the solution and speed of convergence. For both methods, the algorithms employed include checks on the basis vectors so that the number of basis vectors used for a given superiteration may be less than the value specified in the input argument
m. Also, if termination criterion
(2) is used, the CGS, BiCGSTAB(
$\ell $) and TFQMR methods will restart automatically the computation from the last available iterates, when the stability of the solution process requires it.
Termination criterion
(3), when available, involves only the residual (or norm of the residual) produced directly by the iteration process: this may differ from the norm of the true residual
${\stackrel{~}{r}}_{k}=bA{x}_{k}$, particularly when the norm of the residual is very small. Also, if the norm of the initial estimate of the solution is much larger than the norm of the exact solution, convergence can be achieved despite very large errors in the solution. On the other hand, termination criterion
(3) is cheaper to use and inspects the progress of the actual iteration. Termination criterion
(2) should be preferred in most cases, despite its slightly larger costs.
10
Example
This example solves an
$8\times 8$ nonHermitian system of simultaneous linear equations using the TFQMR method where the coefficients matrix
$A$ has a random sparsity pattern. An incomplete
$LU$ preconditioner is used (routines
f11dnc and
f11dpc).
10.1
Program Text
10.2
Program Data
10.3
Program Results