hpgv(3)
π NAME π
hpgv β {hp,sp}gv: eig, QR iteration β¨
Okay bestie, this is the manual page for hpgv(3), and yes the name is a little cryptic β it's the family page for the {hp,sp}gv routines, and we're talking eig and QR iteration energy. Main character linear algebra. π
β¨ SYNOPSIS β¨
π«Ά Functions
subroutine chpgv (itype, jobz, uplo, n, ap, bp, w, z, ldz, work, rwork, info)β CHPGVsubroutine dspgv (itype, jobz, uplo, n, ap, bp, w, z, ldz, work, info)β DSPGVsubroutine sspgv (itype, jobz, uplo, n, ap, bp, w, z, ldz, work, info)β SSPGVsubroutine zhpgv (itype, jobz, uplo, n, ap, bp, w, z, ldz, work, rwork, info)β ZHPGV
πΈ Detailed Description πΈ
No cap, the actual good stuff lives down in Function Documentation β that's where each routine spills its whole story. Keep scrolling, babe. π
π Function Documentation π
π¦ subroutine chpgv (integer itype, character jobz, character uplo, integer n, complex, dimension( * ) ap, complex, dimension( * ) bp, real, dimension( * ) w, complex, dimension( ldz, * ) z, integer ldz, complex, dimension( * ) work, real, dimension( * ) rwork, integer info)
CHPGV
π Purpose:
!>
!> CHPGV 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, stored in packed format,
!> and B is also positive definite.
!>
So real talk: CHPGV gets you all the eigenvalues, and if you want, the eigenvectors too, for a complex generalized Hermitian-definite eigenproblem. π A and B are Hermitian and they're chilling in packed format, and B is also positive definite (that part is not optional, bestie).
π Parameters
ITYPEβ It's anINTEGER, and it picks which flavor of problem you're solving:
!> 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β ACHARACTER*1, the "how much do you want" switch:
!> JOBZ is CHARACTER*1
!> = 'N': Compute eigenvalues only;
!> = 'V': Compute eigenvalues and eigenvectors.
!>
UPLOβ Also aCHARACTER*1, and it says which triangle ofAandByou actually stored:
!> UPLO is CHARACTER*1
!> = 'U': Upper triangles of A and B are stored;
!> = 'L': Lower triangles of A and B are stored.
!>
NβINTEGER, the order of the matricesAandB. Constraint:N >= 0.APβCOMPLEXarray, dimension(N*(N+1)/2). On entry it's the upper or lower triangle of the Hermitian matrixA, packed columnwise in a linear array β the j-th column ofAlives inAPlike this:
!> AP is COMPLEX array, dimension (N*(N+1)/2)
!> On entry, the upper or lower triangle of the Hermitian matrix
!> A, packed columnwise in a linear array. The j-th column of A
!> is stored in the array AP as follows:
!> if UPLO = 'U', AP(i + (j-1)*j/2) = A(i,j) for 1<=i<=j;
!> if UPLO = 'L', AP(i + (j-1)*(2*n-j)/2) = A(i,j) for j<=i<=n.
!>
!> On exit, the contents of AP are destroyed.
!>
Heads up: on exit the contents ofAPare destroyed. Gone. Feral. Do not expect to read yourAback out of there. π
BPβCOMPLEXarray, dimension(N*(N+1)/2). On entry it's the upper or lower triangle of the Hermitian matrixB, packed columnwise in a linear array β the j-th column ofBis stored like so:
!> BP is COMPLEX array, dimension (N*(N+1)/2)
!> On entry, the upper or lower triangle of the Hermitian matrix
!> B, packed columnwise in a linear array. The j-th column of B
!> is stored in the array BP as follows:
!> if UPLO = 'U', BP(i + (j-1)*j/2) = B(i,j) for 1<=i<=j;
!> if UPLO = 'L', BP(i + (j-1)*(2*n-j)/2) = B(i,j) for j<=i<=n.
!>
!> On exit, the triangular factor U or L from the Cholesky
!> factorization B = U**H*U or B = L*L**H, in the same storage
!> format as B.
!>
So BP comes back holding the triangular factor U or L from the Cholesky factorization B = U**H*U or B = L*L**H, in the same storage format as B. She's transformed. π
WβREALarray, dimension(N). IfINFO = 0, this is where the eigenvalues land, in ascending order. Slay. β¨ZβCOMPLEXarray, dimension(LDZ, N). IfJOBZ = 'V', then whenINFO = 0,Zcontains the matrixZof eigenvectors, normalized like this:
!> Z is COMPLEX array, dimension (LDZ, N)
!> If JOBZ = 'V', then if INFO = 0, Z 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 Z is not referenced.
!>
And if JOBZ = 'N'? Z is literally not referenced. She's not invited to the function. π
LDZβINTEGER, the leading dimension of the arrayZ. You needLDZ >= 1, and ifJOBZ = 'V', thenLDZ >= max(1,N).WORKβCOMPLEXarray, dimension(max(1, 2*N-1)).RWORKβREALarray, dimension(max(1, 3*N-2)).INFOβINTEGER, the vibe check at the end:
!> INFO is INTEGER
!> = 0: successful exit
!> < 0: if INFO = -i, the i-th argument had an illegal value
!> > 0: CPPTRF or CHPEV returned an error code:
!> <= N: if INFO = i, CHPEV failed to converge;
!> i off-diagonal elements of an intermediate
!> tridiagonal form did not convergeto zero;
!> > N: if INFO = N + i, for 1 <= i <= n, then the leading
!> principal minor of order i of B is not positive.
!> The factorization of B could not be completed and
!> no eigenvalues or eigenvectors were computed.
!>
Translation bestie:INFO = 0is the win.INFO < 0means argument number i was illegal.INFO > 0meansCPPTRForCHPEVthrew an error code β and if it's greater thanN, the leading principal minor of order i ofBis not positive, so the factorization ofBcouldn't be completed and no eigenvalues or eigenvectors were computed. Genuinely tragic. π
π Author
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
β Definition at line 163 of file chpgv.f.
π¦ subroutine dspgv (integer itype, character jobz, character uplo, integer n, double precision, dimension( * ) ap, double precision, dimension( * ) bp, double precision, dimension( * ) w, double precision, dimension( ldz, * ) z, integer ldz, double precision, dimension( * ) work, integer info)
DSPGV
π Purpose:
!>
!> DSPGV computes all the eigenvalues and, optionally, the eigenvectors
!> of a real generalized symmetric-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 symmetric, stored in packed format,
!> and B is also positive definite.
!>
Same energy as her complex sister, but make it real: DSPGV computes all the eigenvalues and, optionally, the eigenvectors of a real generalized symmetric-definite eigenproblem. A and B are symmetric, packed format, and B is positive definite. Periodt. π
π Parameters
ITYPEβINTEGER, picks the problem type:
!> 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βCHARACTER*1:
!> JOBZ is CHARACTER*1
!> = 'N': Compute eigenvalues only;
!> = 'V': Compute eigenvalues and eigenvectors.
!>
UPLOβCHARACTER*1, tells you which triangle is stored:
!> UPLO is CHARACTER*1
!> = 'U': Upper triangles of A and B are stored;
!> = 'L': Lower triangles of A and B are stored.
!>
NβINTEGER, order of the matricesAandB. Constraint:N >= 0.APβDOUBLE PRECISIONarray, dimension(N*(N+1)/2). On entry, the upper or lower triangle of the symmetric matrixA, packed columnwise in a linear array. The j-th column ofAgoes intoAPlike this:
!> AP is DOUBLE PRECISION array, dimension (N*(N+1)/2)
!> On entry, the upper or lower triangle of the symmetric matrix
!> A, packed columnwise in a linear array. The j-th column of A
!> is stored in the array AP as follows:
!> if UPLO = 'U', AP(i + (j-1)*j/2) = A(i,j) for 1<=i<=j;
!> if UPLO = 'L', AP(i + (j-1)*(2*n-j)/2) = A(i,j) for j<=i<=n.
!>
!> On exit, the contents of AP are destroyed.
!>
Again for the people in the back:APcontents are destroyed on exit. YourAdoes not survive the function. π
BPβDOUBLE PRECISIONarray, dimension(N*(N+1)/2). On entry, the upper or lower triangle of the symmetric matrixB, packed columnwise in a linear array:
!> BP is DOUBLE PRECISION array, dimension (N*(N+1)/2)
!> On entry, the upper or lower triangle of the symmetric matrix
!> B, packed columnwise in a linear array. The j-th column of B
!> is stored in the array BP as follows:
!> if UPLO = 'U', BP(i + (j-1)*j/2) = B(i,j) for 1<=i<=j;
!> if UPLO = 'L', BP(i + (j-1)*(2*n-j)/2) = B(i,j) for j<=i<=n.
!>
!> On exit, the triangular factor U or L from the Cholesky
!> factorization B = U**T*U or B = L*L**T, in the same storage
!> format as B.
!>
On exit, BP holds the triangular factor U or L from the Cholesky factorization B = U**T*U or B = L*L**T, in the same storage format as B. Iconic. β¨
WβDOUBLE PRECISIONarray, dimension(N). IfINFO = 0, the eigenvalues, in ascending order.ZβDOUBLE PRECISIONarray, dimension(LDZ, N). IfJOBZ = 'V'andINFO = 0,Zcontains the matrixZof eigenvectors, normalized like:
!> Z is DOUBLE PRECISION array, dimension (LDZ, N)
!> If JOBZ = 'V', then if INFO = 0, Z contains the matrix Z of
!> eigenvectors. The eigenvectors are normalized as follows:
!> if ITYPE = 1 or 2, Z**T*B*Z = I;
!> if ITYPE = 3, Z**T*inv(B)*Z = I.
!> If JOBZ = 'N', then Z is not referenced.
!>
If JOBZ = 'N', Z is not referenced. Not even a little bit. π
LDZβINTEGER, leading dimension of the arrayZ.LDZ >= 1, and ifJOBZ = 'V',LDZ >= max(1,N).WORKβDOUBLE PRECISIONarray, dimension(3*N).INFOβINTEGER, the final verdict:
!> INFO is INTEGER
!> = 0: successful exit
!> < 0: if INFO = -i, the i-th argument had an illegal value
!> > 0: DPPTRF or DSPEV returned an error code:
!> <= N: if INFO = i, DSPEV failed to converge;
!> i off-diagonal elements of an intermediate
!> tridiagonal form did not converge to zero.
!> > N: if INFO = n + i, for 1 <= i <= n, then the leading
!> principal minor of order i of B is not positive.
!> The factorization of B could not be completed and
!> no eigenvalues or eigenvectors were computed.
!>
Read this carefully bestie:INFO > Nβ meaningINFO = n + ifor1 <= i <= nβ means the leading principal minor of order i ofBis not positive, the factorization ofBcould not be completed, and no eigenvalues or eigenvectors were computed. Nothing. Nada. π
π Author
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
β Definition at line 158 of file dspgv.f.
π¦ subroutine sspgv (integer itype, character jobz, character uplo, integer n, real, dimension( * ) ap, real, dimension( * ) bp, real, dimension( * ) w, real, dimension( ldz, * ) z, integer ldz, real, dimension( * ) work, integer info)
SSPGV
π Purpose:
!>
!> SSPGV computes all the eigenvalues and, optionally, the eigenvectors
!> of a real generalized symmetric-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 symmetric, stored in packed format,
!> and B is also positive definite.
!>
SSPGV β single precision edition, but the same whole vibe. All the eigenvalues and, optionally, the eigenvectors of a real generalized symmetric-definite eigenproblem. A and B symmetric, packed format, B positive definite. She ate. π
π Parameters
ITYPEβINTEGER, the problem type selector:
!> 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βCHARACTER*1, eigenvalues only or eigenvalues and eigenvectors:
!> JOBZ is CHARACTER*1
!> = 'N': Compute eigenvalues only;
!> = 'V': Compute eigenvalues and eigenvectors.
!>
UPLOβCHARACTER*1, which triangles ofAandByou stored:
!> UPLO is CHARACTER*1
!> = 'U': Upper triangles of A and B are stored;
!> = 'L': Lower triangles of A and B are stored.
!>
NβINTEGER, the order of the matricesAandB. Constraint:N >= 0.APβREALarray, dimension(N*(N+1)/2)β and bestie, this is exactly where our part 1 dipsβ¦
AP π β REAL array, dimension (N*(N+1)/2)
On entry, this is the upper or lower triangle of the symmetric matrix A, packed columnwise in a linear array. The j-th column of A lives in AP like this:
if UPLO = 'U', AP(i + (j-1)*j/2) = A(i,j) for 1<=i<=j;
if UPLO = 'L', AP(i + (j-1)*(2*n-j)/2) = A(i,j) for j<=i<=n.
β οΈ On exit, the contents of AP are destroyed. Like, gone gone. If you needed that matrix afterwards bestieβ¦ you didn't. Copy it first, iykyk π
BP π¦ β REAL array, dimension (N*(N+1)/2)
On entry, the upper or lower triangle of the symmetric matrix B, packed columnwise in a linear array. The j-th column of B is stored in BP as:
if UPLO = 'U', BP(i + (j-1)*j/2) = B(i,j) for 1<=i<=j;
if UPLO = 'L', BP(i + (j-1)*(2*n-j)/2) = B(i,j) for j<=i<=n.
On exit, BP holds the triangular factor U or L from the Cholesky factorization B = U**T*U or B = L*L**T, in the same storage format as B. So it's not destroyed, it's transformed β main character energy honestly π
W β β REAL array, dimension (N)
If INFO = 0, this is where the eigenvalues live, in ascending order. Cutest array on the page tbh.
Z πΈ β REAL array, dimension (LDZ, N)
If JOBZ = 'V', then if INFO = 0, Z contains the matrix Z of eigenvectors. The eigenvectors are normalized like so:
if ITYPE = 1 or 2, Z**T*B*Z = I;
if ITYPE = 3, Z**T*inv(B)*Z = I.
If JOBZ = 'N', then Z is not referenced at all. It's just vibing. Not invited to the function.
LDZ π β INTEGER
The leading dimension of the array Z. LDZ >= 1, and if JOBZ = 'V', then LDZ >= max(1,N). Respect the constraint or catch an error, periodt.
WORK π§ β REAL array, dimension (3*N)
Scratch space. That's it. That's the whole description. Iconic brevity.
INFO π β INTEGER
= 0: successful exit π< 0: ifINFO = -i, the i-th argument had an illegal value. Something you passed in was not it.> 0:SPPTRForSSPEVreturned an error code:<= N: ifINFO = i,SSPEVfailed 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 principal minor of order i of B is not positive. The factorization of B could not be completed and no eigenvalues or eigenvectors were computed. Basically B wasn't positive definite and the whole thing said "nope" π«
Author βοΈ
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
Definition at line 158 of file sspgv.f.
Okay so now the complex twin, and she is serving the exact same energy but with more letters and more work arrays π
subroutine zhpgv (integer itype, character jobz, character uplo, integer n,
complex*16, dimension( * ) ap, complex*16, dimension( * ) bp, double
precision, dimension( * ) w, complex*16, dimension( ldz, * ) z, integer
ldz, complex*16, dimension( * ) work, double precision, dimension( * )
rwork, integer info)
ZHPGV π
Purpose π―
ZHPGV 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, stored in packed format, and B is also positive definite. B has to be positive definite, that's not optional, that's the whole vibe check.
Parameters π§Ύ
ITYPE β 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 β CHARACTER*1
= 'N': Compute eigenvalues only;= 'V': Compute eigenvalues and eigenvectors.
UPLO β CHARACTER*1
= 'U': Upper triangles of A and B are stored;= 'L': Lower triangles of A and B are stored.
N β INTEGER
The order of the matrices A and B. N >= 0. Zero is allowed, bestie, it's a valid order, don't be weird about it.
AP π β COMPLEX*16 array, dimension (N*(N+1)/2)
On entry, the upper or lower triangle of the Hermitian matrix A, packed columnwise in a linear array. The j-th column of A is stored in the array AP as follows:
if UPLO = 'U', AP(i + (j-1)*j/2) = A(i,j) for 1<=i<=j;
if UPLO = 'L', AP(i + (j-1)*(2*n-j)/2) = A(i,j) for j<=i<=n.
β οΈ On exit, the contents of AP are destroyed. Same deal as her real-valued sister. Say bye to your input π
BP π β COMPLEX*16 array, dimension (N*(N+1)/2)
On entry, the upper or lower triangle of the Hermitian matrix B, packed columnwise in a linear array. The j-th column of B is stored in BP as follows:
if UPLO = 'U', BP(i + (j-1)*j/2) = B(i,j) for 1<=i<=j;
if UPLO = 'L', BP(i + (j-1)*(2*n-j)/2) = B(i,j) for j<=i<=n.
On exit, the triangular factor U or L from the Cholesky factorization B = U**H*U or B = L*L**H, in the same storage format as B. Note the **H β we're in conjugate transpose territory now, she's fancy π
W β β DOUBLE PRECISION array, dimension (N)
If INFO = 0, the eigenvalues in ascending order.
Z π¦ β COMPLEX*16 array, dimension (LDZ, N)
If JOBZ = 'V', then if INFO = 0, Z 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 Z is not referenced. She's off the clock π«Ά
LDZ π β INTEGER
The leading dimension of the array Z. LDZ >= 1, and if JOBZ = 'V', LDZ >= max(1,N).
WORK π§ β COMPLEX*16 array, dimension (max(1, 2*N-1))
Scratch space, complex edition β¨
RWORK π§ β DOUBLE PRECISION array, dimension (max(1, 3*N-2))
More scratch space, but real this time. Yes you need both. No you can't skip it. That's just how ZHPGV rolls.
INFO π β INTEGER
= 0: successful exit π< 0: ifINFO = -i, the i-th argument had an illegal value.> 0:ZPPTRForZHPEVreturned an error code:<= N: ifINFO = i,ZHPEVfailed to converge; i off-diagonal elements of an intermediate tridiagonal form did not converge to zero (the source code literally spells itconvergetoβ we stan a typo, no cap π);> N: ifINFO = N + i, for1 <= i <= n, then the leading principal minor of order i of B is not positive. The factorization of B could not be completed and no eigenvalues or eigenvectors were computed.
Author βοΈ
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
Definition at line 163 of file zhpgv.f.
Author βοΈ (yes, again, it's a whole section)
Generated automatically by Doxygen for LAPACK from the source code. A bot wrote this and honestly it ate π€β¨
And that's the whole page bestie, we did it π This was LAPACK Version 3.12.0, page hpgv(3) β go forth, pack those triangles, and don't forget that AP gets destroyed on exit. Mwah π
π¦ where this page comes from
- arch rolling: lapack-doc 3.12.1-2 Β· custom
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms