Note:this routine usesoptional parametersto define choices in the problem specification. If you wish to use default settings for all of the optional parameters, then the option setting routine f12fdf need not be called.
If, however, you wish to reset some or all of the settings please refer to Section 11 in f12fdf for a detailed description of the specification of the optional parameters.
f12fbf is an iterative solver in a suite of routines consisting of f12faf,f12fbf,f12fcf,f12fdfandf12fef. It is used to find some of the eigenvalues (and optionally the corresponding eigenvectors) of a standard or generalized eigenvalue problem defined by real symmetric matrices.
The routine may be called by the names f12fbf or nagf_sparseig_real_symm_iter.
3Description
The suite of routines is designed to calculate some of the eigenvalues, $\lambda $, (and optionally the corresponding eigenvectors, $x$) of a standard eigenvalue problem $Ax=\lambda x$, or of a generalized eigenvalue problem $Ax=\lambda Bx$ of order $n$, where $n$ is large and the coefficient matrices $A$ and $B$ are sparse, real and symmetric. The suite can also be used to find selected eigenvalues/eigenvectors of smaller scale dense, real and symmetric problems.
f12fbf is a reverse communication routine, based on the ARPACK routine dsaupd, using the Implicitly Restarted Arnoldi iteration method, which for symmetric problems reduces to a variant of the Lanczos method. The method is described in Lehoucq and Sorensen (1996) and Lehoucq (2001) while its use within the ARPACK software is described in great detail in Lehoucq et al. (1998). An evaluation of software for computing eigenvalues of sparse symmetric matrices is provided in Lehoucq and Scott (1996). This suite of routines offers the same functionality as the ARPACK software for real symmetric problems, but the interface design is quite different in order to make the option setting clearer and to simplify the interface of f12fbf.
The setup routine f12faf must be called before f12fbf, the reverse communication iterative solver. Options may be set for f12fbf by prior calls to the option setting routine f12fdf and a post-processing routine f12fcf must be called following a successful final exit from f12fbf. f12fef, may be called following certain flagged, intermediate exits from f12fbf to provide additional monitoring information about the computation.
f12fbf uses reverse communication, i.e., it returns repeatedly to the calling program with the argument irevcm (see Section 5) set to specified values which require the calling program to carry out one of the following tasks:
–compute the matrix-vector product $y=\mathrm{op}\left(x\right)$, where $\mathrm{op}$ is defined by the computational mode;
–compute the matrix-vector product $y=Bx$;
–notify the completion of the computation;
–allow the calling program to monitor the solution.
The problem type to be solved (standard or generalized), the spectrum of eigenvalues of interest, the mode used (regular, regular inverse, shifted inverse, Buckling or Cayley) and other options can all be set using the option setting routine f12fdf.
4References
Lehoucq R B (2001) Implicitly restarted Arnoldi methods and subspace iteration SIAM Journal on Matrix Analysis and Applications23 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 Applications17 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
Note: this routine uses reverse communication. Its use involves an initial entry, intermediate exits and re-entries, and a final exit, as indicated by the argument irevcm. Between intermediate exits and re-entries, all arguments other thanx, mx and comm must remain unchanged.
1: $\mathbf{irevcm}$ – IntegerInput/Output
On initial entry: ${\mathbf{irevcm}}=0$, otherwise an error condition will be raised.
On intermediate re-entry: must be unchanged from its previous exit value. Changing irevcm to any other value between calls will result in an error.
On intermediate exit:
has the following meanings.
${\mathbf{irevcm}}=\mathrm{-1}$
The calling program must compute the matrix-vector product $y=\mathrm{op}\left(x\right)$, where $x$ is stored in x (by default) or in the array comm (starting from the location given by the first element of icomm) when the option ${\mathbf{Pointers}}=\mathrm{YES}$ is set in a prior call to f12fdf. The result $y$ is returned in x (by default) or in the array comm (starting from the location given by the second element of icomm) when the option ${\mathbf{Pointers}}=\mathrm{YES}$ is set.
${\mathbf{irevcm}}=1$
The calling program must compute the matrix-vector product $y=\mathrm{op}\left(x\right)$. This is similar to the case ${\mathbf{irevcm}}=\mathrm{-1}$ except that the result of the matrix-vector product $Bx$ (as required in some computational modes) has already been computed and is available in mx (by default) or in the array comm (starting from the location given by the third element of icomm) when the option ${\mathbf{Pointers}}=\mathrm{YES}$ is set.
${\mathbf{irevcm}}=2$
The calling program must compute the matrix-vector product $y=Bx$, where $x$ is stored in x and $y$ is returned in mx (by default) or in the array comm (starting from the location given by the second element of icomm) when the option ${\mathbf{Pointers}}=\mathrm{YES}$ is set.
${\mathbf{irevcm}}=3$
Compute the nshift real and imaginary parts of the shifts where the real parts are to be returned in the first nshift locations of the array x and the imaginary parts are to be returned in the first nshift locations of the array mx. Only complex conjugate pairs of shifts may be applied and the pairs must be placed in consecutive locations. This value of irevcm will only arise if the optional parameter Supplied Shifts is set in a prior call to f12fdf which is intended for experienced users only; the default and recommended option is to use exact shifts (see Lehoucq et al. (1998) for details and guidance on the choice of shift strategies).
${\mathbf{irevcm}}=4$
Monitoring step: a call to f12fef can now be made to return the number of Arnoldi iterations, the number of converged Ritz values, their real and imaginary parts, and the corresponding Ritz estimates.
On final exit: ${\mathbf{irevcm}}=5$: f12fbf has completed its tasks. The value of ifail determines whether the iteration has been successfully completed, or whether errors have been detected. On successful completion f12fcf must be called to return the requested eigenvalues and eigenvectors (and/or Schur vectors).
Constraint:
on initial entry, ${\mathbf{irevcm}}=0$; on re-entry irevcm must remain unchanged.
Note: any values you return to f12fbf as part of the reverse communication procedure should not include floating-point NaN (Not a Number) or infinity values, since these are not handled by f12fbf. If your code does inadvertently return any NaNs or infinities, f12fbf is likely to produce unexpected results.
2: $\mathbf{resid}\left(*\right)$ – Real (Kind=nag_wp) arrayInput/Output
Note: the dimension of the array resid
must be at least
${\mathbf{n}}$ (see f12faf).
On initial entry: need not be set unless the option Initial Residual has been set in a prior call to f12fdf in which case resid should contain an initial residual vector, possibly from a previous run.
On intermediate re-entry: must be unchanged from its previous exit. Changing resid to any other value between calls may result in an error exit.
On intermediate exit:
contains the current residual vector.
On final exit: contains the final residual vector.
3: $\mathbf{v}({\mathbf{ldv}},*)$ – Real (Kind=nag_wp) arrayInput/Output
Note: the second dimension of the array v
must be at least
$\mathrm{max}\phantom{\rule{0.125em}{0ex}}(1,{\mathbf{ncv}})$ (see f12faf).
On initial entry: need not be set.
On intermediate re-entry: must be unchanged from its previous exit.
On intermediate exit:
contains the current set of Arnoldi basis vectors.
On final exit: contains the final set of Arnoldi basis vectors.
4: $\mathbf{ldv}$ – IntegerInput
On entry: the first dimension of the array v as declared in the (sub)program from which f12fbf is called.
Constraint:
${\mathbf{ldv}}\ge {\mathbf{n}}$.
5: $\mathbf{x}\left(*\right)$ – Real (Kind=nag_wp) arrayInput/Output
Note: the dimension of the array x
must be at least
${\mathbf{n}}$ if ${\mathbf{Pointers}}=\mathrm{NO}$ (default) and at least
$1$ if ${\mathbf{Pointers}}=\mathrm{YES}$ (see f12faf).
On initial entry: need not be set, it is used as a convenient mechanism for accessing elements of comm.
On intermediate re-entry: if ${\mathbf{Pointers}}=\mathrm{YES}$, x need not be set.
If ${\mathbf{Pointers}}=\mathrm{NO}$, x must contain the result of $y=\mathrm{op}\left(x\right)$ when irevcm returns the value $-1$ or $+1$. It must return the real parts of the computed shifts when irevcm returns the value $3$.
On intermediate exit:
if ${\mathbf{Pointers}}=\mathrm{YES}$, x is not referenced.
If ${\mathbf{Pointers}}=\mathrm{NO}$, x contains the vector $x$ when irevcm returns the value $-1$ or $+1$.
On final exit: does not contain useful data.
6: $\mathbf{mx}\left(*\right)$ – Real (Kind=nag_wp) arrayInput/Output
Note: the dimension of the array mx
must be at least
${\mathbf{n}}$ if ${\mathbf{Pointers}}=\mathrm{NO}$ (default) and at least
$1$ if ${\mathbf{Pointers}}=\mathrm{YES}$ (see f12faf).
On initial entry: need not be set, it is used as a convenient mechanism for accessing elements of comm.
On intermediate re-entry: if ${\mathbf{Pointers}}=\mathrm{YES}$, mx need not be set.
If ${\mathbf{Pointers}}=\mathrm{NO}$, mx must contain the result of $y=Bx$ when irevcm returns the value $2$. It must return the imaginary parts of the computed shifts when irevcm returns the value $3$.
On intermediate exit:
if ${\mathbf{Pointers}}=\mathrm{YES}$, mx is not referenced.
If ${\mathbf{Pointers}}=\mathrm{NO}$, mx contains the vector $Bx$ when irevcm returns the value $+1$.
On final exit: does not contain any useful data.
7: $\mathbf{nshift}$ – IntegerOutput
On intermediate exit:
if the option Supplied Shifts is set and irevcm returns a value of $3$, nshift returns the number of complex shifts required.
8: $\mathbf{comm}\left(*\right)$ – Real (Kind=nag_wp) arrayCommunication Array
Note: the actual argument supplied must be the array comm supplied to the initialization routine f12faf.
On initial entry: must remain unchanged following a call to the setup routine f12faf.
On exit: contains data defining the current state of the iterative process.
Note: the actual argument supplied must be the array icomm supplied to the initialization routine f12faf.
On initial entry: must remain unchanged following a call to the setup routine f12faf.
On exit: contains data defining the current state of the iterative process.
10: $\mathbf{ifail}$ – IntegerInput/Output
On initial entry: ifail must be set to $0$, $\mathrm{-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 $\mathrm{-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 $\mathrm{-1}$ or $1$ is recommended. If message printing is undesirable, then the value $1$ is recommended. Otherwise, the value $\mathrm{-1}$ is recommended since useful values can be provided in some output arguments even when ${\mathbf{ifail}}\ne {\mathbf{0}}$ on exit. When the value $-\mathbf{1}$ or $\mathbf{1}$ is used it is essential to test the value of ifail on exit.
On final 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 $\mathrm{-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 maximum number of iterations $\le 0$, the option Iteration Limit has been set to $\u27e8\mathit{\text{value}}\u27e9$.
Eigenvalues from both ends of the spectrum were requested, but the number of eigenvalues (see nev in f12faf) requested is one.
${\mathbf{ifail}}=4$
The option Initial Residual was selected but the starting vector held in resid is zero.
${\mathbf{ifail}}=5$
The maximum number of iterations has been reached. The maximum number of $\text{iterations}=\u27e8\mathit{\text{value}}\u27e9$. The number of converged eigenvalues $=\u27e8\mathit{\text{value}}\u27e9$. The post-processing routine f12fcf may be called to recover the converged eigenvalues at this point. Alternatively, the maximum number of iterations may be increased by a call to the option setting routine f12fdf and the reverse communication loop restarted. A large number of iterations may indicate a poor choice for the values of nev and ncv; it is advisable to experiment with these values to reduce the number of iterations (see f12faf).
${\mathbf{ifail}}=6$
No shifts could be applied during a cycle of the implicitly restarted Lanczos iteration.
${\mathbf{ifail}}=7$
Could not build a Lanczos factorization. The size of the current Lanczos factorization $=\u27e8\mathit{\text{value}}\u27e9$.
${\mathbf{ifail}}=8$
Error in internal call to compute eigenvalues and corresponding error bounds of the current upper Hessenberg matrix. Please contact NAG.
${\mathbf{ifail}}=9$
Either the routine was called without an initial call to the setup routine or the communication arrays have become corrupted.
${\mathbf{ifail}}=-99$
An unexpected error has been triggered by this routine. Please
contact NAG.
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.
7Accuracy
The relative accuracy of a Ritz value, $\lambda $, is considered acceptable if its Ritz estimate $\text{}\le {\mathbf{Tolerance}}\times \left|\lambda \right|$. The default Tolerance used is the machine precision given by x02ajf.
8Parallelism and Performance
Background information to multithreading can be found in the Multithreading documentation.
f12fbf is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
f12fbf makes calls to BLAS and/or LAPACK routines, which may be threaded within the vendor library used by this implementation. Consult the documentation for the vendor library for further information.
Please consult the X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this routine. Please also consult the Users' Note for your implementation for any additional implementation-specific information.
9Further Comments
None.
10Example
For this routine two examples are presented, with a main program and two example problems given in Example 1 (EX1) and Example 2 (EX2).
Example 1 (EX1)
The example solves $Ax=\lambda x$ in shift-invert mode, where $A$ is obtained from the standard central difference discretization of the one-dimensional Laplacian operator $\frac{{\partial}^{2}u}{\partial {x}^{2}}$ with zero Dirichlet boundary conditions. Eigenvalues closest to the shift $\sigma =0$ are sought.
Example 2 (EX2)
This example illustrates the use of f12fbf to compute the leading terms in the singular value decomposition of a real general matrix $A$. The example finds a few of the largest singular values ($\sigma $) and corresponding right singular values ($\nu $) for the matrix $A$ by solving the symmetric problem: