naginterfaces.library.eigen.real_​gen_​sparse_​arnoldi

naginterfaces.library.eigen.real_gen_sparse_arnoldi(a, icolzp, irowix, nev, ncv, sigma, monit=None, option=None, data=None, io_manager=None)[source]

real_gen_sparse_arnoldi computes selected eigenvalues and eigenvectors of a real sparse general matrix.

Note: this function uses optional algorithmic parameters, see also: sparseig.real_init, sparseig.real_iter, sparseig.real_proc, sparseig.real_option, sparseig.real_monit.

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

https://support.nag.com/numeric/nl/nagdoc_30.3/flhtml/f02/f02ekf.html

Parameters
afloat, array-like, shape

The array of nonzero elements (and diagonal elements if a nonzero inverse shift is to be applied) of the general matrix .

icolzpint, array-like, shape

contains the index in of the start of column , for ; must contain the value . Thus the number of nonzero elements in column of is ; when shifts are applied this includes diagonal elements irrespective of value. See the F11 Introduction.

irowixint, array-like, shape

contains the row index for each entry in . See the F11 Introduction.

nevint

The number of eigenvalues to be computed.

ncvint

The number of Arnoldi basis vectors to use during the computation.

At present there is no a priori analysis to guide the selection of relative to .

However, it is recommended that .

If many problems of the same type are to be solved, you should experiment with increasing while keeping fixed for a given test problem.

This will usually decrease the required number of matrix-vector operations but it also increases the work and storage required to maintain the orthogonal basis vectors.

The optimal ‘cross-over’ with respect to CPU time is problem dependent and must be determined empirically.

sigmafloat

If the ‘Shifted Inverse Real’ mode has been selected then contains the real shift used; otherwise is not referenced. This mode can be selected by setting the appropriate options in the user-supplied function .

monitNone or callable monit(niter, nconv, w, rzest, data=None), optional

Note: if this argument is None then a NAG-supplied facility will be used.

is used to monitor the progress of real_gen_sparse_arnoldi. may be None if no monitoring is actually required. is called after the solution of each eigenvalue sub-problem and also just prior to return from real_gen_sparse_arnoldi.

Parameters
niterint

The number of the current Arnoldi iteration.

nconvint

The number of converged eigenvalues so far.

wcomplex, ndarray, shape

The first elements of contain the converged approximate eigenvalues.

rzestfloat, ndarray, shape

The first elements of contain the Ritz estimates (error bounds) on the converged approximate eigenvalues.

dataarbitrary, optional, modifiable in place

User-communication data for callback functions.

optionNone or callable option(comm, data=None), optional

Note: if this argument is None then a NAG-supplied facility will be used.

You can supply non-default options to the Arnoldi eigensolver by repeated calls to sparseig.real_option from within . (Please note that it is only necessary to call sparseig.real_option; no call to sparseig.real_init is required from within .) For example, you can set the mode to ‘Shifted Inverse Real’, you can increase the ‘Iteration Limit’ beyond its default and you can print varying levels of detail on the iterative process using ‘Print Level’.

If only the default options (including that the eigenvalues of largest magnitude are sought) are to be used then may be None.

Parameters
commdict, communication object, modifiable in place

Communication structure.

This argument has been initialized to hold the default option set.

If you wish to supply non-default options to the Arnoldi eigensolver, this argument may be passed as argument in a call to sparseig.real_option.

dataarbitrary, optional, modifiable in place

User-communication data for callback functions.

dataarbitrary, optional

User-communication data for callback functions.

io_managerFileObjManager, optional

Manager for I/O in this routine.

Returns
afloat, ndarray, shape

If a nonzero shifted inverse is to be applied then the diagonal elements of have the shift value, as supplied in , subtracted.

nconvint

The number of converged approximations to the selected eigenvalues. On successful exit, this will normally be either or depending on the number of complex conjugate pairs of eigenvalues returned.

wcomplex, ndarray, shape

The first elements contain the converged approximations to the selected eigenvalues. Since complex conjugate pairs of eigenvalues appear together, it is possible (given an odd number of converged real eigenvalues) for real_gen_sparse_arnoldi to return one more eigenvalue than requested.

vfloat, ndarray, shape

Contains the eigenvectors associated with the eigenvalue , for (stored in ). For a real eigenvalue, , the corresponding eigenvector is real and is stored in , for . For complex conjugate pairs of eigenvalues, , the real and imaginary parts of the corresponding eigenvectors are stored, respectively, in and , for . The imaginary parts stored are for the first of the conjugate pair of eigenvectors; the other eigenvector in the pair is obtained by negating these imaginary parts.

residfloat, ndarray, shape

The residual for the estimates to the eigenpair and is returned in , for .

Other Parameters
‘Advisory’int

Default

If the option ‘List’ is set then option specifications are listed in a ‘List’ file by setting the option to a file identification (unit) number associated with advisory messages (see FileObjManager and the FileObjManager method unit_from_fileobj()).

