nag_real_symm_sparse_eigensystem_iter (f12fbc) (PDF version)
f12 Chapter Contents
f12 Chapter Introduction
NAG C Library Manual

NAG Library Function Document

nag_real_symm_sparse_eigensystem_iter (f12fbc)

Note: this function uses optional arguments to define choices in the problem specification. If you wish to use default settings for all of the optional arguments, then the option setting routine nag_real_symm_sparse_eigensystem_option (f12fdc) need not be called. If, however, you wish to reset some or all of the settings please refer to Section 10 in nag_real_symm_sparse_eigensystem_option (f12fdc) for a detailed description of the specification of the optional arguments.

+ Contents

    1  Purpose
    7  Accuracy

1  Purpose

nag_real_symm_sparse_eigensystem_iter (f12fbc) is an iterative solver in a suite of functions consisting of nag_real_symm_sparse_eigensystem_init (f12fac), nag_real_symm_sparse_eigensystem_iter (f12fbc), nag_real_symm_sparse_eigensystem_sol (f12fcc), nag_real_symm_sparse_eigensystem_option (f12fdc) and nag_real_symm_sparse_eigensystem_monit (f12fec). 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.

2  Specification

#include <nag.h>
#include <nagf12.h>
void  nag_real_symm_sparse_eigensystem_iter (Integer *irevcm, double resid[], double v[], double **x, double **y, double **mx, Integer *nshift, double comm[], Integer icomm[], NagError *fail)

3  Description

The suite of functions is designed to calculate some of the eigenvalues, λ , (and optionally the corresponding eigenvectors, x ) of a standard eigenvalue problem Ax = λx , or of a generalized eigenvalue problem Ax = λ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.
nag_real_symm_sparse_eigensystem_iter (f12fbc) is a reverse communication function, 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 functions 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 nag_real_symm_sparse_eigensystem_iter (f12fbc).
The setup function nag_real_symm_sparse_eigensystem_init (f12fac) must be called before nag_real_symm_sparse_eigensystem_iter (f12fbc), the reverse communication iterative solver. Options may be set for nag_real_symm_sparse_eigensystem_iter (f12fbc) by prior calls to the option setting function nag_real_symm_sparse_eigensystem_option (f12fdc) and a post-processing function nag_real_symm_sparse_eigensystem_sol (f12fcc) must be called following a successful final exit from nag_real_symm_sparse_eigensystem_iter (f12fbc). nag_real_symm_sparse_eigensystem_monit (f12fec), may be called following certain flagged, intermediate exits from nag_real_symm_sparse_eigensystem_iter (f12fbc) to provide additional monitoring information about the computation.
nag_real_symm_sparse_eigensystem_iter (f12fbc) 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 = OPx , where 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 function nag_real_symm_sparse_eigensystem_option (f12fdc).

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 function 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 and y must remain unchanged.
1:     irevcmInteger *Input/Output
On initial entry: 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.
irevcm=-1
The calling program must compute the matrix-vector product y=OPx, where x is stored in x and the result y is placed in y.
irevcm=1
The calling program must compute the matrix-vector product y=OPx. This is similar to the case irevcm=-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.
irevcm=2
The calling program must compute the matrix-vector product y=Bx, where x is stored in x and y is placed in y.
irevcm=3
Compute the nshift real and imaginary parts of the shifts where the real parts are to be placed in the first nshift locations of the array y and the imaginary parts are to be placed 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 argument Supplied Shifts is set in a prior call to nag_real_symm_sparse_eigensystem_option (f12fdc) 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).
irevcm=4
Monitoring step: a call to nag_real_symm_sparse_eigensystem_monit (f12fec) 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: irevcm=5: nag_real_symm_sparse_eigensystem_iter (f12fbc) has completed its tasks. The value of fail determines whether the iteration has been successfully completed, or whether errors have been detected. On successful completion nag_real_symm_sparse_eigensystem_sol (f12fcc) must be called to return the requested eigenvalues and eigenvectors (and/or Schur vectors).
Constraint: on initial entry, irevcm=0; on re-entry irevcm must remain unchanged.
2:     resid[dim]doubleInput/Output
Note: the dimension, dim, of the array resid must be at least n (see nag_real_symm_sparse_eigensystem_init (f12fac)).
On initial entry: need not be set unless the option Initial Residual has been set in a prior call to nag_real_symm_sparse_eigensystem_option (f12fdc) 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:     v[dim]doubleInput/Output
Note: the dimension, dim, of the array v must be at least max1,ncv (see nag_real_symm_sparse_eigensystem_init (f12fac)).
The ith element of the jth basis vector is stored in location v[n×i-1+j-1], for i=1,2,,n and j=1,2,,ncv.
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:     xdouble **Input/Output
On initial entry: need not be set, it is used as a convenient mechanism for accessing elements of comm.
On intermediate re-entry: 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:     ydouble **Input/Output
On initial entry: need not be set, it is used as a convenient mechanism for accessing elements of comm.
On intermediate re-entry: must contain the result of y=OPx when irevcm returns the value -1 or +1. It must contain the real parts of 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:     mxdouble **Input/Output
On initial entry: need not be set, it is used as a convenient mechanism for accessing elements of comm.
On intermediate re-entry: it must contain the imaginary parts of the computed shifts when irevcm returns the value 3.
On intermediate exit: contains the vector Bx when irevcm returns the value +1.
On final exit: does not contain any useful data.
7:     nshiftInteger *Output
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:     comm[dim]doubleCommunication Array
Note: the dimension, dim, of the array comm must be at least max1,lcomm (see nag_real_symm_sparse_eigensystem_init (f12fac)).
On initial entry: must remain unchanged following a call to the setup function nag_real_symm_sparse_eigensystem_init (f12fac).
On exit: contains data defining the current state of the iterative process.
9:     icomm[dim]IntegerCommunication Array
Note: the dimension, dim, of the array icomm must be at least max1,licomm (see nag_real_symm_sparse_eigensystem_init (f12fac)).
On initial entry: must remain unchanged following a call to the setup function nag_real_symm_sparse_eigensystem_init (f12fac).
On exit: contains data defining the current state of the iterative process.
10:   failNagError *Input/Output
The NAG error argument (see Section 3.6 in the Essential Introduction).

