![]() |
LAPACK
3.4.1
LAPACK: Linear Algebra PACKage
|
00001 *> \brief \b SGEHD2 00002 * 00003 * =========== DOCUMENTATION =========== 00004 * 00005 * Online html documentation available at 00006 * http://www.netlib.org/lapack/explore-html/ 00007 * 00008 *> \htmlonly 00009 *> Download SGEHD2 + dependencies 00010 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/sgehd2.f"> 00011 *> [TGZ]</a> 00012 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/sgehd2.f"> 00013 *> [ZIP]</a> 00014 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/sgehd2.f"> 00015 *> [TXT]</a> 00016 *> \endhtmlonly 00017 * 00018 * Definition: 00019 * =========== 00020 * 00021 * SUBROUTINE SGEHD2( N, ILO, IHI, A, LDA, TAU, WORK, INFO ) 00022 * 00023 * .. Scalar Arguments .. 00024 * INTEGER IHI, ILO, INFO, LDA, N 00025 * .. 00026 * .. Array Arguments .. 00027 * REAL A( LDA, * ), TAU( * ), WORK( * ) 00028 * .. 00029 * 00030 * 00031 *> \par Purpose: 00032 * ============= 00033 *> 00034 *> \verbatim 00035 *> 00036 *> SGEHD2 reduces a real general matrix A to upper Hessenberg form H by 00037 *> an orthogonal similarity transformation: Q**T * A * Q = H . 00038 *> \endverbatim 00039 * 00040 * Arguments: 00041 * ========== 00042 * 00043 *> \param[in] N 00044 *> \verbatim 00045 *> N is INTEGER 00046 *> The order of the matrix A. N >= 0. 00047 *> \endverbatim 00048 *> 00049 *> \param[in] ILO 00050 *> \verbatim 00051 *> ILO is INTEGER 00052 *> \endverbatim 00053 *> 00054 *> \param[in] IHI 00055 *> \verbatim 00056 *> IHI is INTEGER 00057 *> 00058 *> It is assumed that A is already upper triangular in rows 00059 *> and columns 1:ILO-1 and IHI+1:N. ILO and IHI are normally 00060 *> set by a previous call to SGEBAL; otherwise they should be 00061 *> set to 1 and N respectively. See Further Details. 00062 *> 1 <= ILO <= IHI <= max(1,N). 00063 *> \endverbatim 00064 *> 00065 *> \param[in,out] A 00066 *> \verbatim 00067 *> A is REAL array, dimension (LDA,N) 00068 *> On entry, the n by n general matrix to be reduced. 00069 *> On exit, the upper triangle and the first subdiagonal of A 00070 *> are overwritten with the upper Hessenberg matrix H, and the 00071 *> elements below the first subdiagonal, with the array TAU, 00072 *> represent the orthogonal matrix Q as a product of elementary 00073 *> reflectors. See Further Details. 00074 *> \endverbatim 00075 *> 00076 *> \param[in] LDA 00077 *> \verbatim 00078 *> LDA is INTEGER 00079 *> The leading dimension of the array A. LDA >= max(1,N). 00080 *> \endverbatim 00081 *> 00082 *> \param[out] TAU 00083 *> \verbatim 00084 *> TAU is REAL array, dimension (N-1) 00085 *> The scalar factors of the elementary reflectors (see Further 00086 *> Details). 00087 *> \endverbatim 00088 *> 00089 *> \param[out] WORK 00090 *> \verbatim 00091 *> WORK is REAL array, dimension (N) 00092 *> \endverbatim 00093 *> 00094 *> \param[out] INFO 00095 *> \verbatim 00096 *> INFO is INTEGER 00097 *> = 0: successful exit. 00098 *> < 0: if INFO = -i, the i-th argument had an illegal value. 00099 *> \endverbatim 00100 * 00101 * Authors: 00102 * ======== 00103 * 00104 *> \author Univ. of Tennessee 00105 *> \author Univ. of California Berkeley 00106 *> \author Univ. of Colorado Denver 00107 *> \author NAG Ltd. 00108 * 00109 *> \date November 2011 00110 * 00111 *> \ingroup realGEcomputational 00112 * 00113 *> \par Further Details: 00114 * ===================== 00115 *> 00116 *> \verbatim 00117 *> 00118 *> The matrix Q is represented as a product of (ihi-ilo) elementary 00119 *> reflectors 00120 *> 00121 *> Q = H(ilo) H(ilo+1) . . . H(ihi-1). 00122 *> 00123 *> Each H(i) has the form 00124 *> 00125 *> H(i) = I - tau * v * v**T 00126 *> 00127 *> where tau is a real scalar, and v is a real vector with 00128 *> v(1:i) = 0, v(i+1) = 1 and v(ihi+1:n) = 0; v(i+2:ihi) is stored on 00129 *> exit in A(i+2:ihi,i), and tau in TAU(i). 00130 *> 00131 *> The contents of A are illustrated by the following example, with 00132 *> n = 7, ilo = 2 and ihi = 6: 00133 *> 00134 *> on entry, on exit, 00135 *> 00136 *> ( a a a a a a a ) ( a a h h h h a ) 00137 *> ( a a a a a a ) ( a h h h h a ) 00138 *> ( a a a a a a ) ( h h h h h h ) 00139 *> ( a a a a a a ) ( v2 h h h h h ) 00140 *> ( a a a a a a ) ( v2 v3 h h h h ) 00141 *> ( a a a a a a ) ( v2 v3 v4 h h h ) 00142 *> ( a ) ( a ) 00143 *> 00144 *> where a denotes an element of the original matrix A, h denotes a 00145 *> modified element of the upper Hessenberg matrix H, and vi denotes an 00146 *> element of the vector defining H(i). 00147 *> \endverbatim 00148 *> 00149 * ===================================================================== 00150 SUBROUTINE SGEHD2( N, ILO, IHI, A, LDA, TAU, WORK, INFO ) 00151 * 00152 * -- LAPACK computational routine (version 3.4.0) -- 00153 * -- LAPACK is a software package provided by Univ. of Tennessee, -- 00154 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- 00155 * November 2011 00156 * 00157 * .. Scalar Arguments .. 00158 INTEGER IHI, ILO, INFO, LDA, N 00159 * .. 00160 * .. Array Arguments .. 00161 REAL A( LDA, * ), TAU( * ), WORK( * ) 00162 * .. 00163 * 00164 * ===================================================================== 00165 * 00166 * .. Parameters .. 00167 REAL ONE 00168 PARAMETER ( ONE = 1.0E+0 ) 00169 * .. 00170 * .. Local Scalars .. 00171 INTEGER I 00172 REAL AII 00173 * .. 00174 * .. External Subroutines .. 00175 EXTERNAL SLARF, SLARFG, XERBLA 00176 * .. 00177 * .. Intrinsic Functions .. 00178 INTRINSIC MAX, MIN 00179 * .. 00180 * .. Executable Statements .. 00181 * 00182 * Test the input parameters 00183 * 00184 INFO = 0 00185 IF( N.LT.0 ) THEN 00186 INFO = -1 00187 ELSE IF( ILO.LT.1 .OR. ILO.GT.MAX( 1, N ) ) THEN 00188 INFO = -2 00189 ELSE IF( IHI.LT.MIN( ILO, N ) .OR. IHI.GT.N ) THEN 00190 INFO = -3 00191 ELSE IF( LDA.LT.MAX( 1, N ) ) THEN 00192 INFO = -5 00193 END IF 00194 IF( INFO.NE.0 ) THEN 00195 CALL XERBLA( 'SGEHD2', -INFO ) 00196 RETURN 00197 END IF 00198 * 00199 DO 10 I = ILO, IHI - 1 00200 * 00201 * Compute elementary reflector H(i) to annihilate A(i+2:ihi,i) 00202 * 00203 CALL SLARFG( IHI-I, A( I+1, I ), A( MIN( I+2, N ), I ), 1, 00204 $ TAU( I ) ) 00205 AII = A( I+1, I ) 00206 A( I+1, I ) = ONE 00207 * 00208 * Apply H(i) to A(1:ihi,i+1:ihi) from the right 00209 * 00210 CALL SLARF( 'Right', IHI, IHI-I, A( I+1, I ), 1, TAU( I ), 00211 $ A( 1, I+1 ), LDA, WORK ) 00212 * 00213 * Apply H(i) to A(i+1:ihi,i+1:n) from the left 00214 * 00215 CALL SLARF( 'Left', IHI-I, N-I, A( I+1, I ), 1, TAU( I ), 00216 $ A( I+1, I+1 ), LDA, WORK ) 00217 * 00218 A( I+1, I ) = AII 00219 10 CONTINUE 00220 * 00221 RETURN 00222 * 00223 * End of SGEHD2 00224 * 00225 END