NAG CL Interface f12jrc (feast_complex_herm_solve)
Note:this function usesoptional parametersto define choices in the problem specification. If you wish to use default settings for all of the optional parameters, then the option setting function f12jbc need not be called.
If, however, you wish to reset some or all of the settings please refer to Section 11 in f12jbc for a detailed description of the specification of the optional parameters.
f12jrc is an iterative solver used to find some of the eigenvalues and the corresponding eigenvectors of a standard or generalized eigenvalue problem defined by complex Hermitian matrices. This is part of a suite of functions that also includes f12jac,f12jbcandf12jec.
The function may be called by the names: f12jrc or nag_sparseig_feast_complex_herm_solve.
3Description
The suite of functions is designed to calculate some of the eigenvalues, , and the corresponding eigenvectors, , of a standard eigenvalue problem , or of a generalized eigenvalue problem , where the coefficient matrices and are sparse Hermitian, and is positive definite. The suite can also be used to find selected eigenvalues/eigenvectors of smaller scale, dense, Hermitian problems.
f12jrc is a reverse communication function, based on the FEAST eigensolver, described in Polizzi (2009), which finds eigenvalues using contour integration. Prior to calling f12jrc, the contour definition function f12jec is used to specify a search interval on the real line, , within which eigenvalues will be sought (note that the eigenvalues of complex Hermitian eigenproblems are themselves real). f12jec uses this interval to define nodes and weights for an elliptical contour to be used by f12jrc.
The setup function f12jac and the contour definition function f12jec must be called before f12jrc. Between the calls to f12jacandf12jec, options may be set by calls to the option setting function f12jbc.
f12jrc 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 a factorization of the matrix , where is a point on the search contour;
–optionally, compute a factorization of the matrix (this need only be done if the factorization does not allow linear systems involving to be solved);
–solve a linear system involving or , using the factorizations above;
–compute the matrix product ;
–compute the matrix product ;
–notify the completion of the computation.
The number of contour points, the number of iterations, and other options can all be set using the option setting function f12jbc (see Section 11.1 in f12jbc for details on setting options and of the default settings). The search contour itself is defined by a call to f12jec.
4References
Polizzi E (2009) Density-Matrix-Based Algorithms for Solving Eigenvalue Problems Phys. Rev. B. 79 115112
5Arguments
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 thanx and y must remain unchanged.
1: – void *Input
On entry: the handle to the internal data structure used by the NAG FEAST suite. It needs to be initialized by f12jac. It must not be changed between calls to the NAG FEAST suite.
2: – Integer *Input/Output
On initial entry: , 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.
The calling program must compute a factorization of the matrix suitable for solving a linear system, for example using f11dnc which computes an incomplete factorization of a complex sparse matrix. All arguments to the routine must remain unchanged.
Note: the factorization can be computed in single precision.
The calling program must compute the solution to the linear system , overwriting with the result . The matrix has previously been factorized (when was returned) and this factorization can be reused here.
Note: the solve can be performed in single precision.
Optionally, the calling program must compute a factorization of the matrix . This need only be done if it is not possible to use the factorization computed when was returned to solve linear systems involving .
Note: the solve can be performed in single precision.
The calling program must compute the solution to the linear system , overwriting with the result . If it is not possible to use the factorization of (computed when was returned) then the factorization of (computed when was returned) should be used here.
The calling program must compute , storing the result in .
The calling program must compute , storing the result in . If a standard eigenproblem is being solved (so that ) then the calling program should set .
On final exit: : f12jrc has completed its tasks. The value of fail determines whether the iteration has been successfully completed, or whether errors have been detected.
Constraint:
on initial entry, ; on re-entry irevcm must remain unchanged.
Note: the matrices , and referred to in this section are all of size and are stored in the arrays x, y and z, respectively.
Note: any values you return to f12jrc as part of the reverse communication procedure should not include floating-point NaN (Not a Number) or infinity values, since these are not handled by f12jrc. If your code inadvertently does return any NaNs or infinities, f12jrc is likely to produce unexpected results.
3: – Complex *Input/Output
On initial entry: need not be set.
On intermediate exit:
contains the current point on the contour.
If , then this must be used by the calling program to form a factorization of the matrix .
If , then, optionally, this can be used to form a factorization of .
4: – IntegerInput
On entry: the order of the matrix (and the order of the matrix for the generalized problem) that defines the eigenvalue problem.
Constraint:
.
5: – ComplexInput/Output
Note: the dimension, dim, of the array x
must be at least
.
The th element of the matrix is stored in .
On initial entry: need not be set.
On intermediate exit:
if , the calling program must compute , storing the result in prior to re-entry.
If , the calling program must compute , storing the result in prior to re-entry.
Note: the matrices and are stored in the first m0 columns of the arrays x and z, respectively.
6: – IntegerInput
On entry: the stride separating matrix row elements in the array x.
Constraint:
.
7: – ComplexInput/Output
Note: the dimension, dim, of the array y
must be at least
.
The th element of the matrix is stored in .
On initial entry: need not be set.
On intermediate exit:
if , the calling program must compute the solution to the linear system , overwriting with the result , prior to re-entry. The linear system has m0 right-hand sides.
If , the calling program must compute the solution to the linear system , overwriting with the result , prior to re-entry. The linear system has m0 right-hand sides.
8: – IntegerInput
On entry: the stride separating matrix row elements in the array y.
Constraint:
.
9: – Integer *Input/Output
On initial entry: the size of the search subspace used to find the eigenvalues. This should exceed the number of eigenvalues within the search contour. See Section 9 for further details.
On intermediate re-entry: m0 must remain unchanged.
On exit: if the initial search subspace was found by f12jrc to be too large, then a new smaller suitable choice is returned.
Constraint:
.
10: – Integer *Output
On exit: the number of eigenvalues found within the search contour.
Note: if the optional parameter was set in the option setting function f12jbc, then nconv contains a stochastic estimate of the number of eigenvalues within the search contour.
11: – doubleInput/Output
Note: the dimension, dim, of the array d
must be at least
.
On initial entry: if the option was set using the option setting function f12jbc, then d should contain an initial guess at the eigenvalues lying within the eigenvector search subspace (this subspace should be specified by z), otherwise d need not be set.
On final exit: the first nconv entries in d contain the eigenvalues.
Note: if the option was set using the option setting function f12jbc, then on final exit d contains an estimate of the eigenvalues after a single contour integral.
12: – ComplexInput/Output
Note: the dimension, dim, of the array z
must be at least
.
The th element of the matrix is stored in .
On initial entry: if the option was set using the option setting function f12jbc, then z should contain an initial guess at the eigenvector search subspace, otherwise z need not be set.
On intermediate exit:
must not be changed.
On final exit: the first nconv columns of z contain the eigenvectors corresponding to the eigenvalues found within the contour.
Note: if the option was set using the option setting function f12jbc, then on final exit columns of z contain the current search subspace after one contour integral.
13: – IntegerInput
On entry: the stride separating matrix row elements in the array z.
Constraint:
.
14: – double *Input/Output
On initial entry: need not be set.
On exit: the relative error on the trace. At iteration , eps is given by the expression , where is the sum of the eigenvalues found at the th iteration, and and are the lower and upper bounds respectively of the eigenvalue search interval.
15: – Integer *Input/Output
On initial entry: need not be set.
On exit: the number of subspace iterations performed.
16: – doubleInput/Output
Note: the dimension, dim, of the array resid
must be at least
.
On initial entry: need not be set.
On final exit: for , contains the relative residual, in the -norm, of the th eigenpair found, that is , where and are the lower and upper bounds respectively of the eigenvalue search interval.
17: – NagError *Input/Output
The NAG error argument (see Section 7 in the Introduction to the NAG Library CL Interface).
6Error Indicators and Warnings
NE_ALLOC_FAIL
Dynamic memory allocation failed.
See Section 3.1.2 in the Introduction to the NAG Library CL Interface for further information.
NE_BAD_PARAM
On entry, argument had an illegal value.
NE_EIGENVALUES
No eigenvalues were found within the search contour.
NE_HANDLE
Either the contour setting function f12jec has not been called prior to the first call of this function or the supplied handle has become corrupted.
NE_INT
On entry, . Constraint: .
On initial entry, . Constraint: .
On intermediate entry, . Constraint: , , , , or .
NE_INT_2
On entry, and . Constraint: .
On entry, and . Constraint: .
On entry, and . Constraint: .
On entry, and . Constraint: .
NE_INTERNAL_EIGVAL_FAIL
An internal error occurred in the reduced eigenvalue solver. A possible cause is that the matrix is not positive definite.
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.
See Section 7.5 in the Introduction to the NAG Library CL Interface for further information.
NE_NO_LICENCE
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library CL Interface for further information.
NE_NO_SOLUTION
The optional parameter was set using f12jbc so only a stochastic estimate of the number of eigenvalues within the contour has been returned.
The optional parameter was set using f12jbc. Columns of z contain the search subspace after one contour integral and d contains an estimate of the eigenvalues.
NE_TOO_MANY_ITER
The function did not converge after the maximum number of iterations. The results returned may still be useful, however they might be improved by increasing the maximum number of iterations using the option setting routine f12jbc, increasing the size of the eigenvector search subspace, m0, or experimenting with the choice of contour. Note that the returned eigenvalues and eigenvectors, together with the returned value of m0, can be used as the initial estimates for a new iteration of the solver.
NE_TOO_SMALL
The size of the eigenvector search subspace, m0, is too small.
NE_ZERO_VALUE
The option was set using the option setting function f12jbc but no nonzero elements were found in the supplied subspace.
7Accuracy
A gauge on the accuracy of the computation can be obtained by looking at eps, the relative error on the trace, and the residuals, stored in resid.
Note: the factorizations and linear system solves required when , , or can be performed in single precision, without any loss of accuracy in the final eigenvalues and eigenvectors.
8Parallelism and Performance
f12jrc is not threaded in any implementation.
9Further Comments
Ideally, when using f12jrc you should have an idea of the distribution of the eigenvalue spectrum to allow good choices of the search interval and m0 to be made. For best performance, m0 should exceed the number of eigenvalues in the search interval by a factor of approximately .
A stochastic estimate of the number of eigenvalues within the search contour can be obtained by setting in the option setting function f12jbc. In this case, f12jrc can be called with a small value of m0 (for example ). On final output nconv will contain an estimate of the number of eigenvalues, which can then be used to guide the choice of m0.
The complex allocatable memory required by f12jrc is approximately .
f12jjc can be used to solve real symmetric eigenvalue problems.
9.1Additional Licensor
Parts of the code for f12jrc are distributed under the BSD software License. Please refer to Library Licensors for further details.
10Example
This example solves the generalized eigenvalue problem , where
and
Only those eigenvalues lying within the interval are returned (together with the associated right eigenvectors). The matrices and are stored in symmetric coordinate storage format, with appropriate sparse matrix multiplication routines and sparse linear system solvers used.