dgehd2.f.html
来自「famous linear algebra library (LAPACK) p」· HTML 代码 · 共 174 行
HTML
174 行
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>dgehd2.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="DGEHD2.1"></a><a href="dgehd2.f.html#DGEHD2.1">DGEHD2</a>( N, ILO, IHI, A, LDA, TAU, WORK, 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> INTEGER IHI, ILO, INFO, LDA, N
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Array Arguments ..
</span> DOUBLE PRECISION A( LDA, * ), TAU( * ), WORK( * )
<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="DGEHD2.17"></a><a href="dgehd2.f.html#DGEHD2.1">DGEHD2</a> reduces a real general matrix A to upper Hessenberg form H by
</span><span class="comment">*</span><span class="comment"> an orthogonal similarity transformation: Q' * A * Q = H .
</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"> N (input) INTEGER
</span><span class="comment">*</span><span class="comment"> The order of the matrix A. N >= 0.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> ILO (input) INTEGER
</span><span class="comment">*</span><span class="comment"> IHI (input) INTEGER
</span><span class="comment">*</span><span class="comment"> It is assumed that A is already upper triangular in rows
</span><span class="comment">*</span><span class="comment"> and columns 1:ILO-1 and IHI+1:N. ILO and IHI are normally
</span><span class="comment">*</span><span class="comment"> set by a previous call to <a name="DGEBAL.30"></a><a href="dgebal.f.html#DGEBAL.1">DGEBAL</a>; otherwise they should be
</span><span class="comment">*</span><span class="comment"> set to 1 and N respectively. See Further Details.
</span><span class="comment">*</span><span class="comment"> 1 <= ILO <= IHI <= max(1,N).
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> A (input/output) DOUBLE PRECISION array, dimension (LDA,N)
</span><span class="comment">*</span><span class="comment"> On entry, the n by n general matrix to be reduced.
</span><span class="comment">*</span><span class="comment"> On exit, the upper triangle and the first subdiagonal of A
</span><span class="comment">*</span><span class="comment"> are overwritten with the upper Hessenberg matrix H, and the
</span><span class="comment">*</span><span class="comment"> elements below the first subdiagonal, with the array TAU,
</span><span class="comment">*</span><span class="comment"> represent the orthogonal matrix Q as a product of elementary
</span><span class="comment">*</span><span class="comment"> reflectors. See Further Details.
</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 the array A. LDA >= max(1,N).
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> TAU (output) DOUBLE PRECISION array, dimension (N-1)
</span><span class="comment">*</span><span class="comment"> The scalar factors of the elementary reflectors (see Further
</span><span class="comment">*</span><span class="comment"> Details).
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> WORK (workspace) DOUBLE PRECISION array, dimension (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"> Further Details
</span><span class="comment">*</span><span class="comment"> ===============
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> The matrix Q is represented as a product of (ihi-ilo) elementary
</span><span class="comment">*</span><span class="comment"> reflectors
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Q = H(ilo) H(ilo+1) . . . H(ihi-1).
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Each H(i) has the form
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> H(i) = I - tau * v * v'
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> where tau is a real scalar, and v is a real vector with
</span><span class="comment">*</span><span class="comment"> v(1:i) = 0, v(i+1) = 1 and v(ihi+1:n) = 0; v(i+2:ihi) is stored on
</span><span class="comment">*</span><span class="comment"> exit in A(i+2:ihi,i), and tau in TAU(i).
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> The contents of A are illustrated by the following example, with
</span><span class="comment">*</span><span class="comment"> n = 7, ilo = 2 and ihi = 6:
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> on entry, on exit,
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> ( a a a a a a a ) ( a a h h h h a )
</span><span class="comment">*</span><span class="comment"> ( a a a a a a ) ( a h h h h a )
</span><span class="comment">*</span><span class="comment"> ( a a a a a a ) ( h h h h h h )
</span><span class="comment">*</span><span class="comment"> ( a a a a a a ) ( v2 h h h h h )
</span><span class="comment">*</span><span class="comment"> ( a a a a a a ) ( v2 v3 h h h h )
</span><span class="comment">*</span><span class="comment"> ( a a a a a a ) ( v2 v3 v4 h h h )
</span><span class="comment">*</span><span class="comment"> ( a ) ( a )
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> where a denotes an element of the original matrix A, h denotes a
</span><span class="comment">*</span><span class="comment"> modified element of the upper Hessenberg matrix H, and vi denotes an
</span><span class="comment">*</span><span class="comment"> element of the vector defining H(i).
</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"> .. Parameters ..
</span> DOUBLE PRECISION ONE
PARAMETER ( ONE = 1.0D+0 )
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Local Scalars ..
</span> INTEGER I
DOUBLE PRECISION AII
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. External Subroutines ..
</span> EXTERNAL <a name="DLARF.99"></a><a href="dlarf.f.html#DLARF.1">DLARF</a>, <a name="DLARFG.99"></a><a href="dlarfg.f.html#DLARFG.1">DLARFG</a>, <a name="XERBLA.99"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>
<span class="comment">*</span><span class="comment"> ..
</span><span class="comment">*</span><span class="comment"> .. Intrinsic Functions ..
</span> INTRINSIC MAX, MIN
<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"> Test the input parameters
</span><span class="comment">*</span><span class="comment">
</span> INFO = 0
IF( N.LT.0 ) THEN
INFO = -1
ELSE IF( ILO.LT.1 .OR. ILO.GT.MAX( 1, N ) ) THEN
INFO = -2
ELSE IF( IHI.LT.MIN( ILO, N ) .OR. IHI.GT.N ) THEN
INFO = -3
ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
INFO = -5
END IF
IF( INFO.NE.0 ) THEN
CALL <a name="XERBLA.119"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>( <span class="string">'<a name="DGEHD2.119"></a><a href="dgehd2.f.html#DGEHD2.1">DGEHD2</a>'</span>, -INFO )
RETURN
END IF
<span class="comment">*</span><span class="comment">
</span> DO 10 I = ILO, IHI - 1
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Compute elementary reflector H(i) to annihilate A(i+2:ihi,i)
</span><span class="comment">*</span><span class="comment">
</span> CALL <a name="DLARFG.127"></a><a href="dlarfg.f.html#DLARFG.1">DLARFG</a>( IHI-I, A( I+1, I ), A( MIN( I+2, N ), I ), 1,
$ TAU( I ) )
AII = A( I+1, I )
A( I+1, I ) = ONE
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Apply H(i) to A(1:ihi,i+1:ihi) from the right
</span><span class="comment">*</span><span class="comment">
</span> CALL <a name="DLARF.134"></a><a href="dlarf.f.html#DLARF.1">DLARF</a>( <span class="string">'Right'</span>, IHI, IHI-I, A( I+1, I ), 1, TAU( I ),
$ A( 1, I+1 ), LDA, WORK )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment"> Apply H(i) to A(i+1:ihi,i+1:n) from the left
</span><span class="comment">*</span><span class="comment">
</span> CALL <a name="DLARF.139"></a><a href="dlarf.f.html#DLARF.1">DLARF</a>( <span class="string">'Left'</span>, IHI-I, N-I, A( I+1, I ), 1, TAU( I ),
$ A( I+1, I+1 ), LDA, WORK )
<span class="comment">*</span><span class="comment">
</span> A( I+1, I ) = AII
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="DGEHD2.147"></a><a href="dgehd2.f.html#DGEHD2.1">DGEHD2</a>
</span><span class="comment">*</span><span class="comment">
</span> END
</pre>
</body>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?