00001 SUBROUTINE ZLAGGE( M, N, KL, KU, D, A, LDA, ISEED, WORK, INFO )
00002
00003
00004
00005
00006
00007
00008 INTEGER INFO, KL, KU, LDA, M, N
00009
00010
00011 INTEGER ISEED( 4 )
00012 DOUBLE PRECISION D( * )
00013 COMPLEX*16 A( LDA, * ), WORK( * )
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065 COMPLEX*16 ZERO, ONE
00066 PARAMETER ( ZERO = ( 0.0D+0, 0.0D+0 ),
00067 $ ONE = ( 1.0D+0, 0.0D+0 ) )
00068
00069
00070 INTEGER I, J
00071 DOUBLE PRECISION WN
00072 COMPLEX*16 TAU, WA, WB
00073
00074
00075 EXTERNAL XERBLA, ZGEMV, ZGERC, ZLACGV, ZLARNV, ZSCAL
00076
00077
00078 INTRINSIC ABS, DBLE, MAX, MIN
00079
00080
00081 DOUBLE PRECISION DZNRM2
00082 EXTERNAL DZNRM2
00083
00084
00085
00086
00087
00088 INFO = 0
00089 IF( M.LT.0 ) THEN
00090 INFO = -1
00091 ELSE IF( N.LT.0 ) THEN
00092 INFO = -2
00093 ELSE IF( KL.LT.0 .OR. KL.GT.M-1 ) THEN
00094 INFO = -3
00095 ELSE IF( KU.LT.0 .OR. KU.GT.N-1 ) THEN
00096 INFO = -4
00097 ELSE IF( LDA.LT.MAX( 1, M ) ) THEN
00098 INFO = -7
00099 END IF
00100 IF( INFO.LT.0 ) THEN
00101 CALL XERBLA( 'ZLAGGE', -INFO )
00102 RETURN
00103 END IF
00104
00105
00106
00107 DO 20 J = 1, N
00108 DO 10 I = 1, M
00109 A( I, J ) = ZERO
00110 10 CONTINUE
00111 20 CONTINUE
00112 DO 30 I = 1, MIN( M, N )
00113 A( I, I ) = D( I )
00114 30 CONTINUE
00115
00116
00117
00118 DO 40 I = MIN( M, N ), 1, -1
00119 IF( I.LT.M ) THEN
00120
00121
00122
00123 CALL ZLARNV( 3, ISEED, M-I+1, WORK )
00124 WN = DZNRM2( M-I+1, WORK, 1 )
00125 WA = ( WN / ABS( WORK( 1 ) ) )*WORK( 1 )
00126 IF( WN.EQ.ZERO ) THEN
00127 TAU = ZERO
00128 ELSE
00129 WB = WORK( 1 ) + WA
00130 CALL ZSCAL( M-I, ONE / WB, WORK( 2 ), 1 )
00131 WORK( 1 ) = ONE
00132 TAU = DBLE( WB / WA )
00133 END IF
00134
00135
00136
00137 CALL ZGEMV( 'Conjugate transpose', M-I+1, N-I+1, ONE,
00138 $ A( I, I ), LDA, WORK, 1, ZERO, WORK( M+1 ), 1 )
00139 CALL ZGERC( M-I+1, N-I+1, -TAU, WORK, 1, WORK( M+1 ), 1,
00140 $ A( I, I ), LDA )
00141 END IF
00142 IF( I.LT.N ) THEN
00143
00144
00145
00146 CALL ZLARNV( 3, ISEED, N-I+1, WORK )
00147 WN = DZNRM2( N-I+1, WORK, 1 )
00148 WA = ( WN / ABS( WORK( 1 ) ) )*WORK( 1 )
00149 IF( WN.EQ.ZERO ) THEN
00150 TAU = ZERO
00151 ELSE
00152 WB = WORK( 1 ) + WA
00153 CALL ZSCAL( N-I, ONE / WB, WORK( 2 ), 1 )
00154 WORK( 1 ) = ONE
00155 TAU = DBLE( WB / WA )
00156 END IF
00157
00158
00159
00160 CALL ZGEMV( 'No transpose', M-I+1, N-I+1, ONE, A( I, I ),
00161 $ LDA, WORK, 1, ZERO, WORK( N+1 ), 1 )
00162 CALL ZGERC( M-I+1, N-I+1, -TAU, WORK( N+1 ), 1, WORK, 1,
00163 $ A( I, I ), LDA )
00164 END IF
00165 40 CONTINUE
00166
00167
00168
00169
00170 DO 70 I = 1, MAX( M-1-KL, N-1-KU )
00171 IF( KL.LE.KU ) THEN
00172
00173
00174
00175 IF( I.LE.MIN( M-1-KL, N ) ) THEN
00176
00177
00178
00179 WN = DZNRM2( M-KL-I+1, A( KL+I, I ), 1 )
00180 WA = ( WN / ABS( A( KL+I, I ) ) )*A( KL+I, I )
00181 IF( WN.EQ.ZERO ) THEN
00182 TAU = ZERO
00183 ELSE
00184 WB = A( KL+I, I ) + WA
00185 CALL ZSCAL( M-KL-I, ONE / WB, A( KL+I+1, I ), 1 )
00186 A( KL+I, I ) = ONE
00187 TAU = DBLE( WB / WA )
00188 END IF
00189
00190
00191
00192 CALL ZGEMV( 'Conjugate transpose', M-KL-I+1, N-I, ONE,
00193 $ A( KL+I, I+1 ), LDA, A( KL+I, I ), 1, ZERO,
00194 $ WORK, 1 )
00195 CALL ZGERC( M-KL-I+1, N-I, -TAU, A( KL+I, I ), 1, WORK,
00196 $ 1, A( KL+I, I+1 ), LDA )
00197 A( KL+I, I ) = -WA
00198 END IF
00199
00200 IF( I.LE.MIN( N-1-KU, M ) ) THEN
00201
00202
00203
00204 WN = DZNRM2( N-KU-I+1, A( I, KU+I ), LDA )
00205 WA = ( WN / ABS( A( I, KU+I ) ) )*A( I, KU+I )
00206 IF( WN.EQ.ZERO ) THEN
00207 TAU = ZERO
00208 ELSE
00209 WB = A( I, KU+I ) + WA
00210 CALL ZSCAL( N-KU-I, ONE / WB, A( I, KU+I+1 ), LDA )
00211 A( I, KU+I ) = ONE
00212 TAU = DBLE( WB / WA )
00213 END IF
00214
00215
00216
00217 CALL ZLACGV( N-KU-I+1, A( I, KU+I ), LDA )
00218 CALL ZGEMV( 'No transpose', M-I, N-KU-I+1, ONE,
00219 $ A( I+1, KU+I ), LDA, A( I, KU+I ), LDA, ZERO,
00220 $ WORK, 1 )
00221 CALL ZGERC( M-I, N-KU-I+1, -TAU, WORK, 1, A( I, KU+I ),
00222 $ LDA, A( I+1, KU+I ), LDA )
00223 A( I, KU+I ) = -WA
00224 END IF
00225 ELSE
00226
00227
00228
00229
00230 IF( I.LE.MIN( N-1-KU, M ) ) THEN
00231
00232
00233
00234 WN = DZNRM2( N-KU-I+1, A( I, KU+I ), LDA )
00235 WA = ( WN / ABS( A( I, KU+I ) ) )*A( I, KU+I )
00236 IF( WN.EQ.ZERO ) THEN
00237 TAU = ZERO
00238 ELSE
00239 WB = A( I, KU+I ) + WA
00240 CALL ZSCAL( N-KU-I, ONE / WB, A( I, KU+I+1 ), LDA )
00241 A( I, KU+I ) = ONE
00242 TAU = DBLE( WB / WA )
00243 END IF
00244
00245
00246
00247 CALL ZLACGV( N-KU-I+1, A( I, KU+I ), LDA )
00248 CALL ZGEMV( 'No transpose', M-I, N-KU-I+1, ONE,
00249 $ A( I+1, KU+I ), LDA, A( I, KU+I ), LDA, ZERO,
00250 $ WORK, 1 )
00251 CALL ZGERC( M-I, N-KU-I+1, -TAU, WORK, 1, A( I, KU+I ),
00252 $ LDA, A( I+1, KU+I ), LDA )
00253 A( I, KU+I ) = -WA
00254 END IF
00255
00256 IF( I.LE.MIN( M-1-KL, N ) ) THEN
00257
00258
00259
00260 WN = DZNRM2( M-KL-I+1, A( KL+I, I ), 1 )
00261 WA = ( WN / ABS( A( KL+I, I ) ) )*A( KL+I, I )
00262 IF( WN.EQ.ZERO ) THEN
00263 TAU = ZERO
00264 ELSE
00265 WB = A( KL+I, I ) + WA
00266 CALL ZSCAL( M-KL-I, ONE / WB, A( KL+I+1, I ), 1 )
00267 A( KL+I, I ) = ONE
00268 TAU = DBLE( WB / WA )
00269 END IF
00270
00271
00272
00273 CALL ZGEMV( 'Conjugate transpose', M-KL-I+1, N-I, ONE,
00274 $ A( KL+I, I+1 ), LDA, A( KL+I, I ), 1, ZERO,
00275 $ WORK, 1 )
00276 CALL ZGERC( M-KL-I+1, N-I, -TAU, A( KL+I, I ), 1, WORK,
00277 $ 1, A( KL+I, I+1 ), LDA )
00278 A( KL+I, I ) = -WA
00279 END IF
00280 END IF
00281
00282 DO 50 J = KL + I + 1, M
00283 A( J, I ) = ZERO
00284 50 CONTINUE
00285
00286 DO 60 J = KU + I + 1, N
00287 A( I, J ) = ZERO
00288 60 CONTINUE
00289 70 CONTINUE
00290 RETURN
00291
00292
00293
00294 END