NAG Library Routine Document
F12FDF
Note: this routine uses optional parameters to define choices in the problem specification. If you wish to use default
settings for all of the optional parameters, then this routine need not be called. If, however, you wish to reset some or all of the settings please refer to Section 10 for a detailed description of the specification of the optional parameters.
1 Purpose
F12FDF is an option setting routine in a suite of routines consisting of
F12FAF,
F12FBF,
F12FCF, F12FDF and
F12FEF, and may be used to supply individual optional parameters to
F12FBF and
F12FCF. The initialization routine
F12FAF must have been called prior to calling F12FDF.
2 Specification
INTEGER 
ICOMM(*), IFAIL 
REAL (KIND=nag_wp) 
COMM(*) 
CHARACTER(*) 
STR 

3 Description
F12FDF may be used to supply values for optional parameters to
F12FBF and
F12FCF. It is only necessary to call F12FDF for those parameters whose values are to be different from their default values. One call to F12FDF sets one parameter value.
Each optional parameter is defined by a single character string consisting of one or more items. The items associated with a given option must be separated by spaces, or equals signs
$\left[=\right]$. Alphabetic characters may be upper or lower case. The string
'Pointers = Yes'
is an example of a string used to set an optional parameter. For each option the string contains one or more of the following items:
– 
a mandatory keyword; 
– 
a phrase that qualifies the keyword; 
– 
a number that specifies an integer or real value. Such numbers may be up to $16$ contiguous characters in
Fortran's I, F, E or D format.

F12FDF does not have an equivalent routine from the ARPACK package which passes options by directly setting values to scalar parameters or to specific elements of array arguments. F12FDF is intended to make the passing of options more transparent and follows the same principle as the single option setting routines in
Chapter E04.
The setup routine
F12FAF must be called prior to the first call to F12FDF and all calls to F12FDF must precede the first call to
F12FBF, the reverse communication iterative solver.
A complete list of optional parameters, their abbreviations, synonyms and default values is given in
Section 10.
4 References
Lehoucq R B (2001) Implicitly restarted Arnoldi methods and subspace iteration SIAM Journal on Matrix Analysis and Applications 23 551–562
Lehoucq R B and Scott J A (1996) An evaluation of software for computing eigenvalues of sparse nonsymmetric matrices Preprint MCSP5471195 Argonne National Laboratory
Lehoucq R B and Sorensen D C (1996) Deflation techniques for an implicitly restarted Arnoldi iteration SIAM Journal on Matrix Analysis and Applications 17 789–821
Lehoucq R B, Sorensen D C and Yang C (1998) ARPACK Users' Guide: Solution of Largescale Eigenvalue Problems with Implicitly Restarted Arnoldi Methods SIAM, Philidelphia
5 Parameters
 1: STR – CHARACTER(*)Input
On entry: a single valid option string (as described in
Section 3 and
Section 10).
 2: ICOMM($*$) – INTEGER arrayCommunication Array

Note: the dimension of the array
ICOMM
must be at least
$\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{LICOMM}}\right)$ (see
F12FAF).
On initial entry: must remain unchanged following a call to the setup routine
F12FAF.
On exit: contains data on the current options set.
 3: COMM($*$) – REAL (KIND=nag_wp) arrayCommunication Array

Note: the dimension of the array
COMM
must be at least
$60$.
On initial entry: must remain unchanged following a call to the setup routine
F12FAF.
On exit: contains data on the current options set.
 4: 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}}=1$
The string passed in
STR contains an ambiguous keyword.
 ${\mathbf{IFAIL}}=2$
The string passed in
STR contains a keyword that could not be recognized.
 ${\mathbf{IFAIL}}=3$
The string passed in
STR contains a second keyword that could not be recognized.
 ${\mathbf{IFAIL}}=4$
The initialization routine
F12FAF has not been called or a communication array has become corrupted.
7 Accuracy
Not applicable.
None.
9 Example
This example solves
$Ax=\lambda Bx$ in
Shifted Inverse mode, where
$A$ and
$B$ are obtained from the standard central difference discretization of the onedimensional Laplacian operator
$\frac{{\partial}^{2}u}{\partial {x}^{2}}$ on
$\left[0,1\right]$, with zero Dirichlet boundary conditions. Data is passed to and from the reverse communication routine
F12FBF using pointers to the communication array.
9.1 Program Text
Program Text (f12fdfe.f90)
9.2 Program Data
Program Data (f12fdfe.d)
9.3 Program Results
Program Results (f12fdfe.r)
10 Optional Parameters
Several optional parameters for the computational routines
F12FBF and
F12FCF define choices in the problem specification or the algorithm logic. In order to reduce the number of formal parameters of
F12FBF and
F12FCF these optional parameters have associated
default values that are appropriate for most problems. Therefore, you need only specify those optional parameters whose values are to be different from their default values.
The remainder of this section can be skipped if you wish to use the default values for all optional parameters.
The following is a list of the optional parameters available. A full description of each optional parameter is provided in
Section 10.1.
Optional parameters may be specified by calling F12FDF before a call to
F12FBF, but after a call to
F12FAF. One call is necessary for each optional parameter.
All optional parameters you do not specify are set to their default values. Optional parameters you do specify are unaltered by
F12FBF and
F12FCF (unless they define invalid values) and so remain in effect for subsequent calls unless you alter them.
10.1 Description of the Optional Parameters
For each option, we give a summary line, a description of the optional parameter and details of constraints.
The summary line contains:
 the keywords, where the minimum abbreviation of each keyword is underlined;
 a parameter value,
where the letters $a$, $i\text{ and}r$ denote options that take character, integer and real values respectively;
 the default value, where the symbol $\epsilon $ is a generic notation for machine precision (see X02AJF).
Keywords and character values are case and white space insensitive.
Advisory  $i$  Default $\text{}=$ the value returned by X04ABF

The destination for advisory messages.
This special keyword may be used to reset all optional parameters to their default values.
During the Lanczos iterative process, shifts are applied internally as part of the implicit restarting scheme. The shift strategy used by default and selected by the
Exact Shifts is strongly recommended over the alternative
Supplied Shifts (see
Lehoucq et al. (1998) for details of shift strategies).
If
Exact Shifts are used then these are computed internally by the algorithm in the implicit restarting scheme.
If
Supplied Shifts are used then, during the Lanczos iterative process, you must supply shifts through array arguments of
F12FBF when
F12FBF returns with
${\mathbf{IREVCM}}=3$; the real and imaginary parts of the shifts are
returned in
X and
MX respectively (or in
COMM when the option
${\mathbf{Pointers}}=\mathrm{YES}$ is set).
This option should only be used if you are an experienced user since this requires some algorithmic knowledge and because more operations are usually required than for the implicit shift scheme. Details on the use of explicit shifts and further references on shift strategies are available in
Lehoucq et al. (1998).
Iteration Limit  $i$ 
Default $\text{}=300$ 
The limit on the number of Lanczositerations that can be performed before
F12FBF exits. If not all requested eigenvalues have converged to within
Tolerance and the number of Lanczositerations has reached this limit then
F12FBF exits with an error;
F12FCF can still be called subsequently to return the number of converged eigenvalues, the converged eigenvalues and, if requested, the corresponding eigenvectors.
The Lanczos iterative method converges on a number of eigenvalues with given properties. The default is for
F12FBF to compute the eigenvalues of largest magnitude using
Largest Magnitude. Alternatively, eigenvalues may be chosen which have
Largest Algebraic part,
Smallest Magnitude, or
Smallest Algebraic part; or eigenvalues which are from
Both Ends of the algebraic spectrum.
Note that these options select the eigenvalue properties for eigenvalues of
$\mathrm{OP}$ (and
$B$ for
Generalized problems), the linear operator determined by the computational mode and problem type.
Normally each optional parameter specification is not printed to
the advisory channel
as it is supplied. Optional parameter
List may be used to enable printing and optional parameter
Nolist may be used to suppress the printing.
Monitoring  $i$  Default $\text{}=1$ 
If
$i>0$, monitoring information is output to channel number
$i$ during the solution of each problem; this may be the same as the
Advisory channel number. The type of information produced is dependent on the value of
Print Level, see the description of the optional parameter
Print Level for details of the information produced. Please see
X04ACF to associate a file with a given channel number.
Pointers   Default $\text{}=\mathrm{NO}$ 
During the iterative process and reverse communication calls to
F12FBF, required data can be communicated to and from
F12FBF in one of two ways. When
${\mathbf{Pointers}}=\mathrm{NO}$ is selected (the default) then the array arguments
X and
MX are used to supply you with required data and used to return computed values back to
F12FBF. For example, when
${\mathbf{IREVCM}}=1$,
F12FBF returns the vector
$x$ in
X and the matrixvector product
$Bx$ in
MX and expects the result or the linear operation
$\mathrm{OP}\left(x\right)$ to be returned in
X.
If
${\mathbf{Pointers}}=\mathrm{YES}$ is selected then the data is passed through sections of the array argument
COMM. The section corresponding to
X when
${\mathbf{Pointers}}=\mathrm{NO}$ begins at a location given by the first element of
ICOMM; similarly the section corresponding to
MX begins at a location given by the second element of
ICOMM. This option allows
F12FBF to perform fewer copy operations on each intermediate exit and entry, but can also lead to less elegant code in the calling program.
Print Level  $i$  Default $\text{}=0$ 
This controls the amount of printing produced by F12FDF as follows.
$=0$ 
No output except error messages. If you want to suppress all output, set ${\mathbf{Print\; Level}}=0$. 
$>0$ 
The set of selected options. 
$=2$ 
Problem and timing statistics on final exit from F12FBF. 
$\ge 5$ 
A single line of summary output at each Lanczos iteration. 
$\ge 10$ 
If
${\mathbf{Monitoring}}>0$,
Monitoring is set,
then at each iteration, the length and additional steps of the current Lanczos factorization and the number of converged Ritz values; during reorthogonalization, the norm of initial/restarted starting vector; on a final Lanczos iteration, the number of update iterations taken, the number of converged eigenvalues, the converged eigenvalues and their Ritz estimates. 
$\ge 20$ 
Problem and timing statistics on final exit from F12FBF. If
${\mathbf{Monitoring}}>0$,
Monitoring is set,
then at each iteration, the number of shifts being applied, the eigenvalues and estimates of the symmetric tridiagonal matrix $H$, the size of the Lanczos basis, the wanted Ritz values and associated Ritz estimates and the shifts applied; vector norms prior to and following reorthogonalization. 
$\ge 30$ 
If
${\mathbf{Monitoring}}>0$,
Monitoring is set,
then on final iteration, the norm of the residual; when computing the Schur form, the eigenvalues and Ritz estimates both before and after sorting; for each iteration, the norm of residual for compressed factorization and the symmetric tridiagonal matrix $H$; during reorthogonalization, the initial/restarted starting vector; during the Lanczos iteration loop, a restart is flagged and the number of the residual requiring iterative refinement; while applying shifts, some indices. 
$\ge 40$ 
If
${\mathbf{Monitoring}}>0$,
Monitoring is set,
then during the Lanczos iteration loop, the Lanczos vector number and norm of the current residual; while applying shifts, key measures of progress and the order of $H$; while computing eigenvalues of $H$, the last rows of the Schur and eigenvector matrices; when computing implicit shifts, the eigenvalues and Ritz estimates of $H$. 
$\ge 50$ 
If Monitoring is set, then during Lanczos iteration loop: norms of key components and the active column of $H$, norms of residuals during iterative refinement, the final symmetric tridiagonal matrix $H$; while applying shifts: number of shifts, shift values, block indices, updated tridiagonal matrix $H$; while computing eigenvalues of $H$: the diagonals of $H$, the computed eigenvalues and Ritz estimates. 
Note that setting
${\mathbf{Print\; Level}}\ge 30$ can result in very lengthy
Monitoring output.
Note that setting
${\mathbf{Print\; Level}}\ge 30$ can result in very lengthy
Monitoring output.
To begin the Lanczos iterative process,
F12FBF requires an initial residual vector. By default
F12FBF provides its own random initial residual vector; this option can also be set using optional parameter
Random Residual. Alternatively, you can supply an initial residual vector (perhaps from a previous computation) to
F12FBF through the array argument
RESID; this option can be set using optional parameter
Initial Residual.
These options define the computational mode which in turn defines the form of operation
$\mathrm{OP}\left(x\right)$ to be performed when
F12FBF returns with
${\mathbf{IREVCM}}=1$ or
$1$ and the matrixvector product
$Bx$ when
F12FBF returns with
${\mathbf{IREVCM}}=2$.
Given a
Standard eigenvalue problem in the form
$Ax=\lambda x$ then the following modes are available with the appropriate operator
$\mathrm{OP}\left(x\right)$.
Given a
Generalized eigenvalue problem in the form
$Ax=\lambda Bx$ then the following modes are available with the appropriate operator
$\mathrm{OP}\left(x\right)$.
Regular Inverse 
$\mathrm{OP}={B}^{1}A$ 
Shifted Inverse 
$\mathrm{OP}={\left(A\sigma B\right)}^{1}B$, where $\sigma $ is real 
Buckling 
$\mathrm{OP}={\left(B\sigma A\right)}^{1}A$, where $\sigma $ is real 
Cayley 
$\mathrm{OP}={\left(A\sigma B\right)}^{1}\left(A+\sigma B\right)$, where $\sigma $ is real 
The problem to be solved is either a standard eigenvalue problem,
$Ax=\lambda x$, or a generalized eigenvalue problem,
$Ax=\lambda Bx$. The optional parameter
Standard should be used when a standard eigenvalue problem is being solved and the optional parameter
Generalized should be used when a generalized eigenvalue problem is being solved.
Tolerance  $r$ 
Default $\text{}=\epsilon $ 
An approximate eigenvalue has deemed to have converged when the corresponding Ritz estimate is within
Tolerance relative to the magnitude of the eigenvalue.
Vectors   Default $\text{}=\text{RITZ}$ 
The routine
F12FCF can optionally compute the Schur vectors and/or the eigenvectors corresponding to the converged eigenvalues. To turn off computation of any vectors the option
${\mathbf{Vectors}}=\mathrm{NONE}$ should be set. To compute only the Schur vectors (at very little extra cost), the option
${\mathbf{Vectors}}=\mathrm{SCHUR}$ should be set and these will be returned in the array argument
V of
F12FCF. To compute the eigenvectors (Ritz vectors) corresponding to the eigenvalue estimates, the option
${\mathbf{Vectors}}=\mathrm{RITZ}$ should be set and these will be returned in the array argument
Z of
F12FCF, if
Z is set equal to
V (as in
Section 9) then the Schur vectors in
V are overwritten by the eigenvectors computed by
F12FCF.