‘Defaults’valueless

This special keyword may be used to reset all options to their default values.

‘Iteration Limit’int

Default

The limit on the number of Arnoldi iterations that can be performed before real_gen_sparse_arnoldi exits with = 24.

‘Largest Magnitude’valueless

Default

The Arnoldi iterative method converges on a number of eigenvalues with given properties. The default is to compute the eigenvalues of largest magnitude using ‘Largest Magnitude’. Alternatively, eigenvalues may be chosen which have ‘Largest Real’ part, ‘Largest Imaginary’ part, ‘Smallest Magnitude’, ‘Smallest Real’ part or ‘Smallest Imaginary’ part.

Note that these options select the eigenvalue properties for eigenvalues of the linear operator determined by the computational mode and problem type.

‘Largest Imaginary’valueless

The Arnoldi iterative method converges on a number of eigenvalues with given properties. The default is to compute the eigenvalues of largest magnitude using ‘Largest Magnitude’. Alternatively, eigenvalues may be chosen which have ‘Largest Real’ part, ‘Largest Imaginary’ part, ‘Smallest Magnitude’, ‘Smallest Real’ part or ‘Smallest Imaginary’ part.

Note that these options select the eigenvalue properties for eigenvalues of the linear operator determined by the computational mode and problem type.

‘Largest Real’valueless

The Arnoldi iterative method converges on a number of eigenvalues with given properties. The default is to compute the eigenvalues of largest magnitude using ‘Largest Magnitude’. Alternatively, eigenvalues may be chosen which have ‘Largest Real’ part, ‘Largest Imaginary’ part, ‘Smallest Magnitude’, ‘Smallest Real’ part or ‘Smallest Imaginary’ part.

Note that these options select the eigenvalue properties for eigenvalues of the linear operator determined by the computational mode and problem type.

‘Smallest Imaginary’valueless

The Arnoldi iterative method converges on a number of eigenvalues with given properties. The default is to compute the eigenvalues of largest magnitude using ‘Largest Magnitude’. Alternatively, eigenvalues may be chosen which have ‘Largest Real’ part, ‘Largest Imaginary’ part, ‘Smallest Magnitude’, ‘Smallest Real’ part or ‘Smallest Imaginary’ part.

Note that these options select the eigenvalue properties for eigenvalues of the linear operator determined by the computational mode and problem type.

‘Smallest Magnitude’valueless

The Arnoldi iterative method converges on a number of eigenvalues with given properties. The default is to compute the eigenvalues of largest magnitude using ‘Largest Magnitude’. Alternatively, eigenvalues may be chosen which have ‘Largest Real’ part, ‘Largest Imaginary’ part, ‘Smallest Magnitude’, ‘Smallest Real’ part or ‘Smallest Imaginary’ part.

Note that these options select the eigenvalue properties for eigenvalues of the linear operator determined by the computational mode and problem type.

‘Smallest Real’valueless

The Arnoldi iterative method converges on a number of eigenvalues with given properties. The default is to compute the eigenvalues of largest magnitude using ‘Largest Magnitude’. Alternatively, eigenvalues may be chosen which have ‘Largest Real’ part, ‘Largest Imaginary’ part, ‘Smallest Magnitude’, ‘Smallest Real’ part or ‘Smallest Imaginary’ part.

Note that these options select the eigenvalue properties for eigenvalues of the linear operator determined by the computational mode and problem type.

‘Nolist’valueless

Default

Option ‘List’ enables printing of each option specification as it is supplied. ‘Nolist’ suppresses this printing.

‘List’valueless

Option ‘List’ enables printing of each option specification as it is supplied. ‘Nolist’ suppresses this printing.

‘Monitoring’int

Default

If , monitoring information is output to unit number (see unit_from_fileobj()) during the solution of each problem; this may be the same as the ‘Advisory’ unit number (see unit_from_fileobj()). The type of information produced is dependent on the value of ‘Print Level’, see the description of the option ‘Print Level’ for details of the information produced. Please see the FileObjManager method unit_from_fileobj() to associate a file with a given unit number (see unit_from_fileobj()).

‘Print Level’int

Default

This controls the amount of printing produced by real_gen_sparse_arnoldi as follows.

Output

No output except error messages.

The set of selected options.

Problem and timing statistics when all calls to sparseig.real_iter have been completed.

A single line of summary output at each Arnoldi iteration.

If , then at each iteration, the length and additional steps of the current Arnoldi factorization and the number of converged Ritz values; during re-orthogonalization, the norm of initial/restarted starting vector.

Problem and timing statistics on final exit from sparseig.real_iter. If , then at each iteration, the number of shifts being applied, the eigenvalues and estimates of the Hessenberg matrix , the size of the Arnoldi basis, the wanted Ritz values and associated Ritz estimates and the shifts applied; vector norms prior to and following re-orthogonalization.

