NAG FL Interface
f12apf (complex_iter)
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 the option setting routine f12arf need not be called.
If, however, you wish to reset some or all of the settings please refer to Section 11 in f12arf for a detailed description of the specification of the optional parameters.
1
Purpose
f12apf is an iterative solver in a suite of routines consisting of
f12anf,
f12apf,
f12aqf,
f12arf and
f12asf. It is used to find some of the eigenvalues (and optionally the corresponding eigenvectors) of a standard or generalized eigenvalue problem defined by complex nonsymmetric matrices.
2
Specification
Fortran Interface
Integer, Intent (In) |
:: |
ldv |
Integer, Intent (Inout) |
:: |
irevcm, icomm(*), ifail |
Integer, Intent (Out) |
:: |
nshift |
Complex (Kind=nag_wp), Intent (Inout) |
:: |
resid(*), v(ldv,*), x(*), mx(*), comm(*) |
|
C++ Header Interface
#include <nag.h> extern "C" {
}
|
The routine may be called by the names f12apf or nagf_sparseig_complex_iter.
3
Description
The suite of routines is designed to calculate some of the eigenvalues, , (and optionally the corresponding eigenvectors, ) of a standard eigenvalue problem , or of a generalized eigenvalue problem of order , where is large and the coefficient matrices and are sparse, complex and nonsymmetric. The suite can also be used to find selected eigenvalues/eigenvectors of smaller scale dense, complex and nonsymmetric problems.
f12apf is a
reverse communication routine, based on the ARPACK routine
znaupd, using the Implicitly Restarted Arnoldi iteration 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 nonsymmetric matrices is provided in
Lehoucq and Scott (1996). This suite of routines offers the same functionality as the ARPACK software for complex nonsymmetric problems, but the interface design is quite different in order to make the option setting clearer and to simplify the interface of
f12apf.
The setup routine
f12anf must be called before
f12apf, the reverse communication iterative solver. Options may be set for
f12apf by prior calls to the option setting routine
f12arf and a post-processing routine
f12aqf must be called following a successful final exit from
f12apf.
f12asf may be called following certain flagged intermediate exits from
f12apf to provide additional monitoring information about the computation.
f12apf 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 , where is defined by the computational mode;
-
–compute the matrix-vector product ;
-
–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, shifted real or shifted imaginary) and other options can all be set using the option setting routine
f12arf (see
Section 11.1 in
f12arf for details on setting options and of the default settings).
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 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, Philidelphia
5
Arguments
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 than x, mx and comm must remain unchanged.
-
1:
– Integer
Input/Output
-
On initial entry: , 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.
- The calling program must compute the matrix-vector product , where 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 is set in a prior call to f12arf. The result 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 is set.
- The calling program must compute the matrix-vector product . This is similar to the case except that the result of the matrix-vector product (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 is set.
- The calling program must compute the matrix-vector product , where is stored in x and 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 is set.
- Compute the nshift complex shifts. This value of irevcm will only arise if the optional parameter Supplied Shifts is set in a prior call to f12arf which is intended for experienced users only; the default and recommended option is to use exact shifts (see Lehoucq et al. (1998) for details).
- Monitoring step: a call to f12asf can now be made to return the number of Arnoldi iterations, the number of converged Ritz values, the array of converged values, and the corresponding Ritz estimates.
On final exit:
:
f12apf 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
f12aqf must be called to return the requested eigenvalues and eigenvectors (and/or Schur vectors).
Constraint:
on initial entry,
; on re-entry
irevcm must remain unchanged.
Note: any values you return to f12apf 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 f12apf. If your code does inadvertently return any NaNs or infinities, f12apf is likely to produce unexpected results.
-
2:
– Complex (Kind=nag_wp) array
Input/Output
-
Note: the dimension of the array
resid
must be at least
(see
f12anf).
On initial entry: need not be set unless the option
Initial Residual has been set in a prior call to
f12arf 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:
– Complex (Kind=nag_wp) array
Input/Output
-
Note: the second dimension of the array
v
must be at least
(see
f12anf).
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:
– Integer
Input
-
On entry: the first dimension of the array
v as declared in the (sub)program from which
f12apf is called.
Constraint:
.
-
5:
– Complex (Kind=nag_wp) array
Input/Output
-
Note: the dimension of the array
x
must be at least
if
(default) and at least
if
(see
f12anf).
On initial entry: need not be set, it is used as a convenient mechanism for accessing elements of
comm.
On intermediate re-entry: if
,
x need not be set.
If
,
x must contain the result of
when
irevcm returns the value
or
. It must return the computed shifts when
irevcm returns the value
.
On intermediate exit:
if
,
x is not referenced.
If
,
x contains the vector
when
irevcm returns the value
or
.
On final exit: does not contain useful data.
-
6:
– Complex (Kind=nag_wp) array
Input/Output
-
Note: the dimension of the array
mx
must be at least
if
(default) and at least
if
(see
f12anf).
On initial entry: need not be set, it is used as a convenient mechanism for accessing elements of
comm.
On intermediate re-entry: if
,
mx need not be set.
If
,
mx must contain the result of
when
irevcm returns the value
.
On intermediate exit:
if
,
mx is not referenced.
If
,
mx contains the vector
when
irevcm returns the value
.
On final exit: does not contain any useful data.
-
7:
– Integer
Output
-
On intermediate exit:
if the option
Supplied Shifts is set and
irevcm returns a value of
,
nshift returns the number of complex shifts required.
-
8:
– Complex (Kind=nag_wp) array
Communication Array
-
Note: the actual argument supplied
must be the array
comm supplied to the initialization routine
f12anf.
On initial entry: must remain unchanged following a call to the setup routine
f12anf.
On exit: contains data defining the current state of the iterative process.
-
9:
– Integer array
Communication Array
-
Note: the actual argument supplied
must be the array
icomm supplied to the initialization routine
f12anf.
On initial entry: must remain unchanged following a call to the setup routine
f12anf.
On exit: contains data defining the current state of the iterative process.
-
10:
– Integer
Input/Output
-
On initial entry:
ifail must be set to
,
or
to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of means that an error message is printed while a value of means that it is not.
If halting is not appropriate, the value
or
is recommended. If message printing is undesirable, then the value
is recommended. Otherwise, the value
is recommended since useful values can be provided in some output arguments even when
on exit.
When the value or is used it is essential to test the value of ifail on exit.
On final exit:
unless the routine detects an error or a warning has been flagged (see
Section 6).
6
Error Indicators and Warnings
If on entry
or
, explanatory error messages are output on the current error message unit (as defined by
x04aaf).
Errors or warnings detected by the routine:
-
The maximum number of iterations
, the option
Iteration Limit has been set to
.
-
The options
Generalized and
Regular are incompatible.
-
The option
Initial Residual was selected but the starting vector held in
resid is zero.
-
The maximum number of iterations has been reached. The maximum number of
. The number of converged eigenvalues
. The post-processing routine
f12aqf 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
f12arf 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
f12anf).
-
No shifts could be applied during a cycle of the implicitly restarted Arnoldi iteration.
-
Could not build an Arnoldi factorization. The size of the current Arnoldi factorization .
-
Error in internal call to compute eigenvalues and corresponding error bounds of the current upper Hessenberg matrix. Please contact
NAG.
-
Either the initialization routine has not been called prior to the first call of this routine or a communication array has become corrupted.
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.
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.
Dynamic memory allocation failed.
See
Section 9 in the Introduction to the NAG Library FL Interface for further information.
7
Accuracy
The relative accuracy of a Ritz value,
, is considered acceptable if its Ritz estimate
. The default
Tolerance used is the
machine precision given by
x02ajf.
8
Parallelism and Performance
f12apf is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
f12apf 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.
None.
10
Example
This example solves in shift-invert mode, where is obtained from the standard central difference discretization of the convection-diffusion operator on the unit square, with zero Dirichlet boundary conditions. The shift used is a complex number.
10.1
Program Text
10.2
Program Data
10.3
Program Results