NAG C Library Function Document
nag_complex_sparse_eigensystem_iter (f12apc)
Note: this function 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 function nag_complex_sparse_eigensystem_option (f12arc) need not be called.
If, however, you wish to reset some or all of the settings please refer to Section 11 in nag_complex_sparse_eigensystem_option (f12arc) for a detailed description of the specification of the optional parameters.
1
Purpose
nag_complex_sparse_eigensystem_iter (f12apc) is an iterative solver in a suite of functions consisting of
nag_complex_sparse_eigensystem_init (f12anc),
nag_complex_sparse_eigensystem_iter (f12apc),
nag_complex_sparse_eigensystem_sol (f12aqc),
nag_complex_sparse_eigensystem_option (f12arc) and
nag_complex_sparse_eigensystem_monit (f12asc). 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
#include <nag.h> 
#include <nagf12.h> 
void 
nag_complex_sparse_eigensystem_iter (Integer *irevcm,
Complex resid[],
Complex v[],
Complex **x,
Complex **y,
Complex **mx,
Integer *nshift,
Complex comm[],
Integer icomm[],
NagError *fail) 

3
Description
The suite of functions 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, complex and nonsymmetric. The suite can also be used to find selected eigenvalues/eigenvectors of smaller scale dense, complex and nonsymmetric problems.
nag_complex_sparse_eigensystem_iter (f12apc) is a
reverse communication function, 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 functions 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
nag_complex_sparse_eigensystem_iter (f12apc).
The setup function
nag_complex_sparse_eigensystem_init (f12anc) must be called before
nag_complex_sparse_eigensystem_iter (f12apc), the reverse communication iterative solver. Options may be set for
nag_complex_sparse_eigensystem_iter (f12apc) by prior calls to the option setting function
nag_complex_sparse_eigensystem_option (f12arc) and a postprocessing function
nag_complex_sparse_eigensystem_sol (f12aqc) must be called following a successful final exit from
nag_complex_sparse_eigensystem_iter (f12apc).
nag_complex_sparse_eigensystem_monit (f12asc) may be called following certain flagged intermediate exits from
nag_complex_sparse_eigensystem_iter (f12apc) to provide additional monitoring information about the computation.
nag_complex_sparse_eigensystem_iter (f12apc) 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 matrixvector product $y=\mathrm{OP}x$, where $\mathrm{OP}$ is defined by the computational mode; 
– 
compute the matrixvector 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, shifted real or shifted imaginary) and other options can all be set using the option setting function
nag_complex_sparse_eigensystem_option (f12arc) (see
Section 11.1 in
nag_complex_sparse_eigensystem_option (f12arc) 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 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
Arguments
Note: this function uses
reverse communication. Its use involves an initial entry, intermediate exits and reentries, and a final exit, as indicated by the argument
irevcm. Between intermediate exits and reentries,
all arguments other than x and y must remain unchanged.
 1:
$\mathbf{irevcm}$ – Integer *Input/Output

On initial entry: ${\mathbf{irevcm}}=0$, otherwise an error condition will be raised.
On intermediate reentry: 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}}=1$
 The calling program must compute the matrixvector product $y=\mathrm{OP}x$, where $x$ is stored in x and the result $y$ is placed in y.
 ${\mathbf{irevcm}}=1$
 The calling program must compute the matrixvector product $y=\mathrm{OP}x$. This is similar to the case ${\mathbf{irevcm}}=1$ except that the result of the matrixvector product $Bx$ (as required in some computational modes) has already been computed and is available in mx.
 ${\mathbf{irevcm}}=2$
 The calling program must compute the matrixvector product $y=Bx$, where $x$ is stored in x and $y$ is placed in y.
 ${\mathbf{irevcm}}=3$
 Compute the nshift complex shifts to be placed in the first nshift locations of the array y. This value of irevcm will only arise if the optional parameter ${\mathbf{Supplied\; Shifts}}$ is set in a prior call to nag_complex_sparse_eigensystem_option (f12arc) which is intended for experienced users only; the default and recommended option is to use exact shifts (see Lehoucq et al. (1998) for details).
 ${\mathbf{irevcm}}=4$
 Monitoring step: a call to nag_complex_sparse_eigensystem_monit (f12asc) 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:
