F11BRF (PDF version)
F11 Chapter Contents
F11 Chapter Introduction
NAG Library Manual

NAG Library Routine DocumentF11BRF

Note:  before using this routine, please read the Users' Note for your implementation to check the interpretation of bold italicised terms and other implementation-dependent details.

1  Purpose

F11BRF is a setup routine, the first in a suite of three routines for the iterative solution of a complex general (non-Hermitian) system of simultaneous linear equations. F11BRF must be called before F11BSF, the iterative solver. The third routine in the suite, F11BTF, can be used to return additional information about the computation.
These three routines are suitable for the solution of large sparse general (non-Hermitian) systems of equations.

2  Specification

 SUBROUTINE F11BRF ( METHOD, PRECON, NORM, WEIGHT, ITERM, N, M, TOL, MAXITN, ANORM, SIGMAX, MONIT, LWREQ, WORK, LWORK, IFAIL)
 INTEGER ITERM, N, M, MAXITN, MONIT, LWREQ, LWORK, IFAIL REAL (KIND=nag_wp) TOL, ANORM, SIGMAX COMPLEX (KIND=nag_wp) WORK(LWORK) CHARACTER(*) METHOD CHARACTER(1) PRECON, NORM, WEIGHT

3  Description

The suite consisting of the routines F11BRF, F11BSF and F11BTF is designed to solve the general (non-Hermitian) system of simultaneous linear equations $Ax=b$ of order $n$, where $n$ is large and the coefficient matrix $A$ is sparse.
F11BRF is a setup routine which must be called before F11BSF, the iterative solver. The third routine in the suite, F11BTF, 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);
• bi-conjugate gradient stabilized ($\ell$) method (Bi-CGSTAB($\ell$));
• transpose-free quasi-minimal 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}=b-A{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 ${‖b-Ax‖}_{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}=b-A{x}_{l}$, where the subscript $l$ denotes the last available iterate. Each group of $m$ iterations is referred to as a ‘super-iteration’. 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 bi-conjugate gradient method where the nonsymmetric Lanczos method is applied to reduce the coefficients matrix to tridiagonal form: two bi-orthogonal sequences of vectors are generated starting from the residual ${r}_{0}=b-A{x}_{0}$, where ${x}_{0}$ is an initial estimate for the solution (often ${x}_{0}=0$) and from the shadow residual ${\stackrel{^}{r}}_{0}$ corresponding to the arbitrary problem ${A}^{\mathrm{H}}\stackrel{^}{x}=\stackrel{^}{b}$, where $\stackrel{^}{b}$ can be any vector, but in practice is chosen so that ${r}_{0}={\stackrel{^}{r}}_{0}$. In the course of the iteration, the residual and shadow residual ${r}_{i}={P}_{i}\left(A\right){r}_{0}$ and ${\stackrel{^}{r}}_{i}={P}_{i}\left({A}^{\mathrm{H}}\right){\stackrel{^}{r}}_{0}$ are generated, where ${P}_{i}$ is a polynomial of order $i$, and bi-orthogonality is exploited by computing the vector product ${\rho }_{i}=\left({\stackrel{^}{r}}_{i},{r}_{i}\right)=\left({P}_{i}\left({A}^{\mathrm{H}}\right){\stackrel{^}{r}}_{0},\phantom{\rule{0ex}{0ex}}{P}_{i}\left(A\right){r}_{0}\right)=\left({\stackrel{^}{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  Bi-Conjugate Gradient Stabilized ($\ell$) Method (Bi-CGSTAB($\ell$))

The bi-conjugate gradient stabilized ($\ell$) method (Bi-CGSTAB($\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 Bi-CG 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 Bi-CGSTAB 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  Transpose-free Quasi-minimal Residual Method (TFQMR)

The transpose-free quasi-minimal 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\{‖{r}_{i}‖\right\}$ converges to a required tolerance. Note that, in general, convergence, when it occurs, is not monotonic.
In the RGMRES and Bi-CGSTAB($\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 8).
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
 $A-x-=b-,$ (1)
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\{{\stackrel{-}{A}}^{\mathit{k}}{\stackrel{-}{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 trade-off 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 non-negligible overheads.
A left preconditioner ${M}^{-1}$ can be used by the RGMRES, CGS and TFQMR methods, such that $\stackrel{-}{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 Bi-CGSTAB($\ell$) method, such that $\stackrel{-}{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 ${‖A‖}_{1}$ or ${‖A‖}_{\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
 $rkp ≤ τ bp + Ap × xkp$ (2)
is available for all four methods. In (2), $p=1$, $\infty \text{​ or ​}2$ and $\tau$ denotes a user-specified 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 ${‖A‖}_{1}$ or ${‖A‖}_{\infty }$, when this is not known in advance, by applying Higham's method (see Higham (1988)). Note that ${‖A‖}_{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
 $r-k2 ≤ τ r-02 + σ1 A- × Δx-k2$ (3)
is available for all methods except TFQMR. In (3), ${\sigma }_{1}\left(\stackrel{-}{A}\right)={‖\stackrel{-}{A}‖}_{2}$ is the largest singular value of the (preconditioned) iteration matrix $\stackrel{-}{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 Bi-CGSTAB($\ell$) method with $\ell >1$. Only the RGMRES method provides facilities to estimate ${\sigma }_{1}\left(\stackrel{-}{A}\right)$ internally, when this is not supplied (see Section 8).
Termination criterion (2) is the recommended choice, despite its additional costs per iteration when using the Bi-CGSTAB($\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 $‖{x}_{0}‖\gg ‖x‖$, 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 user-specified weights can be used in the computation of the vector norms in termination criterion (2), i.e., ${{‖v‖}_{p}}^{\left(w\right)}={‖{v}^{\left(w\right)}‖}_{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 routines comprising the suite is enforced: first, the setup routine F11BRF must be called, followed by the solver F11BSF. F11BTF can be called either when F11BSF is carrying out a monitoring step or after F11BSF 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. Bi-CGSTAB($\ell$) seems robust and reliable, but it can be slower than the other methods: if a preconditioner is used and $\ell >1$, Bi-CGSTAB($\ell$) computes the solution of the preconditioned system ${\stackrel{-}{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, Bi-CGSTAB($\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 transpose-free quasi-minimal residual algorithm for non-Hermitian linear systems SIAM J. Sci. Comput. 14 470–482
Freund R W and Nachtigal N (1991) QMR: a Quasi-Minimal Residual Method for Non-Hermitian 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 one-norm 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 Lanczos-type solver for nonsymmetric linear systems SIAM J. Sci. Statist. Comput. 10 36–52
Van der Vorst H (1989) Bi-CGSTAB, a fast and smoothly converging variant of Bi-CG for the solution of nonsymmetric linear systems SIAM J. Sci. Statist. Comput. 13 631–644

5  Parameters

1:     METHOD – CHARACTER(*)Input
On entry: the iterative method to be used.
${\mathbf{METHOD}}=\text{'RGMRES'}$
Restarted generalized minimum residual method.
${\mathbf{METHOD}}=\text{'CGS'}$
Conjugate gradient squared method.
${\mathbf{METHOD}}=\text{'BICGSTAB'}$
Bi-conjugate gradient stabilized ($\ell$) method.
${\mathbf{METHOD}}=\text{'TFQMR'}$
Transpose-free quasi-minimal residual method.
Constraint: ${\mathbf{METHOD}}=\text{'RGMRES'}$, $\text{'CGS'}$, $\text{'BICGSTAB'}$ or $\text{'TFQMR'}$.
2:     PRECON – CHARACTER(1)Input
On entry: determines whether preconditioning is used.
${\mathbf{PRECON}}=\text{'N'}$
No preconditioning.
${\mathbf{PRECON}}=\text{'P'}$
Preconditioning.
Constraint: ${\mathbf{PRECON}}=\text{'N'}$ or $\text{'P'}$.
3:     NORM – CHARACTER(1)Input
On entry: defines the matrix and vector norm to be used in the termination criteria.
${\mathbf{NORM}}=\text{'1'}$
${l}_{1}$ norm.
${\mathbf{NORM}}=\text{'I'}$
${l}_{\infty }$ norm.
${\mathbf{NORM}}=\text{'2'}$
${l}_{2}$ norm.
Suggested values:
• if ${\mathbf{ITERM}}=1$, ${\mathbf{NORM}}=\text{'I'}$;
• if ${\mathbf{ITERM}}=2$, ${\mathbf{NORM}}=\text{'2'}$.
Constraints:
• if ${\mathbf{ITERM}}=1$, ${\mathbf{NORM}}=\text{'1'}$, $\text{'I'}$ or $\text{'2'}$;
• if ${\mathbf{ITERM}}=2$, ${\mathbf{NORM}}=\text{'2'}$.
4:     WEIGHT – CHARACTER(1)Input
On entry: specifies whether a vector $w$ of user-supplied weights is to be used in the computation of the vector norms required in termination criterion (2) (${\mathbf{ITERM}}=1$): ${{‖v‖}_{p}}^{\left(w\right)}={‖{v}^{\left(w\right)}‖}_{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 parameter NORM. Note that weights cannot be used when ${\mathbf{ITERM}}=2$, i.e., when criterion (3) is used.
${\mathbf{WEIGHT}}=\text{'W'}$
User-supplied weights are to be used and must be supplied on initial entry to F11BSF.
${\mathbf{WEIGHT}}=\text{'N'}$
All weights are implicitly set equal to one. Weights do not need to be supplied on initial entry to F11BSF.
Suggested value: ${\mathbf{WEIGHT}}=\text{'N'}$.
Constraints:
• if ${\mathbf{ITERM}}=1$, ${\mathbf{WEIGHT}}=\text{'W'}$ or $\text{'N'}$;
• if ${\mathbf{ITERM}}=2$, ${\mathbf{WEIGHT}}=\text{'N'}$.
5:     ITERM – INTEGERInput
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}}=\text{'TFQMR'}$ or ${\mathbf{WEIGHT}}=\text{'W'}$ or ${\mathbf{NORM}}=\text{'2'}$, ${\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}}=\text{'2'}$, ${\mathbf{WEIGHT}}=\text{'N'}$ and ${\mathbf{METHOD}}\ne \text{'TFQMR'}$.
6:     N – INTEGERInput
On entry: $n$, the order of the matrix $A$.
Constraint: ${\mathbf{N}}>0$.
7:     M – INTEGERInput
On entry: if ${\mathbf{METHOD}}=\text{'RGMRES'}$, M is the dimension $m$ of the restart subspace.
If ${\mathbf{METHOD}}=\text{'BICGSTAB'}$, M is the order $\ell$ of the polynomial Bi-CGSTAB method.
Otherwise, M is not referenced.
Constraints:
• if ${\mathbf{METHOD}}=\text{'RGMRES'}$, $0<{\mathbf{M}}\le \mathrm{min}\phantom{\rule{0.125em}{0ex}}\left({\mathbf{N}},50\right)$;
• if ${\mathbf{METHOD}}=\text{'BICGSTAB'}$, $0<{\mathbf{M}}\le \mathrm{min}\phantom{\rule{0.125em}{0ex}}\left({\mathbf{N}},10\right)$.
8:     TOL – REAL (KIND=nag_wp)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:     MAXITN – INTEGERInput
On entry: the maximum number of iterations.
Constraint: ${\mathbf{MAXITN}}>0$.
10:   ANORM – REAL (KIND=nag_wp)Input
On entry: if ${\mathbf{ANORM}}>0.0$, the value of ${‖A‖}_{p}$ to be used in the termination criterion (2) (${\mathbf{ITERM}}=1$).
If ${\mathbf{ANORM}}\le 0.0$, ${\mathbf{ITERM}}=1$ and ${\mathbf{NORM}}=\text{'1'}$ or $\text{'I'}$, then ${‖A‖}_{1}={‖A‖}_{\infty }$ is estimated internally by F11BSF.
If ${\mathbf{ITERM}}=2$, ANORM is not referenced.
Constraint: if ${\mathbf{ITERM}}=1$ and ${\mathbf{NORM}}=\text{'2'}$, ${\mathbf{ANORM}}>0.0$.
11:   SIGMAX – REAL (KIND=nag_wp)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}}=\text{'RGMRES'}$, then the value of ${\sigma }_{1}$ will be estimated internally.
Constraint: if ${\mathbf{METHOD}}=\text{'CGS'}$ or $\text{'BICGSTAB'}$ and ${\mathbf{ITERM}}=2$, ${\mathbf{SIGMAX}}>0.0$.
12:   MONIT – INTEGERInput
On entry: if ${\mathbf{MONIT}}>0$, the frequency at which a monitoring step is executed by F11BSF: if ${\mathbf{METHOD}}=\text{'CGS'}$ or $\text{'TFQMR'}$, a monitoring step is executed every MONIT iterations; otherwise, a monitoring step is executed every MONIT super-iterations (groups of up to $m$ or $\ell$ iterations for RGMRES or Bi-CGSTAB($\ell$), respectively).
There are some additional computational costs involved in monitoring the solution and residual vectors when the Bi-CGSTAB($\ell$) method is used with $\ell >1$.
Constraint: ${\mathbf{MONIT}}\le {\mathbf{MAXITN}}$.
13:   LWREQ – INTEGEROutput
On exit: the minimum amount of workspace required by F11BSF. (See also Section 5 in F11BSF.)
14:   WORK(LWORK) – COMPLEX (KIND=nag_wp) arrayCommunication Array
On exit: the array WORK is initialized by F11BRF. It must not be modified before calling the next routine in the suite, namely F11BSF.
15:   LWORK – INTEGERInput
On entry: the dimension of the array WORK as declared in the (sub)program from which F11BRF is called.
Constraint: ${\mathbf{LWORK}}\ge 120$.
Note:  although the minimum value of LWORK ensures the correct functioning of F11BRF, a larger value is required by the other routines in the suite, namely F11BSF and F11BTF. 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$. Bi-CGSTAB($\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:   IFAIL – INTEGERInput/Output
On entry: IFAIL must be set to $0$, $-1\text{​ or ​}1$. If you are unfamiliar with this parameter you should refer to Section 3.3 in the Essential Introduction for details.
For environments where it might be inappropriate to halt program execution when an error is detected, the value $-1\text{​ or ​}1$ is recommended. If the output of error messages is undesirable, then the value $1$ is recommended. Otherwise, if you are not familiar with this parameter, the recommended value is $0$. When the value $-\mathbf{1}\text{​ or ​}\mathbf{1}$ is used it is essential to test the value of IFAIL on exit.
On exit: ${\mathbf{IFAIL}}={\mathbf{0}}$ unless the routine detects an error or a warning has been flagged (see Section 6).

6  Error Indicators and Warnings

If on entry ${\mathbf{IFAIL}}={\mathbf{0}}$ or $-{\mathbf{1}}$, explanatory error messages are output on the current error message unit (as defined by X04AAF).
Errors or warnings detected by the routine:
${\mathbf{IFAIL}}=-i$
On entry, the $i$th argument had an illegal value.
${\mathbf{IFAIL}}=1$
F11BRF has been called out of sequence.

Not applicable.

8  Further Comments

RGMRES can estimate internally the maximum singular value ${\sigma }_{1}$ of the iteration matrix, using ${\sigma }_{1}\sim {‖T‖}_{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 bi-orthogonality in the Bi-CGSTAB($\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 super-iteration may be less than the value specified in the input parameter M. Also, if termination criterion (2) is used, the CGS, Bi-CGSTAB($\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}=b-A{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.

9  Example

This example solves an $8×8$ non-Hermitian 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 F11DNF and F11DPF).

9.1  Program Text

Program Text (f11brfe.f90)

9.2  Program Data

Program Data (f11brfe.d)

9.3  Program Results

Program Results (f11brfe.r)

F11BRF (PDF version)
F11 Chapter Contents
F11 Chapter Introduction
NAG Library Manual