If , then on final iteration, the norm of the residual; when computing the Schur form, the eigenvalues and Ritz estimates both before and after sorting; for each iteration, the norm of residual for compressed factorization and the compressed upper Hessenberg matrix ; during re-orthogonalization, the initial/restarted starting vector; during the Arnoldi iteration loop, a restart is flagged and the number of the residual requiring iterative refinement; while applying shifts, the indices of the shifts being applied.

If , then during the Arnoldi iteration loop, the Arnoldi vector number and norm of the current residual; while applying shifts, key measures of progress and the order of ; while computing eigenvalues of , the last rows of the Schur and eigenvector matrices; when computing implicit shifts, the eigenvalues and Ritz estimates of .

If , then during Arnoldi iteration loop: norms of key components and the active column of , norms of residuals during iterative refinement, the final upper Hessenberg matrix ; while applying shifts: number of shifts, shift values, block indices, updated matrix ; while computing eigenvalues of : the matrix , the computed eigenvalues and Ritz estimates.

‘Regular’valueless

Default

These options define the computational mode which in turn defines the form of operation to be performed.

Given a standard eigenvalue problem in the form then the following modes are available with the appropriate operator .

‘Regular’

‘Shifted Inverse Real’

where is real

‘Shifted Inverse Real’valueless

These options define the computational mode which in turn defines the form of operation to be performed.

Given a standard eigenvalue problem in the form then the following modes are available with the appropriate operator .

‘Regular’

‘Shifted Inverse Real’

where is real

‘Tolerance’float

Default

An approximate eigenvalue has deemed to have converged when the corresponding Ritz estimate is within ‘Tolerance’ relative to the magnitude of the eigenvalue.

Raises
NagValueError
(errno )

On entry, .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, and .

Constraint: .

(errno )

On entry, in shifted inverse mode, the th diagonal element of is not defined, for .

(errno )

On entry, .

Constraint: .

(errno )

On entry, for , and .

Constraint: .

(errno )

On entry, and .

Constraint: .

(errno )

On entry, in specification of column , and for , and .

Constraint: .

(errno )

On entry, .

Constraint: .

(errno )

On entry, and .

Constraint: .

(errno )

On entry, and .

Constraint: .

(errno )

On entry, the matrix is numerically singular and could not be inverted. Try perturbing the value of .

(errno )

On entry, the matrix is nearly numerically singular and could not be inverted. Try perturbing the value of . Norm of matrix , Reciprocal condition number .

(errno )

The maximum number of iterations , the option ‘Iteration Limit’ has been set to .

(errno )

An unexpected internal error occurred when solving an eigenproblem.

This error should not occur. Please contact NAG.

(errno )

An unexpected internal error occurred when solving an eigenproblem.

This error should not occur. Please contact NAG.

(errno )

The maximum number of iterations has been reached.

The maximum number of iterations .

The number of converged eigenvalues .

See the function document for further details.

(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 )

An unexpected internal error occurred when postprocessing an eigenproblem.

This error should not occur. Please contact NAG.

(errno )

The number of eigenvalues found to sufficient accuracy is zero.

(errno )

Internal inconsistency in the number of converged Ritz values. Number counted , number expected .

(errno )

During calculation of a real Schur form, there was a failure to compute eigenvalues in a total of iterations.

(errno )

The computed Schur form could not be reordered by an internal call.

This routine returned with .

Please contact NAG.

(errno )

In calculating eigenvectors, an internal call returned with an error.

Please contact NAG.

Warns
NagCallbackTerminateWarning
(errno )

User requested termination in , .

(errno )

User requested termination in , .

Notes

real_gen_sparse_arnoldi computes selected eigenvalues and the corresponding right eigenvectors of a real sparse general matrix :

A specified number, , of eigenvalues , or the shifted inverses , may be selected either by largest or smallest modulus, largest or smallest real part, or, largest or smallest imaginary part. Convergence is generally faster when selecting larger eigenvalues, smaller eigenvalues can always be selected by choosing a zero inverse shift (). When eigenvalues closest to a given real value are required then the shifted inverses of largest magnitude should be selected with shift equal to the required real value.

Note that even though is real, and may be complex. If is an eigenvector corresponding to a complex eigenvalue , then the complex conjugate vector is the eigenvector corresponding to the complex conjugate eigenvalue . The eigenvalues in a complex conjugate pair and are either both selected or both not selected.

The sparse matrix is stored in compressed column storage (CCS) format. See the F11 Introduction.

real_gen_sparse_arnoldi uses an implicitly restarted Arnoldi iterative method to converge approximations to a set of required eigenvalues and corresponding eigenvectors. Further algorithmic information is given in Further Comments while a fuller discussion is provided in the F12 Introduction. If shifts are to be performed then operations using shifted inverse matrices are performed using a direct sparse solver; further information on the solver used is provided in the F11 Introduction.

References

Golub, G H and Van Loan, C F, 1996, Matrix Computations, (3rd Edition), Johns Hopkins University Press, Baltimore

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