${\mathbf{irevcm}}=5$:
nag_complex_sparse_eigensystem_iter (f12apc) has completed its tasks. The value of
${\mathbf{fail}}\mathbf{.}\mathbf{code}$ determines whether the iteration has been successfully completed, or whether errors have been detected. On successful completion
nag_complex_sparse_eigensystem_sol (f12aqc) must be called to return the requested eigenvalues and eigenvectors (and/or Schur vectors).
Constraint:
on initial entry,
${\mathbf{irevcm}}=0$; on reentry
irevcm must remain unchanged.
Note: any values you return to nag_complex_sparse_eigensystem_iter (f12apc) as part of the reverse communication procedure should not include floatingpoint NaN (Not a Number) or infinity values, since these are not handled by nag_complex_sparse_eigensystem_iter (f12apc). If your code inadvertently does return any NaNs or infinities, nag_complex_sparse_eigensystem_iter (f12apc) is likely to produce unexpected results.
 2:
$\mathbf{resid}\left[\mathit{dim}\right]$ – ComplexInput/Output

Note: the dimension,
dim, of the array
resid
must be at least
${\mathbf{n}}$ (see
nag_complex_sparse_eigensystem_init (f12anc)).
On initial entry: need not be set unless the option
${\mathbf{Initial\; Residual}}$ has been set in a prior call to
nag_complex_sparse_eigensystem_option (f12arc) in which case
resid should contain an initial residual vector, possibly from a previous run.
On intermediate reentry: 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}\left[{\mathbf{n}}\times {\mathbf{ncv}}\right]$ – ComplexInput/Output

The $\mathit{i}$th element of the $\mathit{j}$th basis vector is stored in location ${\mathbf{v}}\left[{\mathbf{n}}\times \left(\mathit{i}1\right)+\mathit{j}1\right]$, for $\mathit{i}=1,2,\dots ,{\mathbf{n}}$ and $\mathit{j}=1,2,\dots ,{\mathbf{ncv}}$.
On initial entry: need not be set.
On intermediate reentry: 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{x}$ – Complex **Input/Output

On initial entry: need not be set, it is used as a convenient mechanism for accessing elements of
comm.
On intermediate reentry: is not normally changed.
On intermediate exit:
contains the vector
$x$ when
irevcm returns the value
$1$,
$+1$ or
$2$.
On final exit: does not contain useful data.
 5:
$\mathbf{y}$ – Complex **Input/Output

On initial entry: need not be set, it is used as a convenient mechanism for accessing elements of
comm.
On intermediate reentry: must contain the result of
$y=\mathrm{OP}x$ when
irevcm returns the value
$1$ or
$+1$. It must contain the computed shifts when
irevcm returns the value
$3$.
On intermediate exit:
does not contain useful data.
On final exit: does not contain useful data.
 6:
$\mathbf{mx}$ – Complex **Input/Output

On initial entry: need not be set, it is used as a convenient mechanism for accessing elements of
comm.
On intermediate reentry: must contain the result of
$y=Bx$ when
irevcm returns the value
$2$.
On intermediate exit:
contains the vector
$Bx$ when
irevcm returns the value
$+1$.
On final exit: does not contain any useful data.
 7:
$\mathbf{nshift}$ – Integer *Output

On intermediate exit:
if the option
${\mathbf{Supplied\; Shifts}}$ is set and
irevcm returns a value of
$3$,
nshift returns the number of complex shifts required.
 8:
$\mathbf{comm}\left[\mathit{dim}\right]$ – ComplexCommunication Array

Note: the dimension,
dim, of the array
comm
must be at least
$\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{lcomm}}\right)$ (see
nag_complex_sparse_eigensystem_init (f12anc)).
On initial entry: must remain unchanged following a call to the setup function
nag_complex_sparse_eigensystem_init (f12anc).
On exit: contains data defining the current state of the iterative process.
 9:
$\mathbf{icomm}\left[\mathit{dim}\right]$ – IntegerCommunication Array

Note: the dimension,
dim, of the array
icomm
must be at least
$\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{licomm}}\right)$ (see
nag_complex_sparse_eigensystem_init (f12anc)).
On initial entry: must remain unchanged following a call to the setup function
nag_complex_sparse_eigensystem_init (f12anc).
On exit: contains data defining the current state of the iterative process.
 10:
$\mathbf{fail}$ – NagError *Input/Output

The NAG error argument (see
Section 3.7 in How to Use the NAG Library and its Documentation).
Error details reported in $\mathbf{fail}$ are only valid on final exit. On intermediate exit, returned values of $\mathbf{fail}$ should be ignored.
6
Error Indicators and Warnings
 NE_ALLOC_FAIL

Dynamic memory allocation failed.
See
Section 2.3.1.2 in How to Use the NAG Library and its Documentation for further information.
 NE_BAD_PARAM

On entry, argument $\u2329\mathit{\text{value}}\u232a$ had an illegal value.
 NE_INITIALIZATION

Either the initialization function has not been called prior to the first call of this function or a communication array has become corrupted.
 NE_INT

The maximum number of iterations $\le 0$, the option ${\mathbf{Iteration\; Limit}}$ has been set to $\u2329\mathit{\text{value}}\u232a$.
 NE_INTERNAL_EIGVAL_FAIL

Error in internal call to compute eigenvalues and corresponding error bounds of the current upper Hessenberg matrix. Please contact
NAG.
 NE_INTERNAL_ERROR

An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact
NAG for assistance.
See
Section 2.7.6 in How to Use the NAG Library and its Documentation for further information.
 NE_MAX_ITER

The maximum number of iterations has been reached. The maximum number of
$\text{iterations}=\u2329\mathit{\text{value}}\u232a$. The number of converged eigenvalues
$=\u2329\mathit{\text{value}}\u232a$. The postprocessing function
nag_complex_sparse_eigensystem_sol (f12aqc) 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 function
nag_complex_sparse_eigensystem_option (f12arc) 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
nag_complex_sparse_eigensystem_init (f12anc)).
 NE_NO_ARNOLDI_FAC

Could not build an Arnoldi factorization. The size of the current Arnoldi factorization $=\u2329\mathit{\text{value}}\u232a$.
 NE_NO_LICENCE

Your licence key may have expired or may not have been installed correctly.
See
Section 2.7.5 in How to Use the NAG Library and its Documentation for further information.
 NE_NO_SHIFTS_APPLIED

No shifts could be applied during a cycle of the implicitly restarted Arnoldi iteration.
 NE_OPT_INCOMPAT

The options ${\mathbf{Generalized}}$ and ${\mathbf{Regular}}$ are incompatible.
 NE_ZERO_INIT_RESID

The option
${\mathbf{Initial\; Residual}}$ was selected but the starting vector held in
resid is zero.
7
Accuracy
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
${\mathbf{Tolerance}}$ used is the
machine precision given by
nag_machine_precision (X02AJC).
8
Parallelism and Performance
nag_complex_sparse_eigensystem_iter (f12apc) is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
nag_complex_sparse_eigensystem_iter (f12apc) 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 function. Please also consult the
Users' Note for your implementation for any additional implementationspecific information.
None.
10
Example
This example solves $Ax=\lambda x$ in shiftinvert mode, where $A$ is obtained from the standard central difference discretization of the convectiondiffusion operator $\frac{{\partial}^{2}u}{\partial {x}^{2}}+\frac{{\partial}^{2}u}{\partial {y}^{2}}+\rho \frac{\partial u}{\partial x}$ on the unit square, with zero Dirichlet boundary conditions. The shift used is a complex number.
10.1
Program Text
Program Text (f12apce.c)
10.2
Program Data
Program Data (f12apce.d)
10.3
Program Results
Program Results (f12apce.r)