complex16HEeigen(3)
complex16HEeigen โ the HE eigenvalue driver glow-up โจ
okay bestie, welcome to complex16HEeigen(3) ๐ this is the LAPACK page for the whole little family of complex16 eigenvalue driver functions for HE matrices. yes it's long. yes it's giving very "final boss of linear algebra". but we're gonna get through it together, one subroutine at a time. grab a snack ๐
๐ธ NAME ๐ธ
complex16HEeigen โ literally the group of complex16 eigenvalue driver functions for HE matrices, and we're about to meet every single one ๐
๐ SYNOPSIS ๐
Functions
subroutine zheev (JOBZ, UPLO, N, A, LDA, W, WORK, LWORK, RWORK, INFO)โ ZHEEV computes the eigenvalues and, optionally, the left and/or right eigenvectors for HE matricessubroutine zheev_2stage (JOBZ, UPLO, N, A, LDA, W, WORK, LWORK, RWORK, INFO)โ ZHEEV_2STAGE computes the eigenvalues and, optionally, the left and/or right eigenvectors for HE matricessubroutine zheevd (JOBZ, UPLO, N, A, LDA, W, WORK, LWORK, RWORK, LRWORK, IWORK, LIWORK, INFO)โ ZHEEVD computes the eigenvalues and, optionally, the left and/or right eigenvectors for HE matricessubroutine zheevd_2stage (JOBZ, UPLO, N, A, LDA, W, WORK, LWORK, RWORK, LRWORK, IWORK, LIWORK, INFO)โ ZHEEVD_2STAGE computes the eigenvalues and, optionally, the left and/or right eigenvectors for HE matricessubroutine zheevr (JOBZ, RANGE, UPLO, N, A, LDA, VL, VU, IL, IU, ABSTOL, M, W, Z, LDZ, ISUPPZ, WORK, LWORK, RWORK, LRWORK, IWORK, LIWORK, INFO)โ ZHEEVR computes the eigenvalues and, optionally, the left and/or right eigenvectors for HE matricessubroutine zheevr_2stage (JOBZ, RANGE, UPLO, N, A, LDA, VL, VU, IL, IU, ABSTOL, M, W, Z, LDZ, ISUPPZ, WORK, LWORK, RWORK, LRWORK, IWORK, LIWORK, INFO)โ ZHEEVR_2STAGE computes the eigenvalues and, optionally, the left and/or right eigenvectors for HE matricessubroutine zheevx (JOBZ, RANGE, UPLO, N, A, LDA, VL, VU, IL, IU, ABSTOL, M, W, Z, LDZ, WORK, LWORK, RWORK, IWORK, IFAIL, INFO)โ ZHEEVX computes the eigenvalues and, optionally, the left and/or right eigenvectors for HE matricessubroutine zheevx_2stage (JOBZ, RANGE, UPLO, N, A, LDA, VL, VU, IL, IU, ABSTOL, M, W, Z, LDZ, WORK, LWORK, RWORK, IWORK, IFAIL, INFO)โ ZHEEVX_2STAGE computes the eigenvalues and, optionally, the left and/or right eigenvectors for HE matricessubroutine zhegv (ITYPE, JOBZ, UPLO, N, A, LDA, B, LDB, W, WORK, LWORK, RWORK, INFO)โ ZHEGVsubroutine zhegv_2stage (ITYPE, JOBZ, UPLO, N, A, LDA, B, LDB, W, WORK, LWORK, RWORK, INFO)โ ZHEGV_2STAGEsubroutine zhegvd (ITYPE, JOBZ, UPLO, N, A, LDA, B, LDB, W, WORK, LWORK, RWORK, LRWORK, IWORK, LIWORK, INFO)โ ZHEGVDsubroutine zhegvx (ITYPE, JOBZ, RANGE, UPLO, N, A, LDA, B, LDB, VL, VU, IL, IU, ABSTOL, M, W, Z, LDZ, WORK, LWORK, RWORK, IWORK, IFAIL, INFO)โ ZHEGVX
๐ฆ Detailed Description ๐ฆ
So likeโฆ this is the group of complex16 eigenvalue driver functions for HE matrices. that's the whole vibe. they all hang out here together. periodt.
๐ Function Documentation ๐
subroutine zheev
subroutine zheev (character JOBZ, character UPLO, integer N, complex*16,
dimension( lda, * ) A, integer LDA, double precision, dimension( * ) W,
complex*16, dimension( * ) WORK, integer LWORK, double precision,
dimension( * ) RWORK, integer INFO)
ZHEEV computes the eigenvalues and, optionally, the left and/or right eigenvectors for HE matrices ๐ซถ
โจ Purpose:
ZHEEV computes all eigenvalues and, optionally, eigenvectors of a complex Hermitian matrix A. like, all of them. no crumbs left behind ๐
โจ Parameters
JOBZโJOBZisCHARACTER*1= 'N':Compute eigenvalues only;= 'V':Compute eigenvalues and eigenvectors.
UPLOโUPLOisCHARACTER*1= 'U':Upper triangle ofAis stored;= 'L':Lower triangle ofAis stored.
NโNisINTEGER. The order of the matrixA.N >= 0.AโAisCOMPLEX*16array, dimension(LDA, N).- On entry, the Hermitian matrix
A. IfUPLO = 'U', the leading N-by-N upper triangular part ofAcontains the upper triangular part of the matrixA. IfUPLO = 'L', the leading N-by-N lower triangular part ofAcontains the lower triangular part of the matrixA. - On exit, if
JOBZ = 'V', then ifINFO = 0,Acontains the orthonormal eigenvectors of the matrixA. - If
JOBZ = 'N', then on exit the lower triangle (ifUPLO='L') or the upper triangle (ifUPLO='U') ofA, including the diagonal, is destroyed. ๐ญ yeah she's gone bestie, no takebacks.
- On entry, the Hermitian matrix
LDAโLDAisINTEGER. The leading dimension of the arrayA.LDA >= max(1,N).WโWisDOUBLE PRECISIONarray, dimension(N). IfINFO = 0, the eigenvalues in ascending order. so organized of her โญWORKโWORKisCOMPLEX*16array, dimension(MAX(1,LWORK)). On exit, ifINFO = 0,WORK(1)returns the optimalLWORK.LWORKโLWORKisINTEGER. The length of the arrayWORK.LWORK >= max(1,2*N-1). For optimal efficiency,LWORK >= (NB+1)*N, whereNBis the blocksize forZHETRDreturned byILAENV.- If
LWORK = -1, then a workspace query is assumed; the routine only calculates the optimal size of theWORKarray, returns this value as the first entry of theWORKarray, and no error message related toLWORKis issued byXERBLA.
- If
RWORKโRWORKisDOUBLE PRECISIONarray, dimension(max(1, 3*N-2))INFOโINFOisINTEGER= 0:successful exit< 0:ifINFO = -i, the i-th argument had an illegal value> 0:ifINFO = i, the algorithm failed to converge;ioff-diagonal elements of an intermediate tridiagonal form did not converge to zero. ๐ she tried her best.
โจ Author
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
subroutine zheev_2stage
subroutine zheev_2stage (character JOBZ, character UPLO, integer N,
complex*16, dimension( lda, * ) A, integer LDA, double precision,
dimension( * ) W, complex*16, dimension( * ) WORK, integer LWORK, double
precision, dimension( * ) RWORK, integer INFO)
ZHEEV_2STAGE computes the eigenvalues and, optionally, the left and/or right eigenvectors for HE matrices ๐
โจ Purpose:
ZHEEV_2STAGE computes all eigenvalues and, optionally, eigenvectors of a complex Hermitian matrix A using the 2stage technique for the reduction to tridiagonal. two stages, twice the slay, allegedly faster ๐
โจ Parameters
JOBZโJOBZisCHARACTER*1= 'N':Compute eigenvalues only;= 'V':Compute eigenvalues and eigenvectors. Not available in this release. ๐ญ sorry bestie
UPLOโUPLOisCHARACTER*1= 'U':Upper triangle ofAis stored;= 'L':Lower triangle ofAis stored.
NโNisINTEGER. The order of the matrixA.N >= 0.AโAisCOMPLEX*16array, dimension(LDA, N).- On entry, the Hermitian matrix
A. IfUPLO = 'U', the leading N-by-N upper triangular part ofAcontains the upper triangular part of the matrixA. IfUPLO = 'L', the leading N-by-N lower triangular part ofAcontains the lower triangular part of the matrixA. - On exit, if
JOBZ = 'V', then ifINFO = 0,Acontains the orthonormal eigenvectors of the matrixA. - If
JOBZ = 'N', then on exit the lower triangle (ifUPLO='L') or the upper triangle (ifUPLO='U') ofA, including the diagonal, is destroyed.
- On entry, the Hermitian matrix
LDAโLDAisINTEGER. The leading dimension of the arrayA.LDA >= max(1,N).WโWisDOUBLE PRECISIONarray, dimension(N). IfINFO = 0, the eigenvalues in ascending order.WORKโWORKisCOMPLEX*16array, dimension(MAX(1,LWORK)). On exit, ifINFO = 0,WORK(1)returns the optimalLWORK.LWORKโLWORKisINTEGER. The length of the arrayWORK.LWORK >= 1, whenN <= 1; otherwise- If
JOBZ = 'N'andN > 1,LWORKmust be queried.
- If
LWORK = MAX(1, dimension) where
dimension = max(stage1,stage2) + (KD+1)*N + N
= N*KD + N*max(KD+1,FACTOPTNB)
+ max(2*KD*KD, KD*NTHREADS)
+ (KD+1)*N + N
where KD is the blocking size of the reduction,
FACTOPTNB is the blocking used by the QR or LQ
algorithm, usually FACTOPTNB=128 is a good choice
NTHREADS is the number of threads used when
openMP compilation is enabled, otherwise =1.
- If
JOBZ = 'V'andN > 1,LWORKmust be queried. Not yet available ๐ - If
LWORK = -1, then a workspace query is assumed; the routine only calculates the optimal size of theWORKarray, returns this value as the first entry of theWORKarray, and no error message related toLWORKis issued byXERBLA.
RWORKโRWORKisDOUBLE PRECISIONarray, dimension(max(1, 3*N-2))INFOโINFOisINTEGER= 0:successful exit< 0:ifINFO = -i, the i-th argument had an illegal value> 0:ifINFO = i, the algorithm failed to converge;ioff-diagonal elements of an intermediate tridiagonal form did not converge to zero.
โจ Author
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
โจ Further Details:
All details about the 2stage techniques are available in:
Azzam Haidar, Hatem Ltaief, and Jack Dongarra. Parallel reduction to condensed forms for symmetric eigenvalue problems using aggregated fine-grained and memory-aware kernels. In Proceedings of 2011 International Conference for High Performance Computing, Networking, Storage and Analysis (SC '11), New York, NY, USA, Article 8 , 11 pages. http://doi.acm.org/10.1145/2063384.2063394
A. Haidar, J. Kurzak, P. Luszczek, 2013. An improved parallel singular value algorithm and its implementation for multicore hardware, In Proceedings of 2013 International Conference for High Performance Computing, Networking, Storage and Analysis (SC '13). Denver, Colorado, USA, 2013. Article 90, 12 pages. http://doi.acm.org/10.1145/2503210.2503292
okay that's part 1 done bestie, and there's so much more coming โ don't go anywhere ๐ง
A. Haidar, R. Solca, S. Tomov, T. Schulthess and J. Dongarra. A novel hybrid CPU-GPU generalized eigensolver for electronic structure calculations based on fine-grained memory aware tasks. International Journal of High Performance Computing Applications. Volume 28 Issue 2, Pages 196-209, May 2014. http://hpc.sagepub.com/content/28/2/196
๐ subroutine zheevd ๐
subroutine zheevd (character JOBZ, character UPLO, integer N, complex*16,
dimension( lda, * ) A, integer LDA, double precision, dimension( * ) W,
complex*16, dimension( * ) WORK, integer LWORK, double precision,
dimension( * ) RWORK, integer LRWORK, integer, dimension( * ) IWORK,
integer LIWORK, integer INFO)
ZHEEVD computes the eigenvalues and, optionally, the left and/or right eigenvectors for HE matrices
โจ Purpose
ZHEEVD computes all eigenvalues and, if you want them, eigenvectors of a complex Hermitian matrix A. If eigenvectors are desired, it uses a divide and conquer algorithm. ๐
And bestie, the divide and conquer algorithm makes very mild assumptions about floating point arithmetic. It will work on machines with a guard digit in add/subtract, or on those binary machines without guard digits which subtract like the Cray X-MP, Cray Y-MP, Cray C-90, or Cray-2. It could conceivably fail on hexadecimal or decimal machines without guard digits, but we know of none. ๐ญ
๐ธ Parameters
JOBZโJOBZ is CHARACTER*1= 'N':Compute eigenvalues only;= 'V':Compute eigenvalues and eigenvectors.
UPLOโUPLO is CHARACTER*1= 'U':Upper triangle ofAis stored;= 'L':Lower triangle ofAis stored.
NโN is INTEGER. The order of the matrixA.N >= 0.AโA is COMPLEX*16 array, dimension (LDA, N). On entry, the Hermitian matrixA. IfUPLO = 'U', the leadingN-by-Nupper triangular part ofAcontains the upper triangular part of the matrixA. IfUPLO = 'L', the leadingN-by-Nlower triangular part ofAcontains the lower triangular part of the matrixA. On exit, ifJOBZ = 'V', then ifINFO = 0,Acontains the orthonormal eigenvectors of the matrixA. IfJOBZ = 'N', then on exit the lower triangle (ifUPLO='L') or the upper triangle (ifUPLO='U') ofA, including the diagonal, is destroyed. ๐LDAโLDA is INTEGER. The leading dimension of the arrayA.LDA >= max(1,N).WโW is DOUBLE PRECISION array, dimension (N). IfINFO = 0, the eigenvalues in ascending order.WORKโWORK is COMPLEX*16 array, dimension (MAX(1,LWORK)). On exit, ifINFO = 0,WORK(1)returns the optimalLWORK.LWORKโLWORK is INTEGER. The length of the arrayWORK.
If N <= 1, LWORK must be at least 1.
If JOBZ = 'N' and N > 1, LWORK must be at least N + 1.
If JOBZ = 'V' and N > 1, LWORK must be at least 2*N + N**2.
If LWORK = -1, then a workspace query is assumed; the routine only calculates the optimal sizes of the WORK, RWORK and IWORK arrays, returns these values as the first entries of the WORK, RWORK and IWORK arrays, and no error message related to LWORK or LRWORK or LIWORK is issued by XERBLA.
RWORKโRWORK is DOUBLE PRECISION array, dimension (LRWORK). On exit, ifINFO = 0,RWORK(1)returns the optimalLRWORK.LRWORKโLRWORK is INTEGER. The dimension of the arrayRWORK.
If N <= 1, LRWORK must be at least 1.
If JOBZ = 'N' and N > 1, LRWORK must be at least N.
If JOBZ = 'V' and N > 1, LRWORK must be at least
1 + 5*N + 2*N**2.
If LRWORK = -1, then a workspace query is assumed; the routine only calculates the optimal sizes of the WORK, RWORK and IWORK arrays, returns these values as the first entries of the WORK, RWORK and IWORK arrays, and no error message related to LWORK or LRWORK or LIWORK is issued by XERBLA.
IWORKโIWORK is INTEGER array, dimension (MAX(1,LIWORK)). On exit, ifINFO = 0,IWORK(1)returns the optimalLIWORK.LIWORKโLIWORK is INTEGER. The dimension of the arrayIWORK.
If N <= 1, LIWORK must be at least 1.
If JOBZ = 'N' and N > 1, LIWORK must be at least 1.
If JOBZ = 'V' and N > 1, LIWORK must be at least 3 + 5*N.
If LIWORK = -1, then a workspace query is assumed; the routine only calculates the optimal sizes of the WORK, RWORK and IWORK arrays, returns these values as the first entries of the WORK, RWORK and IWORK arrays, and no error message related to LWORK or LRWORK or LIWORK is issued by XERBLA.
INFOโINFO is INTEGER
= 0: successful exit
< 0: if INFO = -i, the i-th argument had an illegal value
> 0: if INFO = i and JOBZ = 'N', then the algorithm failed
to converge; i off-diagonal elements of an intermediate
tridiagonal form did not converge to zero;
if INFO = i and JOBZ = 'V', then the algorithm failed
to compute an eigenvalue while working on the submatrix
lying in rows and columns INFO/(N+1) through
mod(INFO,N+1).
๐ Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
๐ฆ Further Details
Modified description of INFO. Sven, 16 Feb 05.
๐ Contributors
Jeff Rutter, Computer Science Division, University of California at Berkeley, USA
๐ subroutine zheevd_2stage ๐
subroutine zheevd_2stage (character JOBZ, character UPLO, integer N,
complex*16, dimension( lda, * ) A, integer LDA, double precision,
dimension( * ) W, complex*16, dimension( * ) WORK, integer LWORK, double
precision, dimension( * ) RWORK, integer LRWORK, integer, dimension( * )
IWORK, integer LIWORK, integer INFO)
ZHEEVD_2STAGE computes the eigenvalues and, optionally, the left and/or right eigenvectors for HE matrices
โจ Purpose
ZHEEVD_2STAGE computes all eigenvalues and, optionally, eigenvectors of a complex Hermitian matrix A using the 2stage technique for the reduction to tridiagonal. If eigenvectors are desired, it uses a divide and conquer algorithm. ๐
The divide and conquer algorithm makes very mild assumptions about floating point arithmetic. It will work on machines with a guard digit in add/subtract, or on those binary machines without guard digits which subtract like the Cray X-MP, Cray Y-MP, Cray C-90, or Cray-2. It could conceivably fail on hexadecimal or decimal machines without guard digits, but we know of none.
๐ธ Parameters
JOBZโJOBZ is CHARACTER*1= 'N':Compute eigenvalues only;= 'V':Compute eigenvalues and eigenvectors. Not available in this release.
UPLOโUPLO is CHARACTER*1= 'U':Upper triangle ofAis stored;= 'L':Lower triangle ofAis stored.
NโN is INTEGER. The order of the matrixA.N >= 0.AโA is COMPLEX*16 array, dimension (LDA, N). On entry, the Hermitian matrixA. IfUPLO = 'U', the leadingN-by-Nupper triangular part ofAcontains the upper triangular part of the matrixA. IfUPLO = 'L', the leadingN-by-Nlower triangular part ofAcontains the lower triangular part of the matrixA. On exit, ifJOBZ = 'V', then ifINFO = 0,Acontains the orthonormal eigenvectors of the matrixA. IfJOBZ = 'N', then on exit the lower triangle (ifUPLO='L') or the upper triangle (ifUPLO='U') ofA, including the diagonal, is destroyed.LDAโLDA is INTEGER. The leading dimension of the arrayA.LDA >= max(1,N).WโW is DOUBLE PRECISION array, dimension (N). IfINFO = 0, the eigenvalues in ascending order.WORKโWORK is COMPLEX*16 array, dimension (MAX(1,LWORK)). On exit, ifINFO = 0,WORK(1)returns the optimalLWORK.LWORKโLWORK is INTEGER. The dimension of the arrayWORK.
If N <= 1, LWORK must be at least 1.
If JOBZ = 'N' and N > 1, LWORK must be queried.
LWORK = MAX(1, dimension) where
dimension = max(stage1,stage2) + (KD+1)*N + N+1
= N*KD + N*max(KD+1,FACTOPTNB)
+ max(2*KD*KD, KD*NTHREADS)
+ (KD+1)*N + N+1
where KD is the blocking size of the reduction,
FACTOPTNB is the blocking used by the QR or LQ
algorithm, usually FACTOPTNB=128 is a good choice
NTHREADS is the number of threads used when
openMP compilation is enabled, otherwise =1.
If JOBZ = 'V' and N > 1, LWORK must be at least 2*N + N**2
If LWORK = -1, then a workspace query is assumed; the routine only calculates the optimal sizes of the WORK, RWORK and IWORK arrays, returns these values as the first entries of the WORK, RWORK and IWORK arrays, and no error message related to LWORK or LRWORK or LIWORK is issued by XERBLA.
RWORKโRWORK is DOUBLE PRECISION array, dimension (LRWORK). On exit, ifINFO = 0,RWORK(1)returns the optimalLRWORK.LRWORKLRWORKโINTEGER, aka the dimension of the arrayRWORK. She's got โจrulesโจ, bestie:- If
N <= 1,LRWORKmust be at least1. - If
JOBZ = 'N'andN > 1,LRWORKmust be at leastN. - If
JOBZ = 'V'andN > 1,LRWORKmust be at least
- If
1 + 5*N + 2*N**2
And the iconic bit: if LRWORK = -1, then a workspace query is assumed. The routine only calculates the optimal sizes of the WORK, RWORK and IWORK arrays, returns these values as the first entries of the WORK, RWORK and IWORK arrays, and no error message related to LWORK or LRWORK or LIWORK is issued by XERBLA. So it's like asking "how much room do I need" and getting the answer with zero side-eye ๐
IWORKโIWORKisINTEGERarray, dimension(MAX(1,LIWORK)). On exit, ifINFO = 0,IWORK(1)returns the optimalLIWORK. It's the receipt, bestie ๐งพLIWORKโLIWORKisINTEGER, the dimension of the arrayIWORK. The rules, again, because there are always rules:- If
N <= 1,LIWORKmust be at least1. - If
JOBZ = 'N'andN > 1,LIWORKmust be at least1. - If
JOBZ = 'V'andN > 1,LIWORKmust be at least3 + 5*N.
- If
If LIWORK = -1, then a workspace query is assumed; the routine only calculates the optimal sizes of the WORK, RWORK and IWORK arrays, returns these values as the first entries of the WORK, RWORK and IWORK arrays, and no error message related to LWORK or LRWORK or LIWORK is issued by XERBLA. Same energy, different array ๐ซถ
INFOโINFOisINTEGER, and this is the vibe check at the end:= 0: successful exit. Slay โจ< 0: ifINFO = -i, the i-th argument had an illegal value.> 0: ifINFO = iandJOBZ = 'N', then the algorithm failed to converge;ioff-diagonal elements of an intermediate tridiagonal form did not converge to zero; ifINFO = iandJOBZ = 'V', then the algorithm failed to compute an eigenvalue while working on the submatrix lying in rows and columnsINFO/(N+1)throughmod(INFO,N+1).
Not me reading INFO > 0 and feeling personally attacked ๐ญ if it's nonzero, something did NOT go to plan, bestie.
Author ๐
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Further Details: ๐
Modified description of INFO. Sven, 16 Feb 05.
Contributors: ๐ซถ
Jeff Rutter, Computer Science Division, University of California at Berkeley, USA
Further Details: ๐
All details about the 2stage techniques are available in:
Azzam Haidar, Hatem Ltaief, and Jack Dongarra.
Parallel reduction to condensed forms for symmetric eigenvalue problems
using aggregated fine-grained and memory-aware kernels. In Proceedings
of 2011 International Conference for High Performance Computing,
Networking, Storage and Analysis (SC '11), New York, NY, USA,
Article 8 , 11 pages.
http://doi.acm.org/10.1145/2063384.2063394
A. Haidar, J. Kurzak, P. Luszczek, 2013.
An improved parallel singular value algorithm and its implementation
for multicore hardware, In Proceedings of 2013 International Conference
for High Performance Computing, Networking, Storage and Analysis (SC '13).
Denver, Colorado, USA, 2013.
Article 90, 12 pages.
http://doi.acm.org/10.1145/2503210.2503292
A. Haidar, R. Solca, S. Tomov, T. Schulthess and J. Dongarra.
A novel hybrid CPU-GPU generalized eigensolver for electronic structure
calculations based on fine-grained memory aware tasks.
International Journal of High Performance Computing Applications.
Volume 28 Issue 2, Pages 196-209, May 2014.
http://hpc.sagepub.com/content/28/2/196
Like, they really said "cite us or it didn't happen" and honestly? Correct ๐
subroutine zheevr ๐
subroutine zheevr (character JOBZ, character RANGE, character UPLO, integer
N, complex*16, dimension( lda, * ) A, integer LDA, double precision VL,
double precision VU, integer IL, integer IU, double precision ABSTOL,
integer M, double precision, dimension( * ) W, complex*16, dimension(
ldz, * ) Z, integer LDZ, integer, dimension( * ) ISUPPZ, complex*16,
dimension( * ) WORK, integer LWORK, double precision, dimension( * )
RWORK, integer LRWORK, integer, dimension( * ) IWORK, integer LIWORK,
integer INFO)
ZHEEVR computes the eigenvalues and, optionally, the left and/or right eigenvectors for HE matrices ๐
Purpose: โจ
ZHEEVR computes selected eigenvalues and, optionally, eigenvectors of a complex Hermitian matrix A. Eigenvalues and eigenvectors can be selected by specifying either a range of values or a range of indices for the desired eigenvalues.
ZHEEVR first reduces the matrix A to tridiagonal form T with a call to ZHETRD. Then, whenever possible, ZHEEVR calls ZSTEMR to compute eigenspectrum using Relatively Robust Representations. ZSTEMR computes eigenvalues by the dqds algorithm, while orthogonal eigenvectors are computed from various 'good' L D L^T representations (also known as Relatively Robust Representations). Gram-Schmidt orthogonalization is avoided as far as possible. More specifically, the various steps of the algorithm are as follows.
For each unreduced block (submatrix) of T,
- (a) Compute
T - sigma I = L D L^T, so thatLandDdefine all the wanted eigenvalues to high relative accuracy. This means that small relative changes in the entries ofDandLcause only small relative changes in the eigenvalues and eigenvectors. The standard (unfactored) representation of the tridiagonal matrixTdoes not have this property in general. - (b) Compute the eigenvalues to suitable accuracy. If the eigenvectors are desired, the algorithm attains full accuracy of the computed eigenvalues only right before the corresponding vectors have to be computed, see steps c) and d).
- (c) For each cluster of close eigenvalues, select a new shift close to the cluster, find a new factorization, and refine the shifted eigenvalues to suitable accuracy.
- (d) For each eigenvalue with a large enough relative separation compute the corresponding eigenvector by forming a rank revealing twisted factorization. Go back to (c) for any clusters that remain.
The desired accuracy of the output can be specified by the input parameter ABSTOL.
For more details, see ZSTEMR's documentation and:
- Inderjit S. Dhillon and Beresford N. Parlett: 'Multiple representations to compute orthogonal eigenvectors of symmetric tridiagonal matrices,' Linear Algebra and its Applications, 387(1), pp. 1-28, August 2004.
- Inderjit Dhillon and Beresford Parlett: 'Orthogonal Eigenvectors and Relative Gaps,' SIAM Journal on Matrix Analysis and Applications, Vol. 25, 2004. Also LAPACK Working Note 154.
- Inderjit Dhillon: 'A new O(n^2) algorithm for the symmetric tridiagonal eigenvalue/eigenvector problem', Computer Science Division Technical Report No. UCB/CSD-97-971, UC Berkeley, May 1997.
Note 1 :ZHEEVRcallsZSTEMRwhen the full spectrum is requested on machines which conform to the ieee-754 floating point standard.ZHEEVRcallsDSTEBZandZSTEINon non-ieee machines and when partial spectrum requests are made.
Normal execution of ZSTEMR may create NaNs and infinities and hence may abort due to a floating point exception in environments which do not handle NaNs and infinities in the ieee standard default manner. ๐ so if your machine is weird about NaN, that's a you problem (affectionate).
Parameters ๐
JOBZโJOBZisCHARACTER*1= 'N': Compute eigenvalues only;= 'V': Compute eigenvalues and eigenvectors.
RANGEโRANGEisCHARACTER*1= 'A': all eigenvalues will be found.= 'V': all eigenvalues in the half-open interval(VL,VU]will be found.= 'I': theIL-th throughIU-th eigenvalues will be found.
For RANGE = 'V' or 'I' and IU - IL < N - 1, DSTEBZ and ZSTEIN are called.
UPLOโUPLOisCHARACTER*1= 'U': Upper triangle ofAis stored;= 'L': Lower triangle ofAis stored.
NโNisINTEGER. The order of the matrixA.N >= 0.AโAisCOMPLEX*16array, dimension(LDA, N). On entry, the Hermitian matrixA. IfUPLO = 'U', the leadingN-by-Nupper triangular part ofAcontains the upper triangular part of the matrixA. IfUPLO = 'L', the leadingN-by-Nlower triangular part ofAcontains the lower triangular part of the matrixA.
On exit, the lower triangle (ifUPLO='L') or the upper triangle (ifUPLO='U') ofA, including the diagonal, is destroyed. She's gone, bestie, she served her purpose ๐
LDAโLDAisINTEGER. The leading dimension of the arrayA.LDA >= max(1,N).VLโVLisDOUBLE PRECISION. IfRANGE='V', the lower bound of the interval to be searched for eigenvalues.VL < VU. Not referenced ifRANGE = 'A'or'I'.VUโVUisDOUBLE PRECISION. IfRANGE='V', the upper bound of the interval to be searched for eigenvalues.VL < VU. Not referenced ifRANGE = 'A'or'I'.ILโILisINTEGER. IfRANGE='I', the index of the smallest eigenvalue to be returned.1 <= IL <= IU <= N, ifN > 0;IL = 1andIU = 0ifN = 0. Not referenced ifRANGE = 'A'or'V'.IUโIUisINTEGER. IfRANGE='I', the index of the largest eigenvalue to be returned.1 <= IL <= IU <= N, ifN > 0;IL = 1andIU = 0ifN = 0. Not referenced ifRANGE = 'A'or'V'.ABSTOLโABSTOLisDOUBLE PRECISION. The absolute error tolerance for the eigenvalues. An approximate eigenvalue is accepted as converged when it is determined to lie in an interval[a,b]of width less than or equal to
ABSTOL + EPS * max( |a|,|b| ) ,
where EPS is the machine precision. If ABSTOL is less than or equal to zero, then EPS*|T| will be used in its place, where |T| is the 1-norm of the tridiagonal matrix obtained by reducing A to tridiagonal form.
If high relative accuracy is important to you โ and bestie, sometimes it really is โ set ABSTOL to DLAMCH( 'Safe minimum' ). ๐
Do that and eigenvalues get computed to high relative accuracy whenever it's possible in future releases.
Okay but real talk, no cap: the current code makes no guarantees about high relative accuracy. None. Zip. Future releases will, though. ๐
If you wanna know which matrices even define their eigenvalues to high relative accuracy, go read J. Barlow and J. Demmel, 'Computing Accurate Eigensystems of Scaled Diagonally Dominant Matrices', LAPACK Working Note #7. It's giving context, it's giving lore. ๐
And for the bidiagonal-adjacent tea, see 'Computing Small Singular Values of Bidiagonal Matrices with Guaranteed High Relative Accuracy,' by Demmel and Kahan, LAPACK Working Note #3.
Mโ INTEGER, the total number of eigenvalues found.0 <= M <= N. IfRANGE = 'A', thenM = N, and ifRANGE = 'I', thenM = IU-IL+1.Wโ DOUBLE PRECISION array, dimension(N). The firstMelements hold the selected eigenvalues, sorted in ascending order. โญZโ COMPLEX*16 array, dimension(LDZ, max(1,M)). IfJOBZ = 'V', then whenINFO = 0, the firstMcolumns ofZcontain the orthonormal eigenvectors of the matrixAfor the selected eigenvalues, with the i-th column ofZholding the eigenvector associated withW(i). IfJOBZ = 'N', thenZis simply not referenced. ๐
Note: you, the user, must make sure at leastmax(1,M)columns are supplied in the arrayZ. IfRANGE = 'V', the exact value ofMis not known in advance, so an upper bound has to be used. ๐
LDZโ INTEGER, the leading dimension of the arrayZ.LDZ >= 1, and ifJOBZ = 'V',LDZ >= max(1,N).ISUPPZโ INTEGER array, dimension( 2*max(1,M) ). The support of the eigenvectors inZ, i.e. the indices indicating the nonzero elements inZ. The i-th eigenvector is nonzero only in elementsISUPPZ( 2*i-1 )throughISUPPZ( 2*i ). This is an output ofZSTEMR(tridiagonal matrix). The support of the eigenvectors ofAis typically1:Nbecause of the unitary transformations applied byZUNMTR. Implemented only forRANGE = 'A'or'I'andIU - IL = N - 1.WORKโ COMPLEX*16 array, dimension(MAX(1,LWORK)). On exit, ifINFO = 0,WORK(1)returns the optimalLWORK.LWORKโ INTEGER, the length of the arrayWORK.LWORK >= max(1,2*N). For optimal efficiency,LWORK >= (NB+1)*N, whereNBis the max of the blocksize forZHETRDand forZUNMTRas returned byILAENV. IfLWORK = -1, then a workspace query is assumed; the routine only calculates the optimal sizes of theWORK,RWORKandIWORKarrays, returns these values as the first entries of theWORK,RWORKandIWORKarrays, and no error message related toLWORKorLRWORKorLIWORKis issued byXERBLA. ๐ซถRWORKโ DOUBLE PRECISION array, dimension(MAX(1,LRWORK)). On exit, ifINFO = 0,RWORK(1)returns the optimal (and minimal)LRWORK.LRWORKโ INTEGER, the length of the arrayRWORK.LRWORK >= max(1,24*N). IfLRWORK = -1, then a workspace query is assumed; the routine only calculates the optimal sizes of theWORK,RWORKandIWORKarrays, returns these values as the first entries of theWORK,RWORKandIWORKarrays, and no error message related toLWORKorLRWORKorLIWORKis issued byXERBLA.IWORKโ INTEGER array, dimension(MAX(1,LIWORK)). On exit, ifINFO = 0,IWORK(1)returns the optimal (and minimal)LIWORK.LIWORKโ INTEGER, the dimension of the arrayIWORK.LIWORK >= max(1,10*N). IfLIWORK = -1, then a workspace query is assumed; the routine only calculates the optimal sizes of theWORK,RWORKandIWORKarrays, returns these values as the first entries of theWORK,RWORKandIWORKarrays, and no error message related toLWORKorLRWORKorLIWORKis issued byXERBLA.INFOโ INTEGER.= 0: successful exit ๐ธ< 0: ifINFO = -i, the i-th argument had an illegal value> 0: Internal error ๐
Author โจ
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Contributors ๐ซถ
Inderjit Dhillon, IBM Almaden, USA Osni Marques, LBNL/NERSC, USA Ken Stanley, Computer Science Division, University of California at Berkeley, USA Jason Riedy, Computer Science Division, University of California at Berkeley, USA
๐ฆ subroutine zheevr_2stage
subroutine zheevr_2stage (character JOBZ, character RANGE, character UPLO,
integer N, complex*16, dimension( lda, * ) A, integer LDA, double
precision VL, double precision VU, integer IL, integer IU, double
precision ABSTOL, integer M, double precision, dimension( * ) W,
complex*16, dimension( ldz, * ) Z, integer LDZ, integer, dimension( * )
ISUPPZ, complex*16, dimension( * ) WORK, integer LWORK, double
precision, dimension( * ) RWORK, integer LRWORK, integer, dimension( * )
IWORK, integer LIWORK, integer INFO)
ZHEEVR_2STAGE computes the eigenvalues and, optionally, the left and/or right eigenvectors for HE matrices ๐ฅ
Purpose ๐
ZHEEVR_2STAGE computes selected eigenvalues and, optionally, eigenvectors of a complex Hermitian matrix A using the 2stage technique for the reduction to tridiagonal. Eigenvalues and eigenvectors can be selected by specifying either a range of values or a range of indices for the desired eigenvalues. โจ
ZHEEVR_2STAGE first reduces the matrix A to tridiagonal form T with a call to ZHETRD. Then, whenever possible, ZHEEVR_2STAGE calls ZSTEMR to compute eigenspectrum using Relatively Robust Representations. ZSTEMR computes eigenvalues by the dqds algorithm, while orthogonal eigenvectors are computed from various 'good' L D L^T representations (also known as Relatively Robust Representations). Gram-Schmidt orthogonalization is avoided as far as possible. More specifically, the various steps of the algorithm are as follows. ๐
For each unreduced block (submatrix) of T,
- Compute
T - sigma I = L D L^T, so thatLandDdefine all the wanted eigenvalues to high relative accuracy. This means that small relative changes in the entries ofDandLcause only small relative changes in the eigenvalues and eigenvectors. The standard (unfactored) representation of the tridiagonal matrixTdoes not have this property in general. - Compute the eigenvalues to suitable accuracy. If the eigenvectors are desired, the algorithm attains full accuracy of the computed eigenvalues only right before the corresponding vectors have to be computed, see steps c) and d).
- For each cluster of close eigenvalues, select a new shift close to the cluster, find a new factorization, and refine the shifted eigenvalues to suitable accuracy.
- For each eigenvalue with a large enough relative separation compute the corresponding eigenvector by forming a rank revealing twisted factorization. Go back to (c) for any clusters that remain.
The desired accuracy of the output can be specified by the input parameter ABSTOL.
For more details, see ZSTEMR's documentation and:
- Inderjit S. Dhillon and Beresford N. Parlett: 'Multiple representations to compute orthogonal eigenvectors of symmetric tridiagonal matrices,' Linear Algebra and its Applications, 387(1), pp. 1-28, August 2004.
- Inderjit Dhillon and Beresford Parlett: 'Orthogonal Eigenvectors and Relative Gaps,' SIAM Journal on Matrix Analysis and Applications, Vol. 25, 2004. Also LAPACK Working Note 154.
- Inderjit Dhillon: 'A new O(n^2) algorithm for the symmetric tridiagonal eigenvalue/eigenvector problem', Computer Science Division Technical Report No. UCB/CSD-97-971, UC Berkeley, May 1997.
Note 1 :ZHEEVR_2STAGEcallsZSTEMRwhen the full spectrum is requested on machines which conform to the ieee-754 floating point standard.ZHEEVR_2STAGEcallsDSTEBZandZSTEINon non-ieee machines and when partial spectrum requests are made.
Normal execution of ZSTEMR may create NaNs and infinities and hence may abort due to a floating point exception in environments which do not handle NaNs and infinities in the ieee standard default manner. ๐ญ
Parameters ๐
JOBZโ CHARACTER*1= 'N': Compute eigenvalues only;= 'V': Compute eigenvalues and eigenvectors. Not available in this release. ๐
RANGEโ CHARACTER*1= 'A': all eigenvalues will be found.= 'V': all eigenvalues in the half-open interval(VL,VU]will be found.= 'I': the IL-th through IU-th eigenvalues will be found.- For
RANGE = 'V'or'I'andIU - IL < N - 1,DSTEBZandZSTEINare called
UPLOโ CHARACTER*1= 'U': Upper triangle ofAis stored;= 'L': Lower triangle ofAis stored.
Nโ INTEGER. The order of the matrixA.N >= 0.Aโ COMPLEX*16 array, dimension(LDA, N). On entry, the Hermitian matrixA. IfUPLO = 'U', the leading N-by-N upper triangular part ofAcontains the upper triangular part of the matrixA. IfUPLO = 'L', the leading N-by-N lower triangular part ofAcontains the lower triangular part of the matrixA. On exit, the lower triangle (ifUPLO='L') or the upper triangle (ifUPLO='U') ofA, including the diagonal, is destroyed. ๐LDALDAโLDAisINTEGER. It's the leading dimension of the arrayA, and the vibe check here is strict:LDA >= max(1,N). no exceptions bestie ๐VLโVLisDOUBLE PRECISION. IfRANGE='V', this is the lower bound of the interval we're hunting eigenvalues in. Constraint:VL < VU. Not referenced ifRANGE = 'A'or'I'โ so don't even stress about it then. ๐VUโVUisDOUBLE PRECISION. IfRANGE='V', this is the upper bound of the interval to be searched for eigenvalues. Again:VL < VU. And again: not referenced ifRANGE = 'A'or'I'. โจILโILisINTEGER. IfRANGE='I', it's the index of the smallest eigenvalue to be returned. Rules:1 <= IL <= IU <= N, ifN > 0; andIL = 1andIU = 0ifN = 0. Not referenced ifRANGE = 'A'or'V'. ๐ฆIUโIUisINTEGER. IfRANGE='I', it's the index of the largest eigenvalue to be returned. Same rules, same energy:1 <= IL <= IU <= N, ifN > 0;IL = 1andIU = 0ifN = 0. Not referenced ifRANGE = 'A'or'V'. ๐ฆABSTOLโABSTOLisDOUBLE PRECISION. It's the absolute error tolerance for the eigenvalues. An approximate eigenvalue gets accepted as converged when it's determined to lie in an interval[a,b]of width less than or equal to
ABSTOL + EPS * max( |a|,|b| ) ,
where EPS is the machine precision. If ABSTOL is less than or equal to zero, then EPS*|T| will be used in its place, where |T| is the 1-norm of the tridiagonal matrix obtained by reducing A to tridiagonal form. ๐
See 'Computing Small Singular Values of Bidiagonal Matrices with Guaranteed High Relative Accuracy,' by Demmel and Kahan, LAPACK Working Note #3. iykyk ๐
If high relative accuracy is important, set ABSTOL to DLAMCH( 'Safe minimum' ). Doing so will guarantee that eigenvalues are computed to high relative accuracy when possible in future releases. The current code does not make any guarantees about high relative accuracy, but future releases will. See J. Barlow and J. Demmel, 'Computing Accurate Eigensystems of Scaled Diagonally Dominant Matrices', LAPACK Working Note #7, for a discussion of which matrices define their eigenvalues to high relative accuracy. ๐
MโMisINTEGER. The total number of eigenvalues found, and it lives in0 <= M <= N. IfRANGE = 'A', thenM = N; and ifRANGE = 'I', thenM = IU-IL+1. math slay โจWโWisDOUBLE PRECISIONarray, dimension(N). The firstMelements contain the selected eigenvalues in ascending order. ๐ZโZisCOMPLEX*16array, dimension(LDZ, max(1,M)). IfJOBZ = 'V', then ifINFO = 0, the firstMcolumns ofZcontain the orthonormal eigenvectors of the matrixAcorresponding to the selected eigenvalues, with the i-th column ofZholding the eigenvector associated withW(i). IfJOBZ = 'N', thenZis not referenced. ๐ซ
Note: the user must ensure that at leastmax(1,M)columns are supplied in the arrayZ; ifRANGE = 'V', the exact value ofMis not known in advance and an upper bound must be used. don't get caught lacking on this one fr fr ๐ญ
LDZโLDZisINTEGER. The leading dimension of the arrayZ.LDZ >= 1, and ifJOBZ = 'V',LDZ >= max(1,N). ๐ISUPPZโISUPPZisINTEGERarray, dimension( 2*max(1,M) ). This is the support of the eigenvectors inZ, i.e., the indices indicating the nonzero elements inZ. The i-th eigenvector is nonzero only in elementsISUPPZ( 2*i-1 )throughISUPPZ( 2*i ). This is an output ofZSTEMR(tridiagonal matrix). The support of the eigenvectors ofAis typically1:Nbecause of the unitary transformations applied byZUNMTR. Implemented only forRANGE = 'A'or'I'andIU - IL = N - 1โ like, that's the whole condition, periodt. ๐WORKโWORKisCOMPLEX*16array, dimension(MAX(1,LWORK)). On exit, ifINFO = 0,WORK(1)returns the optimalLWORK. ๐ซถLWORKโLWORKisINTEGER. The dimension of the arrayWORK.
If JOBZ = 'N' and N > 1, LWORK must be queried.
LWORK = MAX(1, 26*N, dimension) where
dimension = max(stage1,stage2) + (KD+1)*N + N
= N*KD + N*max(KD+1,FACTOPTNB)
+ max(2*KD*KD, KD*NTHREADS)
+ (KD+1)*N + N
where KD is the blocking size of the reduction,
FACTOPTNB is the blocking used by the QR or LQ
algorithm, usually FACTOPTNB=128 is a good choice
NTHREADS is the number of threads used when
openMP compilation is enabled, otherwise =1.
If JOBZ = 'V' and N > 1, LWORK must be queried. Not yet available ๐ญ (the audacity tbh)
If LWORK = -1, then a workspace query is assumed; the routine only calculates the optimal sizes of the WORK, RWORK and IWORK arrays, returns these values as the first entries of the WORK, RWORK and IWORK arrays, and no error message related to LWORK or LRWORK or LIWORK is issued by XERBLA. the -1 trick is iconic, we love a low-effort recon mission ๐ต๏ธโโ๏ธ
RWORKโRWORKisDOUBLE PRECISIONarray, dimension(MAX(1,LRWORK)). On exit, ifINFO = 0,RWORK(1)returns the optimal (and minimal)LRWORK. โญLRWORKโLRWORKisINTEGER. The length of the arrayRWORK.LRWORK >= max(1,24*N). ๐
If LRWORK = -1, then a workspace query is assumed; the routine only calculates the optimal sizes of the WORK, RWORK and IWORK arrays, returns these values as the first entries of the WORK, RWORK and IWORK arrays, and no error message related to LWORK or LRWORK or LIWORK is issued by XERBLA. ๐
IWORKโIWORKisINTEGERarray, dimension(MAX(1,LIWORK)). On exit, ifINFO = 0,IWORK(1)returns the optimal (and minimal)LIWORK. โญLIWORKโLIWORKisINTEGER. The dimension of the arrayIWORK.LIWORK >= max(1,10*N). ๐
If LIWORK = -1, then a workspace query is assumed; the routine only calculates the optimal sizes of the WORK, RWORK and IWORK arrays, returns these values as the first entries of the WORK, RWORK and IWORK arrays, and no error message related to LWORK or LRWORK or LIWORK is issued by XERBLA. ๐
INFOโINFOisINTEGER. The receipts:= 0: successful exit slay โ< 0: ifINFO = -i, the i-th argument had an illegal value oops ๐> 0: Internal error not our fault bestie ๐
๐ Author
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
๐ Contributors
- Inderjit Dhillon, IBM Almaden, USA
\n - Osni Marques, LBNL/NERSC, USA
\n - Ken Stanley, Computer Science Division, University of California at Berkeley, USA
\n - Jason Riedy, Computer Science Division, University of California at Berkeley, USA
\n
absolute legends, every single one of them ๐ซถ
๐ Further Details
All details about the 2stage techniques are available in:
- Azzam Haidar, Hatem Ltaief, and Jack Dongarra. Parallel reduction to condensed forms for symmetric eigenvalue problems using aggregated fine-grained and memory-aware kernels. In Proceedings of 2011 International Conference for High Performance Computing, Networking, Storage and Analysis (SC '11), New York, NY, USA, Article 8 , 11 pages.
http://doi.acm.org/10.1145/2063384.2063394 - A. Haidar, J. Kurzak, P. Luszczek, 2013. An improved parallel singular value algorithm and its implementation for multicore hardware, In Proceedings of 2013 International Conference for High Performance Computing, Networking, Storage and Analysis (SC '13). Denver, Colorado, USA, 2013. Article 90, 12 pages.
http://doi.acm.org/10.1145/2503210.2503292 - A. Haidar, R. Solca, S. Tomov, T. Schulthess and J. Dongarra. A novel hybrid CPU-GPU generalized eigensolver for electronic structure calculations based on fine-grained memory aware tasks. International Journal of High Performance Computing Applications. Volume 28 Issue 2, Pages 196-209, May 2014.
http://hpc.sagepub.com/content/28/2/196
reading list unlocked ๐โจ
๐ฆ subroutine zheevx
subroutine zheevx (character JOBZ, character RANGE, character UPLO, integer
N, complex*16, dimension( lda, * ) A, integer LDA, double precision VL,
double precision VU, integer IL, integer IU, double precision ABSTOL,
integer M, double precision, dimension( * ) W, complex*16, dimension(
ldz, * ) Z, integer LDZ, complex*16, dimension( * ) WORK, integer LWORK,
double precision, dimension( * ) RWORK, integer, dimension( * ) IWORK,
integer, dimension( * ) IFAIL, integer INFO)
ZHEEVX computes the eigenvalues and, optionally, the left and/or right eigenvectors for HE matrices ๐ธ
Purpose: ZHEEVX computes selected eigenvalues and, optionally, eigenvectors of a complex Hermitian matrix A. Eigenvalues and eigenvectors can be selected by specifying either a range of values or a range of indices for the desired eigenvalues. pick your fighter, bestie ๐
Parameters
JOBZโJOBZisCHARACTER*1= 'N': Compute eigenvalues only;= 'V': Compute eigenvalues and eigenvectors.
RANGEโRANGEisCHARACTER*1= 'A': all eigenvalues will be found.= 'V': all eigenvalues in the half-open interval(VL,VU]will be found.= 'I': theIL-th throughIU-th eigenvalues will be found.
UPLOโUPLOisCHARACTER*1= 'U': Upper triangle ofAis stored;= 'L': Lower triangle ofAis stored.
NโNisINTEGER. The order of the matrixA.N >= 0. ๐AโAโ aCOMPLEX*16array, dimension(LDA, N). On entry, bestie, this is your Hermitian matrixA. IfUPLO = 'U', the leadingN-by-Nupper triangular part ofAholds the upper triangular part of the matrixA. IfUPLO = 'L', the leadingN-by-Nlower triangular part ofAholds the lower triangular part of the matrixA. On exit, the lower triangle (ifUPLO='L') or the upper triangle (ifUPLO='U') ofA, including the diagonal, is destroyed. Not "lightly nudged". Destroyed. ๐ซLDAโINTEGER, the leading dimension of the arrayA. Constraint:LDA >= max(1,N). That's the law. โ๏ธVLโDOUBLE PRECISION. IfRANGE='V', this is the lower bound of the interval to be searched for eigenvalues, andVL < VU. Not referenced ifRANGE = 'A'or'I'. (So don't stress about it when it's not invited to the party. ๐ )VUโDOUBLE PRECISION. IfRANGE='V', this is the upper bound of the interval to be searched for eigenvalues, andVL < VU. Not referenced ifRANGE = 'A'or'I'. The duo works as a pair, no cap. ๐ฆILโINTEGER. IfRANGE='I', this is the index of the smallest eigenvalue to be returned. Rules of the house:1 <= IL <= IU <= N, ifN > 0;IL = 1andIU = 0ifN = 0. Not referenced ifRANGE = 'A'or'V'.IUโINTEGER. IfRANGE='I', this is the index of the largest eigenvalue to be returned. Same rules, same energy:1 <= IL <= IU <= N, ifN > 0;IL = 1andIU = 0ifN = 0. Not referenced ifRANGE = 'A'or'V'.ABSTOLโDOUBLE PRECISION, the absolute error tolerance for the eigenvalues. An approximate eigenvalue gets accepted as converged when it's determined to lie in an interval[a,b]whose width is less than or equal to
ABSTOL + EPS * max( |a|,|b| ) ,
where EPS is the machine precision. If ABSTOL is less than or equal to zero, then EPS*|T| will be used in its place, where |T| is the 1-norm of the tridiagonal matrix you get by reducing A to tridiagonal form. ๐ฅ
Eigenvalues get computed most accurately whenABSTOLis set to twice the underflow threshold2*DLAMCH('S'), not zero. If this routine comes back withINFO>0, meaning some eigenvectors didn't converge, try settingABSTOLto2*DLAMCH('S'). That's the move. โจ
Also go read 'Computing Small Singular Values of Bidiagonal Matrices with Guaranteed High Relative Accuracy,' by Demmel and Kahan, LAPACK Working Note #3. Iconic literature behavior. ๐
MโINTEGER, the total number of eigenvalues found.0 <= M <= N. IfRANGE = 'A', thenM = N, and ifRANGE = 'I', thenM = IU-IL+1. Simple math, slay. ๐งฎWโ aDOUBLE PRECISIONarray, dimension(N). On a normal exit, the firstMelements contain the selected eigenvalues in ascending order. Sorted, organized, main character energy. ๐Zโ aCOMPLEX*16array, dimension(LDZ, max(1,M)). IfJOBZ = 'V', then ifINFO = 0, the firstMcolumns ofZcontain the orthonormal eigenvectors of the matrixAcorresponding to the selected eigenvalues, with the i-th column ofZholding the eigenvector associated withW(i). If an eigenvector fails to converge, then that column ofZcontains the latest approximation to the eigenvector, and the index of that eigenvector gets returned inIFAIL. IfJOBZ = 'N', thenZis not referenced.
Heads up, bestie: the user must ensure that at leastmax(1,M)columns are supplied in the arrayZ; ifRANGE = 'V', the exact value ofMis not known in advance and an upper bound must be used. No guessing games. ๐
LDZโINTEGER, the leading dimension of the arrayZ.LDZ >= 1, and ifJOBZ = 'V',LDZ >= max(1,N).WORKโ aCOMPLEX*16array, dimension(MAX(1,LWORK)). On exit, ifINFO = 0,WORK(1)returns the optimalLWORK. It's giving receipts. ๐งพLWORKโINTEGER, the length of the arrayWORK.LWORK >= 1, whenN <= 1; otherwise2*N. For optimal efficiency,LWORK >= (NB+1)*N, whereNBis the max of the blocksize forZHETRDand forZUNMTRas returned byILAENV.
If LWORK = -1, then a workspace query is assumed; the routine only calculates the optimal size of the WORK array, returns this value as the first entry of the WORK array, and no error message related to LWORK is issued by XERBLA. Sneaky but legal. ๐
RWORKโ aDOUBLE PRECISIONarray, dimension(7*N). Seven times N. That's the whole personality. ๐IWORKโ anINTEGERarray, dimension(5*N). Five times N, matching energy. ๐IFAILโ anINTEGERarray, dimension(N). IfJOBZ = 'V', then ifINFO = 0, the firstMelements ofIFAILare zero. IfINFO > 0, thenIFAILcontains the indices of the eigenvectors that failed to converge. IfJOBZ = 'N', thenIFAILis not referenced. The snitch list, respectfully. ๐INFOโINTEGER:= 0: successful exit ๐< 0: ifINFO = -i, the i-th argument had an illegal value ๐ญ> 0: ifINFO = i, then i eigenvectors failed to converge. Their indices are stored in arrayIFAIL. ๐
Author
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
The whole squad. ๐ซถ
subroutine zheevx_2stage
subroutine zheevx_2stage (character JOBZ, character RANGE, character UPLO,
integer N, complex*16, dimension( lda, * ) A, integer LDA, double
precision VL, double precision VU, integer IL, integer IU, double
precision ABSTOL, integer M, double precision, dimension( * ) W,
complex*16, dimension( ldz, * ) Z, integer LDZ, complex*16, dimension( *
) WORK, integer LWORK, double precision, dimension( * ) RWORK, integer,
dimension( * ) IWORK, integer, dimension( * ) IFAIL, integer INFO)
ZHEEVX_2STAGE computes the eigenvalues and, optionally, the left and/or right eigenvectors for HE matrices โจ
Purpose:
ZHEEVX_2STAGE computes selected eigenvalues and, optionally, eigenvectors of a complex Hermitian matrix A using the 2stage technique for the reduction to tridiagonal. Eigenvalues and eigenvectors can be selected by specifying either a range of values or a range of indices for the desired eigenvalues. Pick your fighter. ๐
Parameters
JOBZโJOBZisCHARACTER*1= 'N': Compute eigenvalues only;= 'V': Compute eigenvalues and eigenvectors. Not available in this release. ๐ญ (devastating, honestly)
RANGEโRANGEisCHARACTER*1= 'A': all eigenvalues will be found.= 'V': all eigenvalues in the half-open interval(VL,VU]will be found.= 'I': theIL-th throughIU-th eigenvalues will be found.
UPLOโUPLOisCHARACTER*1= 'U': Upper triangle ofAis stored;= 'L': Lower triangle ofAis stored.
NโNisINTEGER. The order of the matrixA.N >= 0.AโAisCOMPLEX*16array, dimension(LDA, N). On entry, the Hermitian matrixA. IfUPLO = 'U', the leadingN-by-Nupper triangular part ofAcontains the upper triangular part of the matrixA. IfUPLO = 'L', the leadingN-by-Nlower triangular part ofAcontains the lower triangular part of the matrixA. On exit, the lower triangle (ifUPLO='L') or the upper triangle (ifUPLO='U') ofA, including the diagonal, is destroyed. Same warning, same chaos. ๐ซLDAโLDAisINTEGER. The leading dimension of the arrayA.LDA >= max(1,N).VLโVLisDOUBLE PRECISION. IfRANGE='V', the lower bound of the interval to be searched for eigenvalues.VL < VU. Not referenced ifRANGE = 'A'or'I'.VUโVUisDOUBLE PRECISION. IfRANGE='V', the upper bound of the interval to be searched for eigenvalues.VL < VU. Not referenced ifRANGE = 'A'or'I'.ILโILisINTEGER. IfRANGE='I', the index of the smallest eigenvalue to be returned.1 <= IL <= IU <= N, ifN > 0;IL = 1andIU = 0ifN = 0. Not referenced ifRANGE = 'A'or'V'.IUโIUisINTEGER. IfRANGE='I', the index of the largest eigenvalue to be returned.1 <= IL <= IU <= N, ifN > 0;IL = 1andIU = 0ifN = 0. Not referenced ifRANGE = 'A'or'V'.ABSTOLโABSTOLisDOUBLE PRECISION, the absolute error tolerance for the eigenvalues. An approximate eigenvalue is accepted as converged when it is determined to lie in an interval[a,b]of width less than or equal to
ABSTOL + EPS * max( |a|,|b| ) ,
where EPS is the machine precision. If ABSTOL is less than or equal to zero, then EPS*|T| will be used in its place, where |T| is the 1-norm of the tridiagonal matrix obtained by reducing A to tridiagonal form. ๐ฅ
Eigenvalues will be computed most accurately whenABSTOLis set to twice the underflow threshold2*DLAMCH('S'), not zero. If this routine returns withINFO>0, indicating that some eigenvectors did not converge, try settingABSTOLto2*DLAMCH('S').
See 'Computing Small Singular Values of Bidiagonal Matrices with Guaranteed High Relative Accuracy,' by Demmel and Kahan, LAPACK Working Note #3. ๐
MโMisINTEGER. The total number of eigenvalues found.0 <= M <= N. IfRANGE = 'A',M = N, and ifRANGE = 'I',M = IU-IL+1.WโWisDOUBLE PRECISIONarray, dimension(N). On normal exit, the firstMelements contain the selected eigenvalues in ascending order. ๐Zโ โฆandZ's whole glow-up is coming right up, bestie. Stay tuned. ๐Zโ Z is COMPLEX*16 array, dimension (LDZ, max(1,M)) ๐
If JOBZ = 'V', then if INFO = 0, the first M columns of Z contain the orthonormal eigenvectors of the matrix A corresponding to the selected eigenvalues, with the i-th column of Z holding the eigenvector associated with W(i). iconic behaviour honestly.
If an eigenvector fails to converge, then that column of Z contains the latest approximation to the eigenvector, and the index of the eigenvector is returned in IFAIL. ๐ญ she tried her best.
If JOBZ = 'N', then Z is not referenced. literally not even looked at.
Note: the user must ensure that at leastmax(1,M)columns are supplied in the array Z; ifRANGE = 'V', the exact value of M is not known in advance and an upper bound must be used. bestie pls do not forget this one, it's giving consequences.
LDZโ LDZ is INTEGER
The leading dimension of the array Z. LDZ >= 1, and if JOBZ = 'V', LDZ >= max(1,N).
WORKโ WORK is COMPLEX*16 array, dimension(MAX(1,LWORK))
On exit, if INFO = 0, WORK(1) returns the optimal LWORK. she's telling you her ideal size, listen to her ๐
LWORKโ LWORK is INTEGER
The length of the array WORK. LWORK >= 1, when N <= 1; otherwise:
If JOBZ = 'N' and N > 1, LWORK must be queried. ๐ซถ
LWORK = MAX(1, 8*N, dimension) where
dimension = max(stage1,stage2) + (KD+1)*N + N
= N*KD + N*max(KD+1,FACTOPTNB)
+ max(2*KD*KD, KD*NTHREADS)
+ (KD+1)*N + N
where KD is the blocking size of the reduction,
FACTOPTNB is the blocking used by the QR or LQ
algorithm, usually FACTOPTNB=128 is a good choice
NTHREADS is the number of threads used when
openMP compilation is enabled, otherwise =1.
If JOBZ = 'V' and N > 1, LWORK must be queried. Not yet available ๐ (yes fr fr, that's what it says)
If LWORK = -1, then a workspace query is assumed; the routine only calculates the optimal size of the WORK array, returns this value as the first entry of the WORK array, and no error message related to LWORK is issued by XERBLA. sneaky lil query mode, no drama ๐
RWORKโ RWORK is DOUBLE PRECISION array, dimension(7*N)IWORKโ IWORK is INTEGER array, dimension(5*N)IFAILโ IFAIL is INTEGER array, dimension(N)
If JOBZ = 'V', then if INFO = 0, the first M elements of IFAIL are zero. If INFO > 0, then IFAIL contains the indices of the eigenvectors that failed to converge. the receipts of who ghosted you ๐ญ
If JOBZ = 'N', then IFAIL is not referenced.
INFOโ INFO is INTEGER= 0: successful exit โจ< 0: ifINFO = -i, the i-th argument had an illegal value ๐จ> 0: ifINFO = i, then i eigenvectors failed to converge. Their indices are stored in array IFAIL. ๐
๐ Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
๐ฌ Further Details:
All details about the 2stage techniques are available in:
Azzam Haidar, Hatem Ltaief, and Jack Dongarra. Parallel reduction to condensed forms for symmetric eigenvalue problems using aggregated fine-grained and memory-aware kernels. In Proceedings of 2011 International Conference for High Performance Computing, Networking, Storage and Analysis (SC '11), New York, NY, USA, Article 8 , 11 pages. http://doi.acm.org/10.1145/2063384.2063394
A. Haidar, J. Kurzak, P. Luszczek, 2013. An improved parallel singular value algorithm and its implementation for multicore hardware, In Proceedings of 2013 International Conference for High Performance Computing, Networking, Storage and Analysis (SC '13). Denver, Colorado, USA, 2013. Article 90, 12 pages. http://doi.acm.org/10.1145/2503210.2503292
A. Haidar, R. Solca, S. Tomov, T. Schulthess and J. Dongarra. A novel hybrid CPU-GPU generalized eigensolver for electronic structure calculations based on fine-grained memory aware tasks. International Journal of High Performance Computing Applications. Volume 28 Issue 2, Pages 196-209, May 2014. http://hpc.sagepub.com/content/28/2/196
๐ธ subroutine zhegv
subroutine zhegv (integer ITYPE, character JOBZ, character UPLO, integer N,
complex*16, dimension( lda, * ) A, integer LDA, complex*16, dimension(
ldb, * ) B, integer LDB, double precision, dimension( * ) W, complex*16,
dimension( * ) WORK, integer LWORK, double precision, dimension( * )
RWORK, integer INFO)
ZHEGV ๐
Purpose:
ZHEGV computes all the eigenvalues, and optionally, the eigenvectors of a complex generalized Hermitian-definite eigenproblem, of the form A*x=(lambda)*B*x, A*Bx=(lambda)*x, or B*A*x=(lambda)*x. Here A and B are assumed to be Hermitian and B is also positive definite. she's the classic, the blueprint, the moment ๐
Parameters
ITYPEโ ITYPE is INTEGER
Specifies the problem type to be solved:
= 1:A*x = (lambda)*B*x= 2:A*B*x = (lambda)*x= 3:B*A*x = (lambda)*x
JOBZโ JOBZ is CHARACTER*1= 'N': Compute eigenvalues only;= 'V': Compute eigenvalues and eigenvectors.
UPLOโ UPLO is CHARACTER*1= 'U': Upper triangles of A and B are stored;= 'L': Lower triangles of A and B are stored.
Nโ N is INTEGER
The order of the matrices A and B. N >= 0.
Aโ A is COMPLEX*16 array, dimension(LDA, N)
On entry, the Hermitian matrix A. If UPLO = 'U', the leading N-by-N upper triangular part of A contains the upper triangular part of the matrix A. If UPLO = 'L', the leading N-by-N lower triangular part of A contains the lower triangular part of the matrix A.
On exit, if JOBZ = 'V', then if INFO = 0, A contains the matrix Z of eigenvectors. The eigenvectors are normalized as follows: if ITYPE = 1 or 2, Z**H*B*Z = I; if ITYPE = 3, Z**H*inv(B)*Z = I.
If JOBZ = 'N', then on exit the upper triangle (if UPLO='U') or the lower triangle (if UPLO='L') of A, including the diagonal, is destroyed. ๐ she's gone, gone.
LDAโ LDA is INTEGER
The leading dimension of the array A. LDA >= max(1,N).
Bโ B is COMPLEX*16 array, dimension(LDB, N)
On entry, the Hermitian positive definite matrix B. If UPLO = 'U', the leading N-by-N upper triangular part of B contains the upper triangular part of the matrix B. If UPLO = 'L', the leading N-by-N lower triangular part of B contains the lower triangular part of the matrix B.
On exit, if INFO <= N, the part of B containing the matrix is overwritten by the triangular factor U or L from the Cholesky factorization B = U**H*U or B = L*L**H.
LDBโ LDB is INTEGER
The leading dimension of the array B. LDB >= max(1,N).
Wโ W is DOUBLE PRECISION array, dimension(N)
If INFO = 0, the eigenvalues in ascending order. sorted, organised, main character energy ๐
WORKโ WORK is COMPLEX*16 array, dimension(MAX(1,LWORK))
On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
LWORKโ LWORK is INTEGER
The length of the array WORK. LWORK >= max(1,2*N-1). For optimal efficiency, LWORK >= (NB+1)*N, where NB is the blocksize for ZHETRD returned by ILAENV.
If LWORK = -1, then a workspace query is assumed; the routine only calculates the optimal size of the WORK array, returns this value as the first entry of the WORK array, and no error message related to LWORK is issued by XERBLA.
RWORKโ RWORK is DOUBLE PRECISION array, dimension(max(1, 3*N-2))INFOโ INFO is INTEGER= 0: successful exit โจ< 0: ifINFO = -i, the i-th argument had an illegal value ๐จ> 0: ZPOTRF or ZHEEV returned an error code:<= N: ifINFO = i, ZHEEV failed to converge; i off-diagonal elements of an intermediate tridiagonal form did not converge to zero;> N: ifINFO = N + i, for1 <= i <= N, then the leading minor of order i of B is not positive definite. The factorization of B could not be completed and no eigenvalues or eigenvectors were computed. ๐ no results for you, sorry bestie.
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
๐ฆ subroutine zhegv_2stage
subroutine zhegv_2stage (integer ITYPE, character JOBZ, character UPLO,
integer N, complex*16, dimension( lda, * ) A, integer LDA, complex*16,
dimension( ldb, * ) B, integer LDB, double precision, dimension( * ) W,
complex*16, dimension( * ) WORK, integer LWORK, double precision,
dimension( * ) RWORK, integer INFO)
ZHEGV_2STAGE ๐ฅ
Purpose:
ZHEGV_2STAGE computes all the eigenvalues, and optionally, the eigenvectors of a complex generalized Hermitian-definite eigenproblem, of the form A*x=(lambda)*B*x, A*Bx=(lambda)*x, or B*A*x=(lambda)*x. Here A and B are assumed to be Hermitian and B is also positive definite. This routine use the 2stage technique for the reduction to tridiagonal which showed higher performance on recent architecture and for large sizes N>2000. she's the upgraded glow-up version, ate and left no crumbs ๐
Parameters
ITYPEโ ITYPE is INTEGER
Specifies the problem type to be solved:
= 1:A*x = (lambda)*B*x= 2:A*B*x = (lambda)*x= 3:B*A*x = (lambda)*x
JOBZโ JOBZ is CHARACTER*1= 'N': Compute eigenvalues only;= 'V': Compute eigenvalues and eigenvectors. Not available in this release. ๐ญ (we wait)
UPLOUPLOisCHARACTER*1โ bestie, this tells us which triangle ofAandBwe're actually storing.= 'U': Upper triangles of A and B are stored;= 'L': Lower triangles of A and B are stored.
NisINTEGERโ the order of the matricesAandB.N >= 0periodt.AisCOMPLEX*16array, dimension(LDA, N).- On entry, the Hermitian matrix
A. IfUPLO = 'U', the leadingN-by-Nupper triangular part ofAcontains the upper triangular part of the matrixA. IfUPLO = 'L', the leadingN-by-Nlower triangular part ofAcontains the lower triangular part of the matrixA. - On exit, if
JOBZ = 'V', then ifINFO = 0,Acontains the matrixZof eigenvectors. The eigenvectors are normalized as follows:- if
ITYPE = 1or2,Z**H*B*Z = I; - if
ITYPE = 3,Z**H*inv(B)*Z = I.
- if
- If
JOBZ = 'N', then on exit the upper triangle (ifUPLO='U') or the lower triangle (ifUPLO='L') ofA, including the diagonal, is destroyed. ๐
- On entry, the Hermitian matrix
LDAisINTEGERโ the leading dimension of the arrayA.LDA >= max(1,N).BisCOMPLEX*16array, dimension(LDB, N).- On entry, the Hermitian positive definite matrix
B. IfUPLO = 'U', the leadingN-by-Nupper triangular part ofBcontains the upper triangular part of the matrixB. IfUPLO = 'L', the leadingN-by-Nlower triangular part ofBcontains the lower triangular part of the matrixB. - On exit, if
INFO <= N, the part ofBcontaining the matrix is overwritten by the triangular factorUorLfrom the Cholesky factorizationB = U**H*UorB = L*L**H.
- On entry, the Hermitian positive definite matrix
LDBisINTEGERโ the leading dimension of the arrayB.LDB >= max(1,N).WisDOUBLE PRECISIONarray, dimension(N)โ ifINFO = 0, the eigenvalues in ascending order. so satisfying when they're sorted, right? โจWORKisCOMPLEX*16array, dimension(MAX(1,LWORK))โ on exit, ifINFO = 0,WORK(1)returns the optimalLWORK.LWORKisINTEGERโ the length of the arrayWORK.LWORK >= 1, whenN <= 1; otherwise:- If
JOBZ = 'N'andN > 1,LWORKmust be queried.
- If
LWORK = MAX(1, dimension) where
dimension = max(stage1,stage2) + (KD+1)*N + N
= N*KD + N*max(KD+1,FACTOPTNB)
+ max(2*KD*KD, KD*NTHREADS)
+ (KD+1)*N + N
where KD is the blocking size of the reduction,
FACTOPTNB is the blocking used by the QR or LQ
algorithm, usually FACTOPTNB=128 is a good choice
NTHREADS is the number of threads used when
openMP compilation is enabled, otherwise =1.
- If
JOBZ = 'V'andN > 1,LWORKmust be queried. Not yet available ๐ญ - If
LWORK = -1, then a workspace query is assumed; the routine only calculates the optimal size of theWORKarray, returns this value as the first entry of theWORKarray, and no error message related toLWORKis issued byXERBLA.
RWORKisDOUBLE PRECISIONarray, dimension(max(1, 3*N-2)).INFOisINTEGER= 0: successful exit ๐< 0: ifINFO = -i, thei-th argument had an illegal value> 0:ZPOTRForZHEEVreturned an error code:<= N: ifINFO = i,ZHEEVfailed to converge;ioff-diagonal elements of an intermediate tridiagonal form did not converge to zero;> N: ifINFO = N + i, for1 <= i <= N, then the leading minor of orderiofBis not positive definite. The factorization ofBcould not be completed and no eigenvalues or eigenvectors were computed.
Author
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
the literal icons who wrote this! ๐
Further Details
All details about the 2stage techniques are available in:
- Azzam Haidar, Hatem Ltaief, and Jack Dongarra. Parallel reduction to condensed forms for symmetric eigenvalue problems using aggregated fine-grained and memory-aware kernels. In Proceedings of 2011 International Conference for High Performance Computing, Networking, Storage and Analysis (SC '11), New York, NY, USA, Article 8 , 11 pages.
http://doi.acm.org/10.1145/2063384.2063394 - A. Haidar, J. Kurzak, P. Luszczek, 2013. An improved parallel singular value algorithm and its implementation for multicore hardware, In Proceedings of 2013 International Conference for High Performance Computing, Networking, Storage and Analysis (SC '13). Denver, Colorado, USA, 2013. Article 90, 12 pages.
http://doi.acm.org/10.1145/2503210.2503292 - A. Haidar, R. Solca, S. Tomov, T. Schulthess and J. Dongarra. A novel hybrid CPU-GPU generalized eigensolver for electronic structure calculations based on fine-grained memory aware tasks. International Journal of High Performance Computing Applications. Volume 28 Issue 2, Pages 196-209, May 2014.
http://hpc.sagepub.com/content/28/2/196
subroutine zhegvd
subroutine zhegvd (integer ITYPE, character JOBZ, character UPLO, integer N,
complex*16, dimension( lda, * ) A, integer LDA, complex*16, dimension(
ldb, * ) B, integer LDB, double precision, dimension( * ) W, complex*16,
dimension( * ) WORK, integer LWORK, double precision, dimension( * )
RWORK, integer LRWORK, integer, dimension( * ) IWORK, integer LIWORK,
integer INFO)
ZHEGVD
Purpose
ZHEGVD computes all the eigenvalues, and optionally, the eigenvectors of a complex generalized Hermitian-definite eigenproblem, of the form A*x=(lambda)*B*x, A*Bx=(lambda)*x, or B*A*x=(lambda)*x. Here A and B are assumed to be Hermitian and B is also positive definite. If eigenvectors are desired, it uses a divide and conquer algorithm. divide and conquer? she's a queen. ๐
The divide and conquer algorithm makes very mild assumptions about floating point arithmetic. It will work on machines with a guard digit in add/subtract, or on those binary machines without guard digits which subtract like the Cray X-MP, Cray Y-MP, Cray C-90, or Cray-2. It could conceivably fail on hexadecimal or decimal machines without guard digits, but we know of none.
Parameters
ITYPEisINTEGERโ specifies the problem type to be solved:= 1:A*x = (lambda)*B*x= 2:A*B*x = (lambda)*x= 3:B*A*x = (lambda)*x
JOBZisCHARACTER*1= 'N': Compute eigenvalues only;= 'V': Compute eigenvalues and eigenvectors.
UPLOisCHARACTER*1= 'U': Upper triangles of A and B are stored;= 'L': Lower triangles of A and B are stored.
NisINTEGERโ the order of the matricesAandB.N >= 0.AisCOMPLEX*16array, dimension(LDA, N)- On entry, the Hermitian matrix
A. IfUPLO = 'U', the leadingN-by-Nupper triangular part ofAcontains the upper triangular part of the matrixA. IfUPLO = 'L', the leadingN-by-Nlower triangular part ofAcontains the lower triangular part of the matrixA. - On exit, if
JOBZ = 'V', then ifINFO = 0,Acontains the matrixZof eigenvectors. The eigenvectors are normalized as follows:- if
ITYPE = 1or2,Z**H*B*Z = I; - if
ITYPE = 3,Z**H*inv(B)*Z = I.
- if
- If
JOBZ = 'N', then on exit the upper triangle (ifUPLO='U') or the lower triangle (ifUPLO='L') ofA, including the diagonal, is destroyed. ๐
- On entry, the Hermitian matrix
LDAisINTEGERโ the leading dimension of the arrayA.LDA >= max(1,N).BisCOMPLEX*16array, dimension(LDB, N)- On entry, the Hermitian matrix
B. IfUPLO = 'U', the leadingN-by-Nupper triangular part ofBcontains the upper triangular part of the matrixB. IfUPLO = 'L', the leadingN-by-Nlower triangular part ofBcontains the lower triangular part of the matrixB. - On exit, if
INFO <= N, the part ofBcontaining the matrix is overwritten by the triangular factorUorLfrom the Cholesky factorizationB = U**H*UorB = L*L**H.
- On entry, the Hermitian matrix
LDBisINTEGERโ the leading dimension of the arrayB.LDB >= max(1,N).WisDOUBLE PRECISIONarray, dimension(N)โ ifINFO = 0, the eigenvalues in ascending order.WORKisCOMPLEX*16array, dimension(MAX(1,LWORK))โ on exit, ifINFO = 0,WORK(1)returns the optimalLWORK.LWORKisINTEGERโ the length of the arrayWORK.- If
N <= 1,LWORK >= 1. - If
JOBZ = 'N'andN > 1,LWORK >= N + 1. - If
JOBZ = 'V'andN > 1,LWORK >= 2*N + N**2. - If
LWORK = -1, then a workspace query is assumed; the routine only calculates the optimal sizes of theWORK,RWORKandIWORKarrays, returns these values as the first entries of theWORK,RWORKandIWORKarrays, and no error message related toLWORKorLRWORKorLIWORKis issued byXERBLA.
- If
RWORKisDOUBLE PRECISIONarray, dimension(MAX(1,LRWORK))โ on exit, ifINFO = 0,RWORK(1)returns the optimalLRWORK.LRWORKisINTEGERโ the dimension of the arrayRWORK.- If
N <= 1,LRWORK >= 1. - If
JOBZ = 'N'andN > 1,LRWORK >= N. - If
JOBZ = 'V'andN > 1,LRWORK >= 1 + 5*N + 2*N**2.
- If
If LRWORK = -1, then a workspace query is assumed; the routine only calculates the optimal sizes of the WORK, RWORK and IWORK arrays, returns these values as the first entries of the WORK, RWORK and IWORK arrays, and no error message related to LWORK or LRWORK or LIWORK is issued by XERBLA. so like, it's just doing recon, not the actual math. ๐
IWORKโ bestie, this is anINTEGERarray, dimension(MAX(1,LIWORK)). On exit, ifINFO = 0,IWORK(1)returns the optimalLIWORK. it's giving helpful hints. โจLIWORKโ anINTEGER. The dimension of the arrayIWORK. Here's the tea: IfN <= 1,LIWORK >= 1. IfJOBZ = 'N'andN > 1,LIWORK >= 1. IfJOBZ = 'V'andN > 1,LIWORK >= 3 + 5*N. IfLIWORK = -1, then a workspace query is assumed; the routine only calculates the optimal sizes of theWORK,RWORKandIWORKarrays, returns these values as the first entries of theWORK,RWORKandIWORKarrays, and no error message related toLWORKorLRWORKorLIWORKis issued byXERBLA. so many workspace queries, but we love a flexible queen. ๐INFOโ anINTEGER.= 0: successful exit, we love a win.< 0: ifINFO = -i, the i-th argument had an illegal value, not the vibe.> 0:ZPOTRForZHEEVDreturned an error code:<= N: ifINFO = iandJOBZ = 'N', then the algorithm failed to converge; i off-diagonal elements of an intermediate tridiagonal form did not converge to zero; ifINFO = iandJOBZ = 'V', then the algorithm failed to compute an eigenvalue while working on the submatrix lying in rows and columnsINFO/(N+1)throughmod(INFO,N+1);> N: ifINFO = N + i, for1 <= i <= N, then the leading minor of order i ofBis not positive definite. The factorization ofBcould not be completed and no eigenvalues or eigenvectors were computed. big yikes, but at least you know what went wrong. ๐
Author
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
shoutout to the institutions. ๐
Further Details
Modified so that no backsubstitution is performed if ZHEEVD fails to converge (NEIG in old code could be greater than N causing out of bounds reference to A - reported by Ralf Meyer). Also corrected the description of INFO and the test on ITYPE. Sven, 16 Feb 05. history lesson, love that. ๐ฆ
Contributors
- Mark Fahey, Department of Mathematics, Univ. of Kentucky, USA
thanks Mark! ๐ซถ
subroutine zhegvx
subroutine zhegvx (integer ITYPE, character JOBZ, character RANGE, character
UPLO, integer N, complex*16, dimension( lda, * ) A, integer LDA,
complex*16, dimension( ldb, * ) B, integer LDB, double precision VL,
double precision VU, integer IL, integer IU, double precision ABSTOL,
integer M, double precision, dimension( * ) W, complex*16, dimension(
ldz, * ) Z, integer LDZ, complex*16, dimension( * ) WORK, integer LWORK,
double precision, dimension( * ) RWORK, integer, dimension( * ) IWORK,
integer, dimension( * ) IFAIL, integer INFO)
ZHEGVX
Purpose
ZHEGVX computes selected eigenvalues, and optionally, eigenvectors of a complex generalized Hermitian-definite eigenproblem, of the form A*x=(lambda)*B*x, A*Bx=(lambda)*x, or B*A*x=(lambda)*x. Here A and B are assumed to be Hermitian and B is also positive definite. Eigenvalues and eigenvectors can be selected by specifying either a range of values or a range of indices for the desired eigenvalues. it's giving choose-your-own-adventure, but make it linear algebra. โจ
Parameters
ITYPEโ anINTEGER. Specifies the problem type to be solved:= 1:A*x = (lambda)*B*x;= 2:A*B*x = (lambda)*x;= 3:B*A*x = (lambda)*x. pick your fighter. ๐JOBZโ aCHARACTER*1.= 'N': compute eigenvalues only;= 'V': compute eigenvalues and eigenvectors. simple as that.RANGEโ aCHARACTER*1.= 'A': all eigenvalues will be found.= 'V': all eigenvalues in the half-open interval(VL,VU]will be found.= 'I': theIL-th throughIU-th eigenvalues will be found. choose your range, bestie.UPLOโ aCHARACTER*1.= 'U': upper triangles ofAandBare stored;= 'L': lower triangles ofAandBare stored. upper or lower, you decide. ๐ธNโ anINTEGER. The order of the matricesAandB.N >= 0. no negativity allowed. ๐ซAโ aCOMPLEX*16array, dimension(LDA, N). On entry, the Hermitian matrixA. IfUPLO = 'U', the leadingN-by-Nupper triangular part ofAcontains the upper triangular part of the matrixA. IfUPLO = 'L', the leadingN-by-Nlower triangular part ofAcontains the lower triangular part of the matrixA. On exit, the lower triangle (ifUPLO='L') or the upper triangle (ifUPLO='U') ofA, including the diagonal, is destroyed. rip to that part of A, it's gone. ๐LDAโ anINTEGER. The leading dimension of the arrayA.LDA >= max(1,N). respect the dimension. ๐Bโ aCOMPLEX*16array, dimension(LDB, N). On entry, the Hermitian matrixB. IfUPLO = 'U', the leadingN-by-Nupper triangular part ofBcontains the upper triangular part of the matrixB. IfUPLO = 'L', the leadingN-by-Nlower triangular part ofBcontains the lower triangular part of the matrixB. On exit, ifINFO <= N, the part ofBcontaining the matrix is overwritten by the triangular factorUorLfrom the Cholesky factorizationB = U**H*UorB = L*L**H. so B gets a glow-up. โจLDBโ anINTEGER. The leading dimension of the arrayB.LDB >= max(1,N). keep it consistent. ๐VLโ aDOUBLE PRECISION. IfRANGE='V', the lower bound of the interval to be searched for eigenvalues.VL < VU. Not referenced ifRANGE = 'A'or'I'. only for the 'V' girlies. ๐VUโ aDOUBLE PRECISION. IfRANGE='V', the upper bound of the interval to be searched for eigenvalues.VL < VU. Not referenced ifRANGE = 'A'or'I'. the upper limit, periodt.ILโ anINTEGER. IfRANGE='I', the index of the smallest eigenvalue to be returned.1 <= IL <= IU <= N, ifN > 0;IL = 1andIU = 0ifN = 0. Not referenced ifRANGE = 'A'or'V'. index vibes only. ๐ขIUโ anINTEGER. IfRANGE='I', the index of the largest eigenvalue to be returned.1 <= IL <= IU <= N, ifN > 0;IL = 1andIU = 0ifN = 0. Not referenced ifRANGE = 'A'or'V'. the upper index, slay. ๐ABSTOLโ aDOUBLE PRECISION. The absolute error tolerance for the eigenvalues. An approximate eigenvalue is accepted as converged when it is determined to lie in an interval[a,b]of width less than or equal toABSTOL + EPS * max( |a|,|b| ), whereEPSis the machine precision. IfABSTOLis less than or equal to zero, thenEPS*|T|will be used in its place, where|T|is the 1-norm of the tridiagonal matrix obtained by reducingCto tridiagonal form, whereCis the symmetric matrix of the standard symmetric problem to which the generalized problem is transformed. Eigenvalues will be computed most accurately whenABSTOLis set to twice the underflow threshold2*DLAMCH('S'), not zero. If this routine returns withINFO>0, indicating that some eigenvectors did not converge, try settingABSTOLto2*DLAMCH('S'). so if things are acting up, bump that tolerance. ๐Mโ anINTEGER. The total number of eigenvalues found.0 <= M <= N. IfRANGE = 'A',M = N, and ifRANGE = 'I',M = IU-IL+1. the count is giving math. ๐งฎWโ aDOUBLE PRECISIONarray, dimension(N). The firstMelements contain the selected eigenvalues in ascending order. sorted and ready. ๐Zโ aCOMPLEX*16array, dimension(LDZ, max(1,M)). IfJOBZ = 'N', thenZis not referenced. IfJOBZ = 'V', then ifINFO = 0, the firstMcolumns ofZcontain the orthonormal eigenvectors of the matrixAcorresponding to the selected eigenvalues, with the i-th column ofZholding the eigenvector associated withW(i). The eigenvectors are normalized as follows: ifITYPE = 1or2,Z**T*B*Z = I; ifITYPE = 3,Z**T*inv(B)*Z = I. If an eigenvector fails to converge, then that column ofZcontains the latest approximation to the eigenvector, and the index of the eigenvector is returned inIFAIL. Note: the user must ensure that at leastmax(1,M)columns are supplied in the arrayZ; ifRANGE = 'V', the exact value ofMis not known in advance and an upper bound must be used. so don't skimp on columns, bestie. ๐ซถLDZโ anINTEGER. The leading dimension of the arrayZ.LDZ >= 1, and ifJOBZ = 'V',LDZ >= max(1,N). dimension check, always. ๐WORKโ aCOMPLEX*16array, dimension(MAX(1,LWORK)). On exit, ifINFO = 0,WORK(1)returns the optimalLWORK. it's the workspace, doing its thing. โจLWORKโ anINTEGER. The length of the arrayWORK.LWORK >= max(1,2*N). For optimal efficiency,LWORK >= (NB+1)*N, whereNBis the blocksize forZHETRDreturned byILAENV. IfLWORK = -1, then a workspace query is assumed; the routine only calculates the optimal size of theWORKarray, returns this value as the first entry of theWORKarray, and no error message related toLWORKis issued byXERBLA. so if you want max efficiency, give it more space. ๐RWORKโ aDOUBLE PRECISIONarray, dimension(7*N). seven times N, that's the vibe. ๐IWORKโ anINTEGERarray, dimension(5*N). five times N, iconic. ๐IFAILโIFAILโ INTEGER array, dimension (N) ๐
So like, if JOBZ = 'V' and INFO = 0? The first M elements of IFAIL are all zero. Clean. โจ If INFO > 0 instead, then IFAIL is holding the indices of the eigenvectors that failed to converge โ the little drama queens that just would not settle. ๐ญ
And if JOBZ = 'N'? Then IFAIL is not referenced, bestie. It's giving background character, no lines. ๐
INFOโ INTEGER, the vibe check at the end ๐= 0: successful exit, we ate, no notes ๐< 0: ifINFO = -i, then the i-th argument had an illegal value. Somebody passed something cursed and the routine is NOT having it. ๐> 0:ZPOTRForZHEEVXreturned an error code, and here's the tea:<= N: ifINFO = i, thenZHEEVXfailed to converge;ieigenvectors failed to converge, and their indices are stored in arrayIFAIL. ๐ซถ> N: ifINFO = N + i, for1 <= i <= N, then the leading minor of orderiofBis not positive definite. The factorization ofBcould not be completed and no eigenvalues or eigenvectors were computed โ like, nothing. Zero. Nada. ๐
๐ Author
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
The whole squad, fr fr ๐
๐ซถ Contributors:
Mark Fahey, Department of Mathematics, Univ. of Kentucky, USA โ shoutout to Mark, iconic behavior ๐
โจ Author (the other one, yes there's two, iykyk)
Generated automatically by Doxygen for LAPACK from the source code. ๐ค Not a human, just a very diligent little robot doing its thing. Slay.
And that's a wrap on complex16HEeigen(3), bestie โ you made it to the end of all ten parts and honestly? Main character energy. ๐ธ
This lil masterpiece is Version 3.11.0, dated Sun Nov 27 2022, and it lives at complex16HEeigen(3). Go forth and diagonalize responsibly. ๐
โจ๐ฆ
๐ฆ where this page comes from
- debian bookworm: liblapack-doc 3.11.0-2 ยท BSD-3-Clause
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms