naginterfaces.library.sparseig.real_symm_iter¶
- naginterfaces.library.sparseig.real_symm_iter(irevcm, resid, v, x, mx, comm, io_manager=None)[source]¶
real_symm_iter
is an iterative solver in a suite of functions consisting ofreal_symm_init()
,real_symm_iter
,real_symm_proc()
,real_symm_option()
andreal_symm_monit()
. 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.For full information please refer to the NAG Library document for f12fb
https://www.nag.com/numeric/nl/nagdoc_29.2/flhtml/f12/f12fbf.html
- Parameters
- irevcmint
On initial entry: , otherwise an error condition will be raised.
On intermediate entry: must be unchanged from its previous exit value. Changing to any other value between calls will result in an error.
- residfloat, ndarray, shape , modified in place
On initial entry: need not be set unless the option ‘Initial Residual’ has been set in a prior call to
real_symm_option()
in which case should contain an initial residual vector, possibly from a previous run.On intermediate entry: must be unchanged from its previous exit. Changing 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.
- vfloat, ndarray, shape , modified in place
On initial entry: need not be set.
On intermediate 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.
- xfloat, ndarray, shape , modified in place
Note: the required length for this argument is determined as follows: if : if : ; otherwise: ; otherwise: .
On initial entry: need not be set, it is used as a convenient mechanism for accessing elements of [‘comm’].
On intermediate entry: if , need not be set.
If , must contain the result of when returns the value or .
It must return the real parts of the computed shifts when returns the value .
On intermediate exit: if , is not referenced.
If , contains the vector when returns the value or .
On final exit: does not contain useful data.
- mxfloat, ndarray, shape , modified in place
Note: the required length for this argument is determined as follows: if : if : ; otherwise: ; otherwise: .
On initial entry: need not be set, it is used as a convenient mechanism for accessing elements of [‘comm’].
On intermediate entry: if , need not be set.
If , must contain the result of when returns the value .
It must return the imaginary parts of the computed shifts when returns the value .
On intermediate exit: if , is not referenced.
If , contains the vector when returns the value .
On final exit: does not contain any useful data.
- commdict, communication object, modified in place
Communication structure.
This argument must have been initialized by a prior call to
real_symm_init()
.- io_managerFileObjManager, optional
Manager for I/O in this routine.
- Returns
- irevcmint
On intermediate exit: has the following meanings.
The calling program must compute the matrix-vector product , where is stored in (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
real_symm_option()
. The result is returned in (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 (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 and is returned in (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 real and imaginary parts of the shifts where the real parts are to be returned in the first locations of the array and the imaginary parts are to be returned in the first locations of the array . Only complex conjugate pairs of shifts may be applied and the pairs must be placed in consecutive locations. This value of will only arise if the option ‘Supplied Shifts’ is set in a prior call to
real_symm_option()
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).Monitoring step: a call to
real_symm_monit()
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: :
real_symm_iter
has completed its tasks. The value of determines whether the iteration has been successfully completed, or whether errors have been detected. On successful completionreal_symm_proc()
must be called to return the requested eigenvalues and eigenvectors (and/or Schur vectors).- nshiftint
On intermediate exit: if the option ‘Supplied Shifts’ is set and returns a value of , returns the number of complex shifts required.
- Raises
- NagValueError
- (errno )
The maximum number of iterations , the option ‘Iteration Limit’ has been set to .
- (errno )
The options ‘Generalized’ and ‘Regular’ are incompatible.
- (errno )
Eigenvalues from both ends of the spectrum were requested, but the number of eigenvalues (see in
real_symm_init()
) requested is one.- (errno )
The option ‘Initial Residual’ was selected but the starting vector held in is zero.
- (errno )
No shifts could be applied during a cycle of the implicitly restarted Lanczos iteration.
- (errno )
Could not build a Lanczos factorization. The size of the current Lanczos factorization .
- (errno )
Error in internal call to compute eigenvalues and corresponding error bounds of the current upper Hessenberg matrix. Please contact NAG.
- (errno )
Either the function was called without an initial call to the setup function or the communication arrays have become corrupted.
- Warns
- NagAlgorithmicWarning
- (errno )
The maximum number of iterations has been reached. The maximum number of . The number of converged eigenvalues . See the function document for further details.
- Notes
The suite of functions 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, real and symmetric. The suite can also be used to find selected eigenvalues/eigenvectors of smaller scale dense, real and symmetric problems.
real_symm_iter
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 ofreal_symm_iter
.The setup function
real_symm_init()
must be called beforereal_symm_iter
, the reverse communication iterative solver. Options may be set forreal_symm_iter
by prior calls to the option setting functionreal_symm_option()
and a post-processing functionreal_symm_proc()
must be called following a successful final exit fromreal_symm_iter
.real_symm_monit()
, may be called following certain flagged, intermediate exits fromreal_symm_iter
to provide additional monitoring information about the computation.real_symm_iter
uses reverse communication, i.e., it returns repeatedly to the calling program with the argument (see Parameters) 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, Buckling or Cayley) and other options can all be set using the option setting function
real_symm_option()
.
- 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, Philadelphia