113 SUBROUTINE zhetri( UPLO, N, A, LDA, IPIV, WORK, INFO )
125 COMPLEX*16 A( LDA, * ), WORK( * )
132 COMPLEX*16 CONE, ZERO
133 parameter( one = 1.0d+0, cone = ( 1.0d+0, 0.0d+0 ),
134 $ zero = ( 0.0d+0, 0.0d+0 ) )
138 INTEGER J, K, KP, KSTEP
139 DOUBLE PRECISION AK, AKP1, D, T
140 COMPLEX*16 AKKP1, TEMP
145 EXTERNAL lsame, zdotc
151 INTRINSIC abs, dble, dconjg, max
158 upper = lsame( uplo,
'U' )
159 IF( .NOT.upper .AND. .NOT.lsame( uplo,
'L' ) )
THEN
161 ELSE IF( n.LT.0 )
THEN
163 ELSE IF( lda.LT.max( 1, n ) )
THEN
167 CALL xerbla(
'ZHETRI', -info )
182 DO 10 info = n, 1, -1
183 IF( ipiv( info ).GT.0 .AND. a( info, info ).EQ.zero )
191 IF( ipiv( info ).GT.0 .AND. a( info, info ).EQ.zero )
212 IF( ipiv( k ).GT.0 )
THEN
218 a( k, k ) = one / dble( a( k, k ) )
223 CALL zcopy( k-1, a( 1, k ), 1, work, 1 )
224 CALL zhemv( uplo, k-1, -cone, a, lda, work, 1, zero,
226 a( k, k ) = a( k, k ) - dble( zdotc( k-1, work, 1, a( 1,
236 t = abs( a( k, k+1 ) )
237 ak = dble( a( k, k ) ) / t
238 akp1 = dble( a( k+1, k+1 ) ) / t
239 akkp1 = a( k, k+1 ) / t
240 d = t*( ak*akp1-one )
242 a( k+1, k+1 ) = ak / d
243 a( k, k+1 ) = -akkp1 / d
248 CALL zcopy( k-1, a( 1, k ), 1, work, 1 )
249 CALL zhemv( uplo, k-1, -cone, a, lda, work, 1, zero,
251 a( k, k ) = a( k, k ) - dble( zdotc( k-1, work, 1, a( 1,
253 a( k, k+1 ) = a( k, k+1 ) -
254 $ zdotc( k-1, a( 1, k ), 1, a( 1, k+1 ), 1 )
255 CALL zcopy( k-1, a( 1, k+1 ), 1, work, 1 )
256 CALL zhemv( uplo, k-1, -cone, a, lda, work, 1, zero,
258 a( k+1, k+1 ) = a( k+1, k+1 ) -
259 $ dble( zdotc( k-1, work, 1, a( 1, k+1 ),
265 kp = abs( ipiv( k ) )
271 CALL zswap( kp-1, a( 1, k ), 1, a( 1, kp ), 1 )
272 DO 40 j = kp + 1, k - 1
273 temp = dconjg( a( j, k ) )
274 a( j, k ) = dconjg( a( kp, j ) )
277 a( kp, k ) = dconjg( a( kp, k ) )
279 a( k, k ) = a( kp, kp )
281 IF( kstep.EQ.2 )
THEN
283 a( k, k+1 ) = a( kp, k+1 )
307 IF( ipiv( k ).GT.0 )
THEN
313 a( k, k ) = one / dble( a( k, k ) )
318 CALL zcopy( n-k, a( k+1, k ), 1, work, 1 )
319 CALL zhemv( uplo, n-k, -cone, a( k+1, k+1 ), lda, work,
320 $ 1, zero, a( k+1, k ), 1 )
321 a( k, k ) = a( k, k ) - dble( zdotc( n-k, work, 1,
331 t = abs( a( k, k-1 ) )
332 ak = dble( a( k-1, k-1 ) ) / t
333 akp1 = dble( a( k, k ) ) / t
334 akkp1 = a( k, k-1 ) / t
335 d = t*( ak*akp1-one )
336 a( k-1, k-1 ) = akp1 / d
338 a( k, k-1 ) = -akkp1 / d
343 CALL zcopy( n-k, a( k+1, k ), 1, work, 1 )
344 CALL zhemv( uplo, n-k, -cone, a( k+1, k+1 ), lda, work,
345 $ 1, zero, a( k+1, k ), 1 )
346 a( k, k ) = a( k, k ) - dble( zdotc( n-k, work, 1,
348 a( k, k-1 ) = a( k, k-1 ) -
349 $ zdotc( n-k, a( k+1, k ), 1, a( k+1, k-1 ),
351 CALL zcopy( n-k, a( k+1, k-1 ), 1, work, 1 )
352 CALL zhemv( uplo, n-k, -cone, a( k+1, k+1 ), lda, work,
353 $ 1, zero, a( k+1, k-1 ), 1 )
354 a( k-1, k-1 ) = a( k-1, k-1 ) -
355 $ dble( zdotc( n-k, work, 1, a( k+1, k-1 ),
361 kp = abs( ipiv( k ) )
368 $
CALL zswap( n-kp, a( kp+1, k ), 1, a( kp+1, kp ), 1 )
369 DO 70 j = k + 1, kp - 1
370 temp = dconjg( a( j, k ) )
371 a( j, k ) = dconjg( a( kp, j ) )
374 a( kp, k ) = dconjg( a( kp, k ) )
376 a( k, k ) = a( kp, kp )
378 IF( kstep.EQ.2 )
THEN
380 a( k, k-1 ) = a( kp, k-1 )
subroutine xerbla(srname, info)
subroutine zcopy(n, zx, incx, zy, incy)
ZCOPY
subroutine zhemv(uplo, n, alpha, a, lda, x, incx, beta, y, incy)
ZHEMV
subroutine zhetri(uplo, n, a, lda, ipiv, work, info)
ZHETRI
subroutine zswap(n, zx, incx, zy, incy)
ZSWAP