ztrexc.f.html
来自「famous linear algebra library (LAPACK) p」· HTML 代码 · 共 187 行
HTML
187 行
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>ztrexc.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="ZTREXC.1"></a><a href="ztrexc.f.html#ZTREXC.1">ZTREXC</a>( COMPQ, N, T, LDT, Q, LDQ, IFST, ILST, INFO )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> -- LAPACK 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 COMPQ
INTEGER IFST, ILST, INFO, LDQ, LDT, N
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Array Arguments ..
</span> COMPLEX*16 Q( LDQ, * ), T( LDT, * )
<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="ZTREXC.18"></a><a href="ztrexc.f.html#ZTREXC.1">ZTREXC</a> reorders the Schur factorization of a complex matrix
</span><span class="comment">*</span><span class="comment"> A = Q*T*Q**H, so that the diagonal element of T with row index IFST
</span><span class="comment">*</span><span class="comment"> is moved to row ILST.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> The Schur form T is reordered by a unitary similarity transformation
</span><span class="comment">*</span><span class="comment"> Z**H*T*Z, and optionally the matrix Q of Schur vectors is updated by
</span><span class="comment">*</span><span class="comment"> postmultplying it with Z.
</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"> COMPQ (input) CHARACTER*1
</span><span class="comment">*</span><span class="comment"> = 'V': update the matrix Q of Schur vectors;
</span><span class="comment">*</span><span class="comment"> = 'N': do not update Q.
</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 matrix T. N >= 0.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> T (input/output) COMPLEX*16 array, dimension (LDT,N)
</span><span class="comment">*</span><span class="comment"> On entry, the upper triangular matrix T.
</span><span class="comment">*</span><span class="comment"> On exit, the reordered upper triangular matrix.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> LDT (input) INTEGER
</span><span class="comment">*</span><span class="comment"> The leading dimension of the array T. LDT >= max(1,N).
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Q (input/output) COMPLEX*16 array, dimension (LDQ,N)
</span><span class="comment">*</span><span class="comment"> On entry, if COMPQ = 'V', the matrix Q of Schur vectors.
</span><span class="comment">*</span><span class="comment"> On exit, if COMPQ = 'V', Q has been postmultiplied by the
</span><span class="comment">*</span><span class="comment"> unitary transformation matrix Z which reorders T.
</span><span class="comment">*</span><span class="comment"> If COMPQ = 'N', Q is not referenced.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> LDQ (input) INTEGER
</span><span class="comment">*</span><span class="comment"> The leading dimension of the array Q. LDQ >= max(1,N).
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> IFST (input) INTEGER
</span><span class="comment">*</span><span class="comment"> ILST (input) INTEGER
</span><span class="comment">*</span><span class="comment"> Specify the reordering of the diagonal elements of T:
</span><span class="comment">*</span><span class="comment"> The element with row index IFST is moved to row ILST by a
</span><span class="comment">*</span><span class="comment"> sequence of transpositions between adjacent elements.
</span><span class="comment">*</span><span class="comment"> 1 <= IFST <= N; 1 <= ILST <= 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">
</span><span class="comment">*</span><span class="comment"> =====================================================================
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> .. Local Scalars ..
</span> LOGICAL WANTQ
INTEGER K, M1, M2, M3
DOUBLE PRECISION CS
COMPLEX*16 SN, T11, T22, TEMP
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. External Functions ..
</span> LOGICAL <a name="LSAME.72"></a><a href="lsame.f.html#LSAME.1">LSAME</a>
EXTERNAL <a name="LSAME.73"></a><a href="lsame.f.html#LSAME.1">LSAME</a>
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. External Subroutines ..
</span> EXTERNAL <a name="XERBLA.76"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>, <a name="ZLARTG.76"></a><a href="zlartg.f.html#ZLARTG.1">ZLARTG</a>, <a name="ZROT.76"></a><a href="zrot.f.html#ZROT.1">ZROT</a>
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Intrinsic Functions ..
</span> INTRINSIC DCONJG, MAX
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Executable Statements ..
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Decode and test the input parameters.
</span><span class="comment">*</span><span class="comment">
</span> INFO = 0
WANTQ = <a name="LSAME.86"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( COMPQ, <span class="string">'V'</span> )
IF( .NOT.<a name="LSAME.87"></a><a href="lsame.f.html#LSAME.1">LSAME</a>( COMPQ, <span class="string">'N'</span> ) .AND. .NOT.WANTQ ) THEN
INFO = -1
ELSE IF( N.LT.0 ) THEN
INFO = -2
ELSE IF( LDT.LT.MAX( 1, N ) ) THEN
INFO = -4
ELSE IF( LDQ.LT.1 .OR. ( WANTQ .AND. LDQ.LT.MAX( 1, N ) ) ) THEN
INFO = -6
ELSE IF( IFST.LT.1 .OR. IFST.GT.N ) THEN
INFO = -7
ELSE IF( ILST.LT.1 .OR. ILST.GT.N ) THEN
INFO = -8
END IF
IF( INFO.NE.0 ) THEN
CALL <a name="XERBLA.101"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>( <span class="string">'<a name="ZTREXC.101"></a><a href="ztrexc.f.html#ZTREXC.1">ZTREXC</a>'</span>, -INFO )
RETURN
END IF
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Quick return if possible
</span><span class="comment">*</span><span class="comment">
</span> IF( N.EQ.1 .OR. IFST.EQ.ILST )
$ RETURN
<span class="comment">*</span><span class="comment">
</span> IF( IFST.LT.ILST ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Move the IFST-th diagonal element forward down the diagonal.
</span><span class="comment">*</span><span class="comment">
</span> M1 = 0
M2 = -1
M3 = 1
ELSE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Move the IFST-th diagonal element backward up the diagonal.
</span><span class="comment">*</span><span class="comment">
</span> M1 = -1
M2 = 0
M3 = -1
END IF
<span class="comment">*</span><span class="comment">
</span> DO 10 K = IFST + M1, ILST + M2, M3
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Interchange the k-th and (k+1)-th diagonal elements.
</span><span class="comment">*</span><span class="comment">
</span> T11 = T( K, K )
T22 = T( K+1, K+1 )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Determine the transformation to perform the interchange.
</span><span class="comment">*</span><span class="comment">
</span> CALL <a name="ZLARTG.135"></a><a href="zlartg.f.html#ZLARTG.1">ZLARTG</a>( T( K, K+1 ), T22-T11, CS, SN, TEMP )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Apply transformation to the matrix T.
</span><span class="comment">*</span><span class="comment">
</span> IF( K+2.LE.N )
$ CALL <a name="ZROT.140"></a><a href="zrot.f.html#ZROT.1">ZROT</a>( N-K-1, T( K, K+2 ), LDT, T( K+1, K+2 ), LDT, CS,
$ SN )
CALL <a name="ZROT.142"></a><a href="zrot.f.html#ZROT.1">ZROT</a>( K-1, T( 1, K ), 1, T( 1, K+1 ), 1, CS,
$ DCONJG( SN ) )
<span class="comment">*</span><span class="comment">
</span> T( K, K ) = T22
T( K+1, K+1 ) = T11
<span class="comment">*</span><span class="comment">
</span> IF( WANTQ ) THEN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Accumulate transformation in the matrix Q.
</span><span class="comment">*</span><span class="comment">
</span> CALL <a name="ZROT.152"></a><a href="zrot.f.html#ZROT.1">ZROT</a>( N, Q( 1, K ), 1, Q( 1, K+1 ), 1, CS,
$ DCONJG( SN ) )
END IF
<span class="comment">*</span><span class="comment">
</span> 10 CONTINUE
<span class="comment">*</span><span class="comment">
</span> RETURN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> End of <a name="ZTREXC.160"></a><a href="ztrexc.f.html#ZTREXC.1">ZTREXC</a>
</span><span class="comment">*</span><span class="comment">
</span> END
</pre>
</body>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?