# naginterfaces.library.sparseig.complex_​iter¶

naginterfaces.library.sparseig.complex_iter(irevcm, resid, v, x, mx, comm, io_manager=None)[source]

complex_iter is an iterative solver in a suite of functions consisting of complex_init(), complex_iter, complex_proc(), complex_option() and complex_monit(). 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.

For full information please refer to the NAG Library document for f12ap

https://www.nag.com/numeric/nl/nagdoc_28.5/flhtml/f12/f12apf.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.

residcomplex, 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 complex_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.

vcomplex, 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.

xcomplex, 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 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.

mxcomplex, 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 .

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 complex_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 complex_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 complex shifts. This value of will only arise if the option ‘Supplied Shifts’ is set in a prior call to complex_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 complex_monit() 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: : complex_iter has completed its tasks. The value of determines whether the iteration has been successfully completed, or whether errors have been detected. On successful completion complex_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, complex and nonsymmetric. The suite can also be used to find selected eigenvalues/eigenvectors of smaller scale dense, complex and nonsymmetric problems.

complex_iter 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 complex_iter.

The setup function complex_init() must be called before complex_iter, the reverse communication iterative solver. Options may be set for complex_iter by prior calls to the option setting function complex_option() and a post-processing function complex_proc() must be called following a successful final exit from complex_iter. complex_monit() may be called following certain flagged, intermediate exits from complex_iter to provide additional monitoring information about the computation.

complex_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 complex_option() (see Other Parameters for complex_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