sgges.f.html
来自「famous linear algebra library (LAPACK) p」· HTML 代码 · 共 583 行 · 第 1/3 页
HTML
583 行
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>sgges.f</title>
<meta name="generator" content="emacs 21.3.1; htmlfontify 0.20">
<style type="text/css"><!--
body { background: rgb(255, 255, 255); color: rgb(0, 0, 0); font-style: normal; font-weight: 500; font-stretch: normal; font-family: adobe-courier; font-size: 11pt; text-decoration: none; }
span.default { background: rgb(255, 255, 255); color: rgb(0, 0, 0); font-style: normal; font-weight: 500; font-stretch: normal; font-family: adobe-courier; font-size: 11pt; text-decoration: none; }
span.default a { background: rgb(255, 255, 255); color: rgb(0, 0, 0); font-style: normal; font-weight: 500; font-stretch: normal; font-family: adobe-courier; font-size: 11pt; text-decoration: underline; }
span.string { color: rgb(188, 143, 143); background: rgb(255, 255, 255); font-style: normal; font-weight: 500; font-stretch: normal; font-family: adobe-courier; font-size: 11pt; text-decoration: none; }
span.string a { color: rgb(188, 143, 143); background: rgb(255, 255, 255); font-style: normal; font-weight: 500; font-stretch: normal; font-family: adobe-courier; font-size: 11pt; text-decoration: underline; }
span.comment { color: rgb(178, 34, 34); background: rgb(255, 255, 255); font-style: normal; font-weight: 500; font-stretch: normal; font-family: adobe-courier; font-size: 11pt; text-decoration: none; }
span.comment a { color: rgb(178, 34, 34); background: rgb(255, 255, 255); font-style: normal; font-weight: 500; font-stretch: normal; font-family: adobe-courier; font-size: 11pt; text-decoration: underline; }
--></style>
</head>
<body>
<pre>
SUBROUTINE <a name="SGGES.1"></a><a href="sgges.f.html#SGGES.1">SGGES</a>( JOBVSL, JOBVSR, SORT, SELCTG, N, A, LDA, B, LDB,
$ SDIM, ALPHAR, ALPHAI, BETA, VSL, LDVSL, VSR,
$ LDVSR, WORK, LWORK, BWORK, INFO )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> -- LAPACK driver routine (version 3.1) --
</span><span class="comment">*</span><span class="comment"> Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
</span><span class="comment">*</span><span class="comment"> November 2006
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> .. Scalar Arguments ..
</span> CHARACTER JOBVSL, JOBVSR, SORT
INTEGER INFO, LDA, LDB, LDVSL, LDVSR, LWORK, N, SDIM
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Array Arguments ..
</span> LOGICAL BWORK( * )
REAL A( LDA, * ), ALPHAI( * ), ALPHAR( * ),
$ B( LDB, * ), BETA( * ), VSL( LDVSL, * ),
$ VSR( LDVSR, * ), WORK( * )
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Function Arguments ..
</span> LOGICAL SELCTG
EXTERNAL SELCTG
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Purpose
</span><span class="comment">*</span><span class="comment"> =======
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> <a name="SGGES.27"></a><a href="sgges.f.html#SGGES.1">SGGES</a> computes for a pair of N-by-N real nonsymmetric matrices (A,B),
</span><span class="comment">*</span><span class="comment"> the generalized eigenvalues, the generalized real Schur form (S,T),
</span><span class="comment">*</span><span class="comment"> optionally, the left and/or right matrices of Schur vectors (VSL and
</span><span class="comment">*</span><span class="comment"> VSR). This gives the generalized Schur factorization
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> (A,B) = ( (VSL)*S*(VSR)**T, (VSL)*T*(VSR)**T )
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Optionally, it also orders the eigenvalues so that a selected cluster
</span><span class="comment">*</span><span class="comment"> of eigenvalues appears in the leading diagonal blocks of the upper
</span><span class="comment">*</span><span class="comment"> quasi-triangular matrix S and the upper triangular matrix T.The
</span><span class="comment">*</span><span class="comment"> leading columns of VSL and VSR then form an orthonormal basis for the
</span><span class="comment">*</span><span class="comment"> corresponding left and right eigenspaces (deflating subspaces).
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> (If only the generalized eigenvalues are needed, use the driver
</span><span class="comment">*</span><span class="comment"> <a name="SGGEV.41"></a><a href="sggev.f.html#SGGEV.1">SGGEV</a> instead, which is faster.)
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> A generalized eigenvalue for a pair of matrices (A,B) is a scalar w
</span><span class="comment">*</span><span class="comment"> or a ratio alpha/beta = w, such that A - w*B is singular. It is
</span><span class="comment">*</span><span class="comment"> usually represented as the pair (alpha,beta), as there is a
</span><span class="comment">*</span><span class="comment"> reasonable interpretation for beta=0 or both being zero.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> A pair of matrices (S,T) is in generalized real Schur form if T is
</span><span class="comment">*</span><span class="comment"> upper triangular with non-negative diagonal and S is block upper
</span><span class="comment">*</span><span class="comment"> triangular with 1-by-1 and 2-by-2 blocks. 1-by-1 blocks correspond
</span><span class="comment">*</span><span class="comment"> to real generalized eigenvalues, while 2-by-2 blocks of S will be
</span><span class="comment">*</span><span class="comment"> "standardized" by making the corresponding elements of T have the
</span><span class="comment">*</span><span class="comment"> form:
</span><span class="comment">*</span><span class="comment"> [ a 0 ]
</span><span class="comment">*</span><span class="comment"> [ 0 b ]
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> and the pair of corresponding 2-by-2 blocks in S and T will have a
</span><span class="comment">*</span><span class="comment"> complex conjugate pair of generalized eigenvalues.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Arguments
</span><span class="comment">*</span><span class="comment"> =========
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> JOBVSL (input) CHARACTER*1
</span><span class="comment">*</span><span class="comment"> = 'N': do not compute the left Schur vectors;
</span><span class="comment">*</span><span class="comment"> = 'V': compute the left Schur vectors.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> JOBVSR (input) CHARACTER*1
</span><span class="comment">*</span><span class="comment"> = 'N': do not compute the right Schur vectors;
</span><span class="comment">*</span><span class="comment"> = 'V': compute the right Schur vectors.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> SORT (input) CHARACTER*1
</span><span class="comment">*</span><span class="comment"> Specifies whether or not to order the eigenvalues on the
</span><span class="comment">*</span><span class="comment"> diagonal of the generalized Schur form.
</span><span class="comment">*</span><span class="comment"> = 'N': Eigenvalues are not ordered;
</span><span class="comment">*</span><span class="comment"> = 'S': Eigenvalues are ordered (see SELCTG);
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> SELCTG (external procedure) LOGICAL FUNCTION of three REAL arguments
</span><span class="comment">*</span><span class="comment"> SELCTG must be declared EXTERNAL in the calling subroutine.
</span><span class="comment">*</span><span class="comment"> If SORT = 'N', SELCTG is not referenced.
</span><span class="comment">*</span><span class="comment"> If SORT = 'S', SELCTG is used to select eigenvalues to sort
</span><span class="comment">*</span><span class="comment"> to the top left of the Schur form.
</span><span class="comment">*</span><span class="comment"> An eigenvalue (ALPHAR(j)+ALPHAI(j))/BETA(j) is selected if
</span><span class="comment">*</span><span class="comment"> SELCTG(ALPHAR(j),ALPHAI(j),BETA(j)) is true; i.e. if either
</span><span class="comment">*</span><span class="comment"> one of a complex conjugate pair of eigenvalues is selected,
</span><span class="comment">*</span><span class="comment"> then both complex eigenvalues are selected.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Note that in the ill-conditioned case, a selected complex
</span><span class="comment">*</span><span class="comment"> eigenvalue may no longer satisfy SELCTG(ALPHAR(j),ALPHAI(j),
</span><span class="comment">*</span><span class="comment"> BETA(j)) = .TRUE. after ordering. INFO is to be set to N+2
</span><span class="comment">*</span><span class="comment"> in this case.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> N (input) INTEGER
</span><span class="comment">*</span><span class="comment"> The order of the matrices A, B, VSL, and VSR. N >= 0.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> A (input/output) REAL array, dimension (LDA, N)
</span><span class="comment">*</span><span class="comment"> On entry, the first of the pair of matrices.
</span><span class="comment">*</span><span class="comment"> On exit, A has been overwritten by its generalized Schur
</span><span class="comment">*</span><span class="comment"> form S.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> LDA (input) INTEGER
</span><span class="comment">*</span><span class="comment"> The leading dimension of A. LDA >= max(1,N).
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> B (input/output) REAL array, dimension (LDB, N)
</span><span class="comment">*</span><span class="comment"> On entry, the second of the pair of matrices.
</span><span class="comment">*</span><span class="comment"> On exit, B has been overwritten by its generalized Schur
</span><span class="comment">*</span><span class="comment"> form T.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> LDB (input) INTEGER
</span><span class="comment">*</span><span class="comment"> The leading dimension of B. LDB >= max(1,N).
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> SDIM (output) INTEGER
</span><span class="comment">*</span><span class="comment"> If SORT = 'N', SDIM = 0.
</span><span class="comment">*</span><span class="comment"> If SORT = 'S', SDIM = number of eigenvalues (after sorting)
</span><span class="comment">*</span><span class="comment"> for which SELCTG is true. (Complex conjugate pairs for which
</span><span class="comment">*</span><span class="comment"> SELCTG is true for either eigenvalue count as 2.)
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> ALPHAR (output) REAL array, dimension (N)
</span><span class="comment">*</span><span class="comment"> ALPHAI (output) REAL array, dimension (N)
</span><span class="comment">*</span><span class="comment"> BETA (output) REAL array, dimension (N)
</span><span class="comment">*</span><span class="comment"> On exit, (ALPHAR(j) + ALPHAI(j)*i)/BETA(j), j=1,...,N, will
</span><span class="comment">*</span><span class="comment"> be the generalized eigenvalues. ALPHAR(j) + ALPHAI(j)*i,
</span><span class="comment">*</span><span class="comment"> and BETA(j),j=1,...,N are the diagonals of the complex Schur
</span><span class="comment">*</span><span class="comment"> form (S,T) that would result if the 2-by-2 diagonal blocks of
</span><span class="comment">*</span><span class="comment"> the real Schur form of (A,B) were further reduced to
</span><span class="comment">*</span><span class="comment"> triangular form using 2-by-2 complex unitary transformations.
</span><span class="comment">*</span><span class="comment"> If ALPHAI(j) is zero, then the j-th eigenvalue is real; if
</span><span class="comment">*</span><span class="comment"> positive, then the j-th and (j+1)-st eigenvalues are a
</span><span class="comment">*</span><span class="comment"> complex conjugate pair, with ALPHAI(j+1) negative.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Note: the quotients ALPHAR(j)/BETA(j) and ALPHAI(j)/BETA(j)
</span><span class="comment">*</span><span class="comment"> may easily over- or underflow, and BETA(j) may even be zero.
</span><span class="comment">*</span><span class="comment"> Thus, the user should avoid naively computing the ratio.
</span><span class="comment">*</span><span class="comment"> However, ALPHAR and ALPHAI will be always less than and
</span><span class="comment">*</span><span class="comment"> usually comparable with norm(A) in magnitude, and BETA always
</span><span class="comment">*</span><span class="comment"> less than and usually comparable with norm(B).
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> VSL (output) REAL array, dimension (LDVSL,N)
</span><span class="comment">*</span><span class="comment"> If JOBVSL = 'V', VSL will contain the left Schur vectors.
</span><span class="comment">*</span><span class="comment"> Not referenced if JOBVSL = 'N'.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> LDVSL (input) INTEGER
</span><span class="comment">*</span><span class="comment"> The leading dimension of the matrix VSL. LDVSL >=1, and
</span><span class="comment">*</span><span class="comment"> if JOBVSL = 'V', LDVSL >= N.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> VSR (output) REAL array, dimension (LDVSR,N)
</span><span class="comment">*</span><span class="comment"> If JOBVSR = 'V', VSR will contain the right Schur vectors.
</span><span class="comment">*</span><span class="comment"> Not referenced if JOBVSR = 'N'.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> LDVSR (input) INTEGER
</span><span class="comment">*</span><span class="comment"> The leading dimension of the matrix VSR. LDVSR >= 1, and
</span><span class="comment">*</span><span class="comment"> if JOBVSR = 'V', LDVSR >= N.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> WORK (workspace/output) REAL array, dimension (MAX(1,LWORK))
</span><span class="comment">*</span><span class="comment"> On exit, if INFO = 0, WORK(1) returns the optimal LWORK.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> LWORK (input) INTEGER
</span><span class="comment">*</span><span class="comment"> The dimension of the array WORK.
</span><span class="comment">*</span><span class="comment"> If N = 0, LWORK >= 1, else LWORK >= max(8*N,6*N+16).
</span><span class="comment">*</span><span class="comment"> For good performance , LWORK must generally be larger.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> If LWORK = -1, then a workspace query is assumed; the routine
</span><span class="comment">*</span><span class="comment"> only calculates the optimal size of the WORK array, returns
</span><span class="comment">*</span><span class="comment"> this value as the first entry of the WORK array, and no error
</span><span class="comment">*</span><span class="comment"> message related to LWORK is issued by <a name="XERBLA.165"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> BWORK (workspace) LOGICAL array, dimension (N)
</span><span class="comment">*</span><span class="comment"> Not referenced if SORT = 'N'.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> INFO (output) INTEGER
</span><span class="comment">*</span><span class="comment"> = 0: successful exit
</span><span class="comment">*</span><span class="comment"> < 0: if INFO = -i, the i-th argument had an illegal value.
</span><span class="comment">*</span><span class="comment"> = 1,...,N:
</span><span class="comment">*</span><span class="comment"> The QZ iteration failed. (A,B) are not in Schur
</span><span class="comment">*</span><span class="comment"> form, but ALPHAR(j), ALPHAI(j), and BETA(j) should
</span><span class="comment">*</span><span class="comment"> be correct for j=INFO+1,...,N.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?