📄 claqr2.f
字号:
SUBROUTINE CLAQR2( WANTT, WANTZ, N, KTOP, KBOT, NW, H, LDH, ILOZ,
$ IHIZ, Z, LDZ, NS, ND, SH, V, LDV, NH, T, LDT,
$ NV, WV, LDWV, WORK, LWORK )
*
* -- LAPACK auxiliary routine (version 3.1) --
* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
* November 2006
*
* .. Scalar Arguments ..
INTEGER IHIZ, ILOZ, KBOT, KTOP, LDH, LDT, LDV, LDWV,
$ LDZ, LWORK, N, ND, NH, NS, NV, NW
LOGICAL WANTT, WANTZ
* ..
* .. Array Arguments ..
COMPLEX H( LDH, * ), SH( * ), T( LDT, * ), V( LDV, * ),
$ WORK( * ), WV( LDWV, * ), Z( LDZ, * )
* ..
*
* This subroutine is identical to CLAQR3 except that it avoids
* recursion by calling CLAHQR instead of CLAQR4.
*
*
* ******************************************************************
* Aggressive early deflation:
*
* This subroutine accepts as input an upper Hessenberg matrix
* H and performs an unitary similarity transformation
* designed to detect and deflate fully converged eigenvalues from
* a trailing principal submatrix. On output H has been over-
* written by a new Hessenberg matrix that is a perturbation of
* an unitary similarity transformation of H. It is to be
* hoped that the final version of H has many zero subdiagonal
* entries.
*
* ******************************************************************
* WANTT (input) LOGICAL
* If .TRUE., then the Hessenberg matrix H is fully updated
* so that the triangular Schur factor may be
* computed (in cooperation with the calling subroutine).
* If .FALSE., then only enough of H is updated to preserve
* the eigenvalues.
*
* WANTZ (input) LOGICAL
* If .TRUE., then the unitary matrix Z is updated so
* so that the unitary Schur factor may be computed
* (in cooperation with the calling subroutine).
* If .FALSE., then Z is not referenced.
*
* N (input) INTEGER
* The order of the matrix H and (if WANTZ is .TRUE.) the
* order of the unitary matrix Z.
*
* KTOP (input) INTEGER
* It is assumed that either KTOP = 1 or H(KTOP,KTOP-1)=0.
* KBOT and KTOP together determine an isolated block
* along the diagonal of the Hessenberg matrix.
*
* KBOT (input) INTEGER
* It is assumed without a check that either
* KBOT = N or H(KBOT+1,KBOT)=0. KBOT and KTOP together
* determine an isolated block along the diagonal of the
* Hessenberg matrix.
*
* NW (input) INTEGER
* Deflation window size. 1 .LE. NW .LE. (KBOT-KTOP+1).
*
* H (input/output) COMPLEX array, dimension (LDH,N)
* On input the initial N-by-N section of H stores the
* Hessenberg matrix undergoing aggressive early deflation.
* On output H has been transformed by a unitary
* similarity transformation, perturbed, and the returned
* to Hessenberg form that (it is to be hoped) has some
* zero subdiagonal entries.
*
* LDH (input) integer
* Leading dimension of H just as declared in the calling
* subroutine. N .LE. LDH
*
* ILOZ (input) INTEGER
* IHIZ (input) INTEGER
* Specify the rows of Z to which transformations must be
* applied if WANTZ is .TRUE.. 1 .LE. ILOZ .LE. IHIZ .LE. N.
*
* Z (input/output) COMPLEX array, dimension (LDZ,IHI)
* IF WANTZ is .TRUE., then on output, the unitary
* similarity transformation mentioned above has been
* accumulated into Z(ILOZ:IHIZ,ILO:IHI) from the right.
* If WANTZ is .FALSE., then Z is unreferenced.
*
* LDZ (input) integer
* The leading dimension of Z just as declared in the
* calling subroutine. 1 .LE. LDZ.
*
* NS (output) integer
* The number of unconverged (ie approximate) eigenvalues
* returned in SR and SI that may be used as shifts by the
* calling subroutine.
*
* ND (output) integer
* The number of converged eigenvalues uncovered by this
* subroutine.
*
* SH (output) COMPLEX array, dimension KBOT
* On output, approximate eigenvalues that may
* be used for shifts are stored in SH(KBOT-ND-NS+1)
* through SR(KBOT-ND). Converged eigenvalues are
* stored in SH(KBOT-ND+1) through SH(KBOT).
*
* V (workspace) COMPLEX array, dimension (LDV,NW)
* An NW-by-NW work array.
*
* LDV (input) integer scalar
* The leading dimension of V just as declared in the
* calling subroutine. NW .LE. LDV
*
* NH (input) integer scalar
* The number of columns of T. NH.GE.NW.
*
* T (workspace) COMPLEX array, dimension (LDT,NW)
*
* LDT (input) integer
* The leading dimension of T just as declared in the
* calling subroutine. NW .LE. LDT
*
* NV (input) integer
* The number of rows of work array WV available for
* workspace. NV.GE.NW.
*
* WV (workspace) COMPLEX array, dimension (LDWV,NW)
*
* LDWV (input) integer
* The leading dimension of W just as declared in the
* calling subroutine. NW .LE. LDV
*
* WORK (workspace) COMPLEX array, dimension LWORK.
* On exit, WORK(1) is set to an estimate of the optimal value
* of LWORK for the given values of N, NW, KTOP and KBOT.
*
* LWORK (input) integer
* The dimension of the work array WORK. LWORK = 2*NW
* suffices, but greater efficiency may result from larger
* values of LWORK.
*
* If LWORK = -1, then a workspace query is assumed; CLAQR2
* only estimates the optimal workspace size for the given
* values of N, NW, KTOP and KBOT. The estimate is returned
* in WORK(1). No error message related to LWORK is issued
* by XERBLA. Neither H nor Z are accessed.
*
* ================================================================
* Based on contributions by
* Karen Braman and Ralph Byers, Department of Mathematics,
* University of Kansas, USA
*
* ==================================================================
* .. Parameters ..
COMPLEX ZERO, ONE
PARAMETER ( ZERO = ( 0.0e0, 0.0e0 ),
$ ONE = ( 1.0e0, 0.0e0 ) )
REAL RZERO, RONE
PARAMETER ( RZERO = 0.0e0, RONE = 1.0e0 )
* ..
* .. Local Scalars ..
COMPLEX BETA, CDUM, S, TAU
REAL FOO, SAFMAX, SAFMIN, SMLNUM, ULP
INTEGER I, IFST, ILST, INFO, INFQR, J, JW, KCOL, KLN,
$ KNT, KROW, KWTOP, LTOP, LWK1, LWK2, LWKOPT
* ..
* .. External Functions ..
REAL SLAMCH
EXTERNAL SLAMCH
* ..
* .. External Subroutines ..
EXTERNAL CCOPY, CGEHRD, CGEMM, CLACPY, CLAHQR, CLARF,
$ CLARFG, CLASET, CTREXC, CUNGHR, SLABAD
* ..
* .. Intrinsic Functions ..
INTRINSIC ABS, AIMAG, CMPLX, CONJG, INT, MAX, MIN, REAL
* ..
* .. Statement Functions ..
REAL CABS1
* ..
* .. Statement Function definitions ..
CABS1( CDUM ) = ABS( REAL( CDUM ) ) + ABS( AIMAG( CDUM ) )
* ..
* .. Executable Statements ..
*
* ==== Estimate optimal workspace. ====
*
JW = MIN( NW, KBOT-KTOP+1 )
IF( JW.LE.2 ) THEN
LWKOPT = 1
ELSE
*
* ==== Workspace query call to CGEHRD ====
*
CALL CGEHRD( JW, 1, JW-1, T, LDT, WORK, WORK, -1, INFO )
LWK1 = INT( WORK( 1 ) )
*
* ==== Workspace query call to CUNGHR ====
*
CALL CUNGHR( JW, 1, JW-1, T, LDT, WORK, WORK, -1, INFO )
LWK2 = INT( WORK( 1 ) )
*
* ==== Optimal workspace ====
*
LWKOPT = JW + MAX( LWK1, LWK2 )
END IF
*
* ==== Quick return in case of workspace query. ====
*
IF( LWORK.EQ.-1 ) THEN
WORK( 1 ) = CMPLX( LWKOPT, 0 )
RETURN
END IF
*
* ==== Nothing to do ...
* ... for an empty active block ... ====
NS = 0
ND = 0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -