# NAG FL Interfacef12arf (complex_​option)

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 11 for a detailed description of the specification of the optional parameters.

## ▸▿ Contents

Settings help

FL Name Style:

FL Specification Language:

## 1Purpose

f12arf is an option setting routine in a suite of routines consisting of f12anf, f12apf, f12aqf, f12arf and f12asf; it supplies individual optional parameters to f12apf and f12aqf. f12arf is also an option setting routine in a suite of routines consisting of f12arf, f12atf and f12auf; it supplies individual optional parameters to f12auf.
The initialization routine for the appropriate suite, f12anf or f12atf, must have been called prior to calling f12arf.

## 2Specification

Fortran Interface
 Subroutine f12arf ( str, comm,
 Integer, Intent (Inout) :: icomm(*), ifail Complex (Kind=nag_wp), Intent (Inout) :: comm(*) Character (*), Intent (In) :: str
#include <nag.h>
 void f12arf_ (const char *str, Integer icomm[], Complex comm[], Integer *ifail, const Charlen length_str)
The routine may be called by the names f12arf or nagf_sparseig_complex_option.

## 3Description

f12arf may be used to supply values for optional parameters to f12apf and f12aqf, or to f12auf. It is only necessary to call f12arf for those arguments whose values are to be different from their default values. One call to f12arf sets one argument 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
`Iteration Limit = 500`
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.
f12arf does not have an equivalent routine from the ARPACK package which passes options by directly setting values to scalar arguments or to specific elements of array arguments. f12arf is intended to make the passing of options more transparent and follows the same principle as the single option setting routines in Chapter E04 (see e04nsf for an example).
The setup routine f12anf or f12atf must be called prior to the first call to f12arf, and all calls to f12arf must precede the first call to f12apf and f12auf.
A complete list of optional parameters, their abbreviations, synonyms and default values is given in Section 11.

## 4References

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 MCS-P547-1195 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 Large-scale Eigenvalue Problems with Implicitly Restarted Arnoldi Methods SIAM, Philadelphia

## 5Arguments

1: $\mathbf{str}$Character(*) Input
On entry: a single valid option string (as described in Section 3 and Section 11).
2: $\mathbf{icomm}\left(*\right)$Integer array Communication Array
Note: the actual argument supplied must be the array icomm supplied to the initialization routines f12anf f12atf.
On initial entry: must remain unchanged following a call to the setup routine f12anf or f12atf.
On exit: contains data on the current options set.
3: $\mathbf{comm}\left(*\right)$Complex (Kind=nag_wp) array Communication Array
Note: the actual argument supplied must be the array comm supplied to the initialization routines f12anf f12atf.
On initial entry: must remain unchanged following a call to the setup routine f12anf or f12atf.
On exit: contains data on the current options set.
4: $\mathbf{ifail}$Integer Input/Output
On entry: ifail must be set to $0$, $-1$ or $1$ to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of $0$ causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of $-1$ means that an error message is printed while a value of $1$ means that it is not.
If halting is not appropriate, the value $-1$ or $1$ is recommended. If message printing is undesirable, then the value $1$ is recommended. Otherwise, the value $0$ is recommended. When the value $-\mathbf{1}$ 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).

## 6Error Indicators and Warnings

If on entry ${\mathbf{ifail}}=0$ or $-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$
Ambiguous keyword: $⟨\mathit{\text{value}}⟩$
${\mathbf{ifail}}=2$
Keyword not recognized: $⟨\mathit{\text{value}}⟩$
${\mathbf{ifail}}=3$
Second keyword not recognized: $⟨\mathit{\text{value}}⟩$
${\mathbf{ifail}}=4$
Either the initialization routine has not been called prior to the call of this routine or a communication array has become corrupted.
${\mathbf{ifail}}=-99$
See Section 7 in the Introduction to the NAG Library FL Interface for further information.
${\mathbf{ifail}}=-399$
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library FL Interface for further information.
${\mathbf{ifail}}=-999$
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.

Not applicable.

## 8Parallelism and Performance

f12arf is not threaded in any implementation.

None.

## 10Example

This example solves $Ax=\lambda Bx$ in shifted-inverse mode, where $A$ and $B$ are derived from the finite element discretization of the one-dimensional convection-diffusion operator $\frac{{d}^{2}u}{d{x}^{2}}+\rho \frac{du}{dx}$ on the interval $\left[0,1\right]$, with zero Dirichlet boundary conditions.

### 10.1Program Text

Program Text (f12arfe.f90)

### 10.2Program Data

Program Data (f12arfe.d)

### 10.3Program Results

Program Results (f12arfe.r)

## 11Optional Parameters

Several optional parameters for the computational suite routines f12apf and f12aqf, and for the banded driver f12auf, define choices in the problem specification or the algorithm logic. In order to reduce the number of formal arguments of f12apf, f12aqf and f12auf 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 11.1.
Optional parameters may be specified by calling f12arf before a call to f12apf or f12auf, but after a corresponding call to f12anf or f12atf. One call is necessary for each optional parameter. Any optional parameters you do not specify are set to their default values. Optional parameters you do specify are unaltered by f12apf, f12aqf and f12auf (unless they define invalid values) and so remain in effect for subsequent calls unless you alter them.

### 11.1Description 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$ 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{advisory message unit number}$
 Defaults
This special keyword may be used to reset all optional parameters to their default values.
 Exact Shifts Default
 Supplied Shifts
During the Arnoldi iterative process, shifts are applied as part of the implicit restarting scheme. The shift strategy used by default and selected by the optional parameter Exact Shifts is strongly recommended over the alternative Supplied Shifts and will always be used by f12auf.
If Exact Shifts are used then these are computed internally by the algorithm in the implicit restarting scheme. This strategy is generally effective and cheaper to apply in terms of number of operations than using explicit shifts.
If Supplied Shifts are used then, during the Arnoldi iterative process, you must supply shifts through array arguments of f12apf when f12apf returns with ${\mathbf{irevcm}}=3$; the complex shifts are returned in x (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 Arnoldi iterations that can be performed before f12apf or f12auf exits. If not all requested eigenvalues have converged to within Tolerance and the number of Arnoldi iterations has reached this limit then f12apf or f12auf exits with an error; f12auf returns the number of converged eigenvalues, the converged eigenvalues and, if requested, the corresponding eigenvectors, while f12aqf can be called subsequent to f12apf to do the same.
 Largest Magnitude Default
 Largest Imaginary
 Largest Real
 Smallest Imaginary
 Smallest Magnitude
 Smallest Real
The Arnoldi iterative method converges on a number of eigenvalues with given properties. The default is for f12apf or f12auf to compute the eigenvalues of largest magnitude using Largest Magnitude. Alternatively, eigenvalues may be chosen which have Largest Real part, Largest Imaginary part, Smallest Magnitude, Smallest Real part or Smallest Imaginary part.
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.
 Nolist Default
 List
Optional parameter List enables printing of each optional parameter specification as it is supplied. Nolist suppresses this printing.
 Monitoring $i$ Default $\text{}=-1$
If $i>0$, monitoring information is output to unit number $i$ during the solution of each problem; this may be the same as the Advisory unit 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 unit number.
 Pointers Default $\text{}=\mathrm{NO}$
During the iterative process and reverse communication calls to f12apf, required data can be communicated to and from f12apf 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 f12apf. For example, when ${\mathbf{irevcm}}=1$, f12apf returns the vector $x$ in x and the matrix-vector 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 f12apf to perform fewer copy operations on each intermediate exit and entry, but can also lead to less elegant code in the calling program.
This option has no affect on f12auf which sets ${\mathbf{Pointers}}=\mathrm{YES}$ internally.
 Print Level $i$ Default $\text{}=0$
This controls the amount of printing produced by f12arf as follows.
$\mathbit{i}$ Output
$=0$ No output except error messages.
$>0$ The set of selected options.
$=2$ Problem and timing statistics on final exit from f12apf or f12auf.
$\ge 5$ A single line of summary output at each Arnoldi iteration.
$\ge 10$ If ${\mathbf{Monitoring}}>0$, then at each iteration, the length and additional steps of the current Arnoldi factorization and the number of converged Ritz values; during re-orthogonalization, the norm of initial/restarted starting vector.
$\ge 20$ Problem and timing statistics on final exit from f12apf. If ${\mathbf{Monitoring}}>0$, then at each iteration, the number of shifts being applied, the eigenvalues and estimates of the Hessenberg matrix $H$, the size of the Arnoldi basis, the wanted Ritz values and associated Ritz estimates and the shifts applied; vector norms prior to and following re-orthogonalization.
$\ge 30$ If ${\mathbf{Monitoring}}>0$, 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 compressed upper Hessenberg matrix $H$; during re-orthogonalization, the initial/restarted starting vector; during the Arnoldi iteration loop, a restart is flagged and the number of the residual requiring iterative refinement; while applying shifts, the indices of the shifts being applied.
$\ge 40$ If ${\mathbf{Monitoring}}>0$, then during the Arnoldi iteration loop, the Arnoldi 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 ${\mathbf{Monitoring}}>0$, then during Arnoldi iteration loop: norms of key components and the active column of $H$, norms of residuals during iterative refinement, the final upper Hessenberg matrix $H$; while applying shifts: number of shifts, shift values, block indices, updated matrix $H$; while computing eigenvalues of $H$: the matrix $H$, the computed eigenvalues and Ritz estimates.
 Random Residual Default
 Initial Residual
To begin the Arnoldi iterative process, f12apf or f12auf requires an initial residual vector. By default f12apf or f12auf 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 f12apf or f12auf through the array argument resid; this option can be set using optional parameter Initial Residual.
 Regular Default
 Regular Inverse
 Shifted Inverse
These options define the computational mode which in turn defines the form of operation $\mathrm{op}\left(x\right)$ to be performed by f12auf or when f12apf returns with ${\mathbf{irevcm}}=-1$ or $1$ and the matrix-vector product $Bx$ when f12apf 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)$.
 Regular $\mathrm{op}=A$ Shifted Inverse $\mathrm{op}={\left(A-\sigma I\right)}^{-1}$
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$
 Standard Default
 Generalized
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{}=\mathrm{RITZ}$
The routine f12aqf or f12auf 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 f12aqf or f12auf. 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 f12aqf or f12auf, if z is set equal to v then the Schur vectors in v are overwritten by the eigenvectors computed by f12aqf or f12auf.