TESTING/EIG/sdrgsx.f(3)
πΈ NAME
TESTING/EIG/sdrgsx.f β the Library Functions Manual page for the SDRGSX test routine, bestie. Itβs giving βFortran test-driver energyβ and itβs here to check SGGESX.
β¨ SYNOPSIS
π Functions/Subroutines
subroutine sdrgsx (nsize, ncmax, thresh, nin, nout, a, lda, b, ai, bi,
z, q, alphar, alphai, beta, c, ldc, s, work, lwork, iwork, liwork,
bwork, info)
SDRGSX β yes, thatβs the whole name. No notes. Slay.
π« Function/Subroutine Documentation
π subroutine sdrgsx
subroutine sdrgsx (integer nsize, integer ncmax, real thresh, integer nin,
integer nout, real, dimension( lda, * ) a, integer lda, real, dimension(
lda, * ) b, real, dimension( lda, * ) ai, real, dimension( lda, * ) bi,
real, dimension( lda, * ) z, real, dimension( lda, * ) q, real,
dimension( * ) alphar, real, dimension( * ) alphai, real, dimension( * )
beta, real, dimension( ldc, * ) c, integer ldc, real, dimension( * ) s,
real, dimension( * ) work, integer lwork, integer, dimension( * ) iwork,
integer liwork, logical, dimension( * ) bwork, integer info)
SDRGSX
π Purpose
Okay so SDRGSX checks the nonsymmetric generalized eigenvalue (Schur form) problem expert driver SGGESX. Thatβs the vibe check. π₯
SGGESX factors A and B as Q S Z' and Q T Z', where ' means transpose, T is upper triangular, S is in generalized Schur form (block upper triangular, with 1x1 and 2x2 blocks on the diagonal, the 2x2 blocks corresponding to complex conjugate pairs of generalized eigenvalues), and Q and Z are orthogonal. It also computes the generalized eigenvalues (alpha(1),beta(1)), ..., (alpha(n),beta(n)). Thus, w(j) = alpha(j)/beta(j) is a root of the characteristic equation
det( A - w(j) B ) = 0
Optionally it also reorders the eigenvalues so that a selected cluster of eigenvalues appears in the leading diagonal block of the Schur forms; computes a reciprocal condition number for the average of the selected eigenvalues; and computes a reciprocal condition number for the right and left deflating subspaces corresponding to the selected eigenvalues. Obsessed, honestly. π
When SDRGSX is called with NSIZE > 0, five (5) types of built-in matrix pairs are used to test the routine SGGESX. π§ͺ
When SDRGSX is called with NSIZE = 0, it reads in test matrix data to test SGGESX. π
For each matrix pair, the following tests will be performed and compared with the threshold THRESH except for the tests (7) and (9):
- (1)
| A - Q S Z' | / ( |A| n ulp ) - (2)
| B - Q T Z' | / ( |B| n ulp ) - (3)
| I - QQ' | / ( n ulp ) - (4)
| I - ZZ' | / ( n ulp ) - (5) if
Ais in Schur form (i.e. quasi-triangular form) - (6) maximum over
jofD(j)where:
if alpha(j) is real:
|alpha(j) - S(j,j)| |beta(j) - T(j,j)|
D(j) = ------------------------ + -----------------------
max(|alpha(j)|,|S(j,j)|) max(|beta(j)|,|T(j,j)|)
if alpha(j) is complex:
| det( s S - w T ) |
D(j) = ---------------------------------------------------
ulp max( s norm(S), |w| norm(T) )*norm( s S - w T )
and S and T are here the 2 x 2 diagonal blocks of S and T corresponding to the j-th and j+1-th eigenvalues.
- (7) if sorting worked and
SDIMis the number of eigenvalues which were selected. - (8) the estimated value
DIFdoes not differ from the true values ofDifuandDiflmore than a factor10*THRESH. If the estimateDIFequals zero the corresponding true values ofDifuandDiflshould be less thanEPS*norm(A, B). If the true value ofDifuandDiflequal zero, the estimateDIFshould be less thanEPS*norm(A, B). - (9) If
INFO = N+3is returned bySGGESX, the reordering and we check thatDIF = PL = PR = 0and that the true value ofDifuandDiflis< EPS*norm(A, B). We count the events whenINFO=N+3. - (10) the estimated value
PLdoes not differ from the true value ofPLTRUmore than a factorTHRESH. If the estimatePLequals zero the corresponding true value ofPLTRUshould be less thanEPS*norm(A, B). If the true value ofPLTRUequal zero, the estimatePLshould be less thanEPS*norm(A, B).
For read-in test matrices, the above tests are run except that the exact value for DIF (and PL) is input data. Additionally, there is one more test run for read-in test matrices:
That last one is test (10), bestie β donβt lose it in the group chat. π«Ά
Note that for the built-in tests, a total of 10*NSIZE*(NSIZE-1) matrix pairs are generated and tested. NSIZE should be kept small. π¨
SVD (routine SGESVD) is used for computing the true value of DIF_u and DIF_l when testing the built-in test problems.
π§ͺ Built-in Test Matrices
All built-in test matrices are the 2 by 2 block of triangular matrices
A = [ A11 A12 ] and B = [ B11 B12 ]
[ A22 ] [ B22 ]
where for different type of A11 and A22 are given as the following. A12 and B12 are chosen so that the generalized Sylvester equation
A11*R - L*A22 = -A12
B11*R - L*B22 = -B12
have prescribed solution R and L.
Type 1:
Type 1: A11 = J_m(1,-1) and A_22 = J_k(1-a,1).
B11 = I_m, B22 = I_k
where J_k(a,b) is the k-by-k Jordan block with ``a'' on
diagonal and ``b'' on superdiagonal.
Type 2:
Type 2: A11 = (a_ij) = ( 2(.5-sin(i)) ) and
B11 = (b_ij) = ( 2(.5-sin(ij)) ) for i=1,...,m, j=i,...,m
A22 = (a_ij) = ( 2(.5-sin(i+j)) ) and
B22 = (b_ij) = ( 2(.5-sin(ij)) ) for i=m+1,...,k, j=i,...,k
Type 3:
Type 3: A11, A22 and B11, B22 are chosen as for Type 2, but each
second diagonal block in A_11 and each third diagonal block
in A_22 are made as 2 by 2 blocks.
Type 4:
Type 4: A11 = ( 20(.5 - sin(ij)) ) and B22 = ( 2(.5 - sin(i+j)) )
for i=1,...,m, j=1,...,m and
A22 = ( 20(.5 - sin(i+j)) ) and B22 = ( 2(.5 - sin(ij)) )
for i=m+1,...,k, j=m+1,...,k
Type 5:
Type 5: (A,B) and have potentially close or common eigenvalues and
very large departure from block diagonality A_11 is chosen
as the m x m leading submatrix of A_1:
| 1 b |
| -b 1 |
| 1+d b |
| -b 1+d |
A_1 = | d 1 |
| -1 d |
| -d 1 |
| -1 -d |
| 1 |
and A_22 is chosen as the k x k leading submatrix of A_2:
| -1 b |
| -b -1 |
| 1-d b |
| -b 1-d |
A_2 = | d 1+b |
| -1-b d |
| -d 1+b |
| -1+b -d |
| 1-d |
and matrix B are chosen as identity matrices (see SLATM5).
π Parameters
NSIZEβNSIZE is INTEGER. The maximum size of the matrices to use.NSIZE >= 0. IfNSIZE = 0, no built-in tests matrices are used, but read-in test matrices are used to testSGGESX. πNCMAXβNCMAX is INTEGER. Maximum allowableNMAXfor generatingKronekermatrix in call toSLAKF2. πTHRESHβTHRESH is REAL. A test will count as a fail if the error, computed as described above, exceedsTHRESH. Note that the error is scaled to beO(1), soTHRESHshould be a reasonably small multiple of1, e.g.,10or100. In particular, it should not depend on the precision (single vs. double) or the size of the matrix.THRESH >= 0. β¨NINβNIN is INTEGER. TheFORTRANunit number for reading in the data file of problems to solve. πNOUTβNOUT is INTEGER. TheFORTRANunit number for printing out error messages (e.g., if a routine returnsIINFOnot equal to0.) π¨AβA is REAL array, dimension (LDA, NSIZE). Used to store the matrix whose eigenvalues are to be computed. On exit,Acontains the last matrix actually used. πLDAβLDA is INTEGER. The leading dimension ofA,B,AI,BI,ZandQ,LDA >= max( 1, NSIZE ). For the read-in test,LDA >= max( 1, N ),Nis the size of the test matrices. π«ΆBβB is REAL array, dimension (LDA, NSIZE). Used to store the matrix whose eigenvalues are to be computed. On exit,Bcontains the last matrix actually used. πΈAIβAI is REAL array, dimension (LDA, NSIZE). Copy ofA, modified bySGGESX. π¦BIβBI is REAL array, dimension (LDA, NSIZE). Copy ofB, modified bySGGESX. π§ZβZ is REAL array, dimension (LDA, NSIZE).Zholds the left Schur vectors computed bySGGESX. πQβ the next part picks up right here, bestie. Description continues in part 2. πQβ REAL array, dimension(LDA, NSIZE). This one holds the right Schur vectors thatSGGESXcomputed. iconic behavior honestly πALPHARβ REAL array, dimension(NSIZE). Real part of the eigenvalue situation, bestie β¨ALPHAIβ REAL array, dimension(NSIZE). Imaginary part of the eigenvalue situation π¦BETAβ REAL array, dimension(NSIZE). On exit,(ALPHAR + ALPHAI*i)/BETAare the eigenvalues. periodt.Cβ REAL array, dimension(LDC, LDC). Stores the matrix generated by subroutineSLAKF2; this is the matrix formed by Kronecker products used for estimatingDIF. no cap, it's giving very serious math πLDCβ INTEGER. The leading dimension ofC.LDC >= max(1, LDA*LDA/2 ). respect the bounds or else πSβ REAL array, dimension(LDC). Singular values ofC. slay π₯WORKβ REAL array, dimension(LWORK). workspace vibes β¨LWORKβ INTEGER. The dimension of the arrayWORK.LWORK >= MAX( 5*NSIZE*NSIZE/2 - 2, 10*(NSIZE+1) ). do not skimp on this, fr fr π«ΆIWORKβ INTEGER array, dimension(LIWORK). integer workspace, living its best life πLIWORKβ INTEGER. The dimension of the arrayIWORK.LIWORK >= NSIZE + 6. lowkey important, don't ignore her πBWORKβ LOGICAL array, dimension(LDA). logical workspace, she's just here for the vibes πΈINFOβ INTEGER. the ultimate vibe check:= 0: successful exit β¨< 0: ifINFO = -i, the i-th argument had an illegal value. not cute π> 0: a routine returned an error code. π
π Author
- Univ. of Tennessee
- Univ. of California Berkeley
- Univ. of Colorado Denver
- NAG Ltd.
Definition at line 356 of file sdrgsx.f.
π§ Author
Generated automatically by Doxygen for LAPACK from the source code.
okay that's the whole page bestie π«Ά shoutout to LAPACK Version 3.12.0 and the source TESTING/EIG/sdrgsx.f(3) β footer said what it said, no date in sight, and we respect it π
β¨
π¦ 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