6  Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
NE_BAD_PARAM
On entry, argument value had an illegal value.
NE_BOTH_ENDS_1
Eigenvalues from both ends of the spectrum were requested, but the number of eigenvalues (see nev in nag_real_symm_sparse_eigensystem_init (f12fac)) requested is one.
NE_INT
The maximum number of iterations 0, the option Iteration Limit has been set to value.
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.
NE_MAX_ITER
The maximum number of iterations has been reached. The maximum number of iterations =value. The number of converged eigenvalues = value. See the function document for further details.
NE_NO_LANCZOS_FAC
Could not build a Lanczos factorization. The size of the current Lanczos factorization = value.
NE_NO_SHIFTS_APPLIED
No shifts could be applied during a cycle of the implicitly restarted Lanczos iteration.
NE_OPT_INCOMPAT
The options Generalized and Regular are incompatible.
NE_ZERO_INIT_RESID
The option Initial Residual was selected but the starting vector held in resid is zero.

7  Accuracy

The relative accuracy of a Ritz value, λ , is considered acceptable if its Ritz estimate Tolerance × λ . The default Tolerance used is the machine precision given by nag_machine_precision (X02AJC).

8  Further Comments

None.

9  Example

For this function 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 = λx  in shift-invert mode, where A  is obtained from the standard central difference discretization of the one-dimensional Laplacian operator 2u x2  with zero Dirichlet boundary conditions. Eigenvalues closest to the shift σ=0 are sought.
Example 2 (ex2)
This example illustrates the use of nag_real_symm_sparse_eigensystem_iter (f12fbc) 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 (σ) and corresponding right singular values (ν) for the matrix A by solving the symmetric problem:
ATA ν=σν .
Here A is the m by n real matrix derived from the simplest finite difference discretization of the two-dimensional kernal ks,tdt where
ks,t = st-1 if ​0st1 ts-1 if ​0t<s1 .
Note: this formulation is appropriate for the case mn. Reverse the rules of A and AT in the case of m<n.

9.1  Program Text

Program Text (f12fbce.c)

9.2  Program Data

Program Data (f12fbce.d)

9.3  Program Results

Program Results (f12fbce.r)


nag_real_symm_sparse_eigensystem_iter (f12fbc) (PDF version)
f12 Chapter Contents
f12 Chapter Introduction
NAG C Library Manual

© The Numerical Algorithms Group Ltd, Oxford, UK. 2012