Interface for the Implicitly Restarted Arnoldi Iteration, to compute a few eigenpairs of a complex linear operator OP with respect to a semi- inner product defined by a hermitian positive semi-definite real matrix B.
[IDO, RESID, V, IPARAM, IPNTR, WORKD, WORKL, RWORK, INFO] = znaupd(ID0, BMAT, N, WHICH, NEV, TOL, RESID, NCV, V, IPARAM, IPNTR, WORKD, WORKL, RWORK, INFO)
:IDO Integer. (INPUT/OUTPUT) Reverse communication flag. IDO must be zero on the first call to znaupd. IDO will be set internally to indicate the type of operation to be performed. Control is then given back to the calling routine which has the responsibility to carry out the requested operation and call znaupd with the result. The operand is given in WORKD(IPNTR(1)), the result must be put in WORKD(IPNTR(2)).
- IDO = 0: first call to the reverse communication interface
- IDO = -1: compute Y = OP * X where IPNTR(1) is the pointer into WORKD for X, IPNTR(2) is the pointer into WORKD for Y. This is for the initialization phase to force the starting vector into the range of OP.
- IDO = 1: compute Y = OP * X where IPNTR(1) is the pointer into WORKD for X, IPNTR(2) is the pointer into WORKD for Y. In mode 3, the vector B * X is already available in WORKD(ipntr(3)). It does not need to be recomputed in forming OP * X.
- IDO = 2: compute Y = M * X where IPNTR(1) is the pointer into WORKD for X, IPNTR(2) is the pointer into WORKD for Y.
- IDO = 3: compute and return the shifts in the first NP locations of WORKL.
- IDO = 99: done
: :BMAT Character. (INPUT) specifies the type of the matrix B that defines the semi-inner product for the operator OP.
- ‘I’: standard eigenvalue problem A * x = lambda * x
- ‘G’: generalized eigenvalue problem A * x = lambda * M * x
: :N Integer. (INPUT) Dimension of the eigenproblem. : :WHICH string of length 2. (INPUT)
- ‘LM’: want the NEV eigenvalues of largest magnitude.
- ‘SM’: want the NEV eigenvalues of smallest magnitude.
- ‘LR’: want the NEV eigenvalues of largest real part.
- ‘SR’: want the NEV eigenvalues of smallest real part.
- ‘LI’: want the NEV eigenvalues of largest imaginary part.
- ‘SI’: want the NEV eigenvalues of smallest imaginary part.
: :IPARAM Integer array of length 11. (INPUT/OUTPUT)
IPARAM(1) = ISHIFT: method for selecting the implicit shifts. The shifts selected at each iteration are used to filter out the components of the unwanted eigenvector.
- ISHIFT = 0: the shifts are to be provided by the user via reverse communication. The NCV eigenvalues of the Hessenberg matrix H are returned in the part of WORKL array corresponding to RITZ.
- ISHIFT = 1: exact shifts with respect to the current Hessenberg matrix H. This is equivalent to restarting the iteration from the beginning after updating the starting vector with a linear combination of Ritz vectors associated with the “wanted” eigenvalues.
- ISHIFT = 2: other choice of internal shift to be defined.
IPARAM(2) = No longer referenced
IPARAM(3) = MXITER On INPUT: maximum number of Arnoldi update iterations allowed. On OUTPUT: actual number of Arnoldi update iterations taken.
IPARAM(4) = NB: blocksize to be used in the recurrence. The code currently works only for NB = 1.
IPARAM(5) = NCONV: number of “converged” Ritz values. This represents the number of Ritz values that satisfy the convergence criterion.
IPARAM(6) = IUPD No longer referenced. Implicit restarting is ALWAYS used.
IPARAM(7) = MODE On INPUT determines what type of eigenproblem is being solved. Must be 1,2,3; See under Description of znaupd for the four modes available.
IPARAM(8) = NP When ido = 3 and the user provides shifts through reverse communication (IPARAM(1)=0), _naupd returns NP, the number of shifts the user is to provide. 0 < NP < NCV-NEV.
IPARAM(9) = NUMOP, IPARAM(10) = NUMOPB, IPARAM(11) = NUMREO, OUTPUT: NUMOP = total number of OP*x operations, NUMOPB = total number of B*x operations if BMAT=’G’, NUMREO = total number of steps of re- orthogonalization.
: :IPNTR Integer array of length 14. (OUTPUT) Pointer to mark the starting locations in the WORKD and WORKL arrays for matrices/vectors used by the Arnoldi iteration.
- IPNTR(1): pointer to the current operand vector X in WORKD.
- IPNTR(2): pointer to the current result vector Y in WORKD.
- IPNTR(3): pointer to the vector B * X in WORKD when used in the shift-and-invert mode.
- IPNTR(4): pointer to the next available location in WORKL that is untouched by the program.
- IPNTR(5): pointer to the NCV by NCV upper Hessenberg matrix H in WORKL.
- IPNTR(6): pointer to the ritz value array RITZ
- IPNTR(7): pointer to the (projected) ritz vector array Q
- IPNTR(8): pointer to the error BOUNDS array in WORKL.
- IPNTR(14): pointer to the NP shifts in WORKL. See Remark 5 below.
Note: IPNTR(9:13) is only referenced by zneupd. See Remark 2 below.
- IPNTR(9): pointer to the NCV RITZ values of the original system.
- IPNTR(10): Not Used
- IPNTR(11): pointer to the NCV corresponding error bounds.
- IPNTR(12): pointer to the NCV by NCV upper triangular Schur matrix for H.
- IPNTR(13): pointer to the NCV by NCV matrix of eigenvectors of the upper Hessenberg matrix H. Only referenced by zneupd if RVEC = 1 See Remark 2 below.
: :INFO Integer. (INPUT/OUTPUT) If INFO == 0, a randomly initial residual vector is used. If INFO ~= 0, RESID contains the initial residual vector, possibly from a previous run. Error flag on output.
- 0: Normal exit.
- 1: Maximum number of iterations taken. All possible eigenvalues of OP has been found. IPARAM(5) returns the number of wanted converged Ritz values.
- 2: No longer an informational error. Deprecated starting with release 2 of ARPACK.
- 3: No shifts could be applied during a cycle of the Implicitly restarted Arnoldi iteration. One possibility is to increase the size of NCV relative to NEV. See remark 4 below.
- -1: N must be positive.
- -2: NEV must be positive.
- -3: NCV-NEV >= 1 and less than or equal to N.
- -4: The maximum number of Arnoldi update iteration must be greater than zero.
- -5: WHICH must be one of ‘LM’, ‘SM’, ‘LR’, ‘SR’, ‘LI’, ‘SI’.
- -6: BMAT must be one of ‘I’ or ‘G’.
- -7: Length of private work array is not sufficient.
- -8: Error return from LAPACK eigenvalue calculation.
- -9: Starting vector is zero.
- -10: IPARAM(7) must be 1, 2, 3.
- -11: IPARAM(7) = 1 and BMAT = ‘G’ are incompatible.
- -12: IPARAM(1) must be equal to 0 or 1.
- -9999: Could not build an Arnoldi factorization. User input error highly likely. Please check actual array dimensions and layout. IPARAM(5) returns the size of the current Arnoldi factorization.
:
Reverse communication interface for the Implicitly Restarted Arnoldi iteration. This is intended to be used to find a few eigenpairs of a complex linear operator OP with respect to a semi-inner product defined by a hermitian positive semi-definite real matrix B. B may be the identity matrix.
NOTE: if both OP and B are real, then dsaupd or dnaupd should be used.
The computed approximate eigenvalues are called Ritz values and the corresponding approximate eigenvectors are called Ritz vectors. znaupd is usually called iteratively to solve one of the following problems:
NOTE: The action of w <- inv[A - sigma * M] * v or w <- inv[M] * v should be accomplished either by a direct method using a sparse matrix factorization and solving
[A - sigma * M] * w = v or M * w = v,
or through an iterative method for solving these systems. If an iterative method is used, the convergence test must be more stringent than the accuracy requirements for the eigenvalue approximations.
// The following sets dimensions for this problem.
nx = 10;
nev = 3;
ncv = 6;
bmat = 'I';
which = 'LM';
// Local Arrays
iparam = `zeros`_(11, 1);
ipntr = `zeros`_(14, 1);
_select = `zeros`_(ncv, 1);
d = `zeros`_(nev + 1, 1) + 0 * %i;
z = `zeros`_(nx, nev) + 0* %i;
resid = `zeros`_(nx, 1) + 0 * %i;
v = `zeros`_(nx, ncv) + 0 * %i;
workd = `zeros`_(3 * nx, 1) + 0 * %i;
workev = `zeros`_(2 * ncv, 1) + 0 * %i;
rwork = `zeros`_(ncv, 1);
workl = `zeros`_(3 * ncv * ncv + 5 *ncv, 1) + 0 * %i;
// Build the complex test matrix
A = `diag`_(10 * `ones`_(nx,1) + %i * `ones`_(nx,1));
A(1:$-1,2:$) = A(1:$-1,2:$) + `diag`_(6 * `ones`_(nx - 1,1));
A(2:$,1:$-1) = A(2:$,1:$-1) + `diag`_(-6 * `ones`_(nx - 1,1));
tol = 0;
ido = 0;
ishfts = 1;
maxitr = 300;
mode1 = 1;
iparam(1) = ishfts;
iparam(3) = maxitr;
iparam(7) = mode1;
sigma = `complex`_(0);
info_znaupd = 0;
// M A I N L O O P (Reverse communication)
while(ido <> 99)
// Repeatedly call the routine ZNAUPD and take actions indicated by parameter IDO until
// either convergence is indicated or maxitr has been exceeded.
[ido, resid, v, iparam, ipntr, workd, workl, info_znaupd] = znaupd(ido, bmat, nx, which, nev, tol, resid, ncv, v, iparam, ipntr, workd, workl, rwork, info_znaupd);
if(info_znaupd < 0)
printf('\nError with znaupd, info = %d\n', info_znaupd);
printf('Check the documentation of znaupd\n\n');
end
if(ido == -1 | ido == 1)
// Perform matrix vector multiplication
workd(ipntr(2):ipntr(2) + nx - 1) = A * workd(ipntr(1):ipntr(1) + nx - 1);
end
end
// Post-Process using ZNEUPD.
rvec = 1;
howmany = 'A';
info_zneupd = 0;
[d, z, resid, iparam, ipntr, workd, workl, rwork, info_zneupd] = `zneupd`_(rvec, howmany, _select, d, z, sigma, workev, bmat, nx, which, nev, tol, resid, ncv, v, ...
iparam, ipntr, workd, workl, rwork, info_zneupd);
if(info_zneupd < 0)
printf('\nError with zneupd, info = %d\n', info_zneupd);
printf('Check the documentation of zneupd.\n\n');
end
// Done with program znsimp.
printf('\nZNSIMP\n');
printf('======\n');
printf('\n');
printf('Size of the matrix is %d\n', nx);
printf('The number of Ritz values requested is %d\n', nev);
printf('The number of Arnoldi vectors generated (NCV) is %d\n', ncv);
printf('What portion of the spectrum: %s\n', which);
printf('The number of Implicit Arnoldi update iterations taken is %d\n', iparam(3));
printf('The number of OP*x is %d\n', iparam(9));
printf('The convergence criterion is %d\n', tol);
1. D.C. Sorensen, “Implicit Application of Polynomial Filters in a k-Step Arnoldi Method”, SIAM J. Matr. Anal. Apps., 13 (1992), pp 357-385.
2. R.B. Lehoucq, “Analysis and Implementation of an Implicitly Restarted Arnoldi Iteration”, Rice University Technical Report TR95-13, Department of Computational and Applied Mathematics.
3. B.N. Parlett and Y. Saad, “Complex Shift and Invert Strategies for Real Matrices”, Linear Algebra and its Applications, vol 88/89, pp 575-595, (1987).
Based on ARPACK routine znaupd