XLPack 7.0
XLPack Numerical Library (C API) Reference Manual
Loading...
Searching...
No Matches

◆ dgsevs()

void dgsevs ( char  jobz,
int  n,
const double  val[],
const int  ptr[],
const int  ind[],
int  base,
int  format,
double  sigmar,
double  sigmai,
double  dr[],
double  di[],
int  ldz,
double  z[],
const char *  which,
int  nev,
double  tol,
double  resid[],
int  ncv,
int  ldv,
double  v[],
int  maxiter,
double  workd[],
double  workl[],
int  lworkl,
double  workev[],
int  iwork[],
int *  info 
)

Eigenvalues and eigenvectors of a general sparse matrix (shift and invert mode) (driver)

Purpose
The eigenvalues and eigenvectors of a general sparse matrix are computed by Implicitly restarted Arnoldi method (IRAM). The spaese matrix is stored in CSC or CSR format.

arpack routines dnaupd and dneupd (shift and invert mode (Mode 3)) are used to find eigenvalues.

In shift and invert mode, the eigenvalues closest to σ (shift) specified by the user can be obtained.

Assume that the original eigenvalue problem is as below.
A*x = λ*x
Let's consider the other eigenvalue problem
OP*x = ν*x
where OP = (A - σ*I)^(-1) and ν is the eigenvalue of this problem. If the eigenvalue ν is found, the eigenvalue λ of the original problem can be computed by ν = 1/(λ - σ) (if σ is complex number, ν = 1/2 * (1/(λ - σ) + 1/(λ - conj(σ)))). Therefore, the eigenvalue λ closest to σ can be computed if the largest ν is obtained.
Parameters
[in]jobz= 'N': Compute eigenvalues only.
= 'V': Compute eigenvalues and eigenvectors.
[in]nNumber of rows and columns of the matrix. (n >= 0) (If n = 0, returns without computation)
[in]val[]Array val[lval] (lval >= nnz)
Values of nonzero elements of input matrix (where nnz is the number of nonzero elements).
[in]ptr[]Array ptr[lptr] (lptr >= n + 1)
Column pointers (if CSC) or row pointers (if CSR) of input matrix.
[in]ind[]Array ind[lind] (lind >= nnz)
Row indices (if CSC) or column indices (if CSR) of input matrix (where nnz is the number of nonzero elements).
[in]baseIndexing of ptr[] and ind[].
= 0: Zero-based (C style) indexing: Starting index is 0.
= 1: One-based (Fortran style) indexing: Starting index is 1.
[in]formatSparse matrix format.
= 0: CSR format.
= 1: CSC format.
[in]sigmarsigmar represents the real part of the shift σ in shift and invert mode (OP = (A - σ*I)^(-1), B = I).
[in]sigmaisigmai represents the imaginary part.
[out]dr[]Array dr[ldr] (ldr >= nev + 1)
Contains the real part of the Ritz value approximations to the eigenvalues of A*z = λ*z.
[out]di[]Array di[ldi] (ldi >= nev + 1)
Contains the imaginary part of the Ritz value approximations to the eigenvalues of A*z = λ*z associated with dr[].
[in]ldzLeading dimension of the array z. (ldz >= n if Ritz vectors are desired, ldz >= 1 otherwise)
[out]z[]Array z[ldz * lz] (lz >= nev + 1)
Contains the Ritz vectors (approximations to the eigenvectors) of the eigensystem A*z = λ*z corresponding to the Ritz value approximations.
If the Ritz values are a pair of conjugate complex numbers, the corresponding complex Ritz vectors are placed in two consecutive columns. The column corresponding to the Ritz value with a positive imaginary part contains the real part of the Ritz vector, and the next column contains the imaginary part. The Ritz vector corresponding to other Ritz value with negative imaginary part is its complex conjugate vector.
If jobz = 'N' then z[] is not referenced.
[in]whichSpecifies which eigenvalues are found. This is applied to the eigenvalue ν of the operator OP = (A - σ*I)^(-1) (however λ is returned in dr and di). Generally, the closest eigenvalue λ to σ can be obtained by specifying "LM".
= "LM": Compute the nev eigenvalues of largest magnitude.
= "SM": Compute the nev eigenvalues of smallest magnitude.
= "LR": Compute the nev eigenvalues of largest real part.
= "SR": Compute the nev eigenvalues of smallest real part.
= "LI": Compute the nev eigenvalues of largest imaginary part.
= "SI": Compute the nev eigenvalues of smallest imaginary part.
[in]nevNumber of eigenvalues to be computed. (0 < nev < n - 1)
[in]tolStopping criterion: the acceptable relative accuracy of the Ritz value. If tol <= 0, machine precision is assumed.
[out]resid[]Array resid[lresid] (lresid >= n)
The residual vector.
[in]ncvNumber of columns of the matrix V. (nev + 1 < ncv <= n)
This will indicate how many Arnoldi vectors are generated at each iteration (ncv >= 2*nev is recommended).
[in]ldvLeading dimension of the array v. (ldv >= n)
[out]v[]Array v[ldv * lv] (lv >= ncv)
Matrix V containing ncv Arnoldi basis vectors.
[in]maxiterMaximum number of Arnoldi update iterations allowed.
[out]workd[]Array workd[lworkd] (lworkd >= 3*n)
Distributed work array used for reverse communication.
[out]workl[]Array workl[lworkl]
Local work array.
[in]lworklSize of array workl[]. (lworkl >= 3*ncv^2 + 6*ncv)
[out]workev[]Array workev[lworkev] (lworkev >= 3*ncv)
Double work array.
[out]iwork[]Array iwork[liwork] (liwork >= max(ncv, 3))
Integer work array.
The following values are returned in iwork[0], ..., iwork[2].
iwork[0]: Number of Arnoldi update iterations taken.
iwork[1]: Number of Ritz values that satisfy the convergence criterion (nconv).
iwork[2]: Total number of OP*x operations (numop).
[out]infoReturn code.
= 0: Successful exit.
< 0: The (-info)-th argument is invalid.
= 1: Maximum number of iterations taken. iparam[4] returns the number of converged Ritz values.
= 3: No shifts could be applied during a cycle of the implicitly restarted Arnoldi iteration. A possible remedy is to increase ncv relative to nev (ncv >= 2*nev is recommended).
= 11: Initial residual vector is zero.
= 12: Failed to build an Arnoldi factorization.
= 13: Error return from LAPACK eigenvalue calculation.
= 14: dnaupd did not find any eigenvalues to sufficient accuracy.
= 16 to 19: Internal code error.