naginterfaces.library.sparseig.real_iter¶
- naginterfaces.library.sparseig.real_iter(irevcm, resid, v, x, mx, comm, io_manager=None)[source]¶
real_iter
is an iterative solver in a suite of functions consisting ofreal_init()
,real_iter
,real_proc()
,real_option()
andreal_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 nonsymmetric matrices.For full information please refer to the NAG Library document for f12ab
https://support.nag.com/numeric/nl/nagdoc_30.2/flhtml/f12/f12abf.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_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 : ; 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 : ; 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_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_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. If is not symmetric semidefinite then the precomputed values in should not be used (see the explanation under ).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 as described in the case and is returned in the location described by the case . This computation is requested when solving the ‘Generalized’ problem using either ‘Shifted Inverse Imaginary’, ‘Shifted Inverse Real’; in these cases is used as an inner-product space and requires that be symmetric semidefinite. If neither nor is symmetric semidefinite then the problem should be reformulated in a ‘Standard’ form.
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_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).Monitoring step: a call to
real_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_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_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 )
No shifts could be applied during a cycle of the implicitly restarted Arnoldi iteration.
- (errno )
Could not build an Arnoldi factorization. The size of the current Arnoldi 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 initialization function has not been called prior to the first call of this function or a communication array has become corrupted.
- Warns
- NagAlgorithmicWarning
- (errno )
The option ‘Initial Residual’ was selected but the starting vector held in is zero.
- (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 nonsymmetric. The suite can also be used to find selected eigenvalues/eigenvectors of smaller scale dense, real and nonsymmetric problems.
real_iter
is a reverse communication function, based on the ARPACK routine dnaupd, 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 real nonsymmetric problems, but the interface design is quite different in order to make the option setting clearer and to simplify the interface ofreal_iter
.The setup function
real_init()
must be called beforereal_iter
, the reverse communication iterative solver. Options may be set forreal_iter
by prior calls to the option setting functionreal_option()
and a post-processing functionreal_proc()
must be called following a successful final exit fromreal_iter
.real_monit()
, may be called following certain flagged, intermediate exits fromreal_iter
to provide additional monitoring information about the computation.real_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, shifted real or shifted imaginary) and other options can all be set using the option setting function
real_option()
(see Other Parameters for real_option for details on setting options and of the default settings).
- 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