108 SUBROUTINE zhptri( UPLO, N, AP, IPIV, WORK, INFO )
120 COMPLEX*16 AP( * ), WORK( * )
127 COMPLEX*16 CONE, ZERO
128 parameter( one = 1.0d+0, cone = ( 1.0d+0, 0.0d+0 ),
129 $ zero = ( 0.0d+0, 0.0d+0 ) )
133 INTEGER J, K, KC, KCNEXT, KP, KPC, KSTEP, KX, NPP
134 DOUBLE PRECISION AK, AKP1, D, T
135 COMPLEX*16 AKKP1, TEMP
140 EXTERNAL lsame, zdotc
146 INTRINSIC abs, dble, dconjg
153 upper = lsame( uplo,
'U' )
154 IF( .NOT.upper .AND. .NOT.lsame( uplo,
'L' ) )
THEN
156 ELSE IF( n.LT.0 )
THEN
160 CALL xerbla(
'ZHPTRI', -info )
176 DO 10 info = n, 1, -1
177 IF( ipiv( info ).GT.0 .AND. ap( kp ).EQ.zero )
187 IF( ipiv( info ).GT.0 .AND. ap( kp ).EQ.zero )
189 kp = kp + n - info + 1
211 IF( ipiv( k ).GT.0 )
THEN
217 ap( kc+k-1 ) = one / dble( ap( kc+k-1 ) )
222 CALL zcopy( k-1, ap( kc ), 1, work, 1 )
223 CALL zhpmv( uplo, k-1, -cone, ap, work, 1, zero,
225 ap( kc+k-1 ) = ap( kc+k-1 ) -
226 $ dble( zdotc( k-1, work, 1, ap( kc ), 1 ) )
235 t = abs( ap( kcnext+k-1 ) )
236 ak = dble( ap( kc+k-1 ) ) / t
237 akp1 = dble( ap( kcnext+k ) ) / t
238 akkp1 = ap( kcnext+k-1 ) / t
239 d = t*( ak*akp1-one )
240 ap( kc+k-1 ) = akp1 / d
241 ap( kcnext+k ) = ak / d
242 ap( kcnext+k-1 ) = -akkp1 / d
247 CALL zcopy( k-1, ap( kc ), 1, work, 1 )
248 CALL zhpmv( uplo, k-1, -cone, ap, work, 1, zero,
250 ap( kc+k-1 ) = ap( kc+k-1 ) -
251 $ dble( zdotc( k-1, work, 1, ap( kc ), 1 ) )
252 ap( kcnext+k-1 ) = ap( kcnext+k-1 ) -
253 $ zdotc( k-1, ap( kc ), 1, ap( kcnext ),
255 CALL zcopy( k-1, ap( kcnext ), 1, work, 1 )
256 CALL zhpmv( uplo, k-1, -cone, ap, work, 1, zero,
258 ap( kcnext+k ) = ap( kcnext+k ) -
259 $ dble( zdotc( k-1, work, 1, ap( kcnext ),
263 kcnext = kcnext + k + 1
266 kp = abs( ipiv( k ) )
272 kpc = ( kp-1 )*kp / 2 + 1
273 CALL zswap( kp-1, ap( kc ), 1, ap( kpc ), 1 )
275 DO 40 j = kp + 1, k - 1
277 temp = dconjg( ap( kc+j-1 ) )
278 ap( kc+j-1 ) = dconjg( ap( kx ) )
281 ap( kc+kp-1 ) = dconjg( ap( kc+kp-1 ) )
283 ap( kc+k-1 ) = ap( kpc+kp-1 )
284 ap( kpc+kp-1 ) = temp
285 IF( kstep.EQ.2 )
THEN
286 temp = ap( kc+k+k-1 )
287 ap( kc+k+k-1 ) = ap( kc+k+kp-1 )
288 ap( kc+k+kp-1 ) = temp
314 kcnext = kc - ( n-k+2 )
315 IF( ipiv( k ).GT.0 )
THEN
321 ap( kc ) = one / dble( ap( kc ) )
326 CALL zcopy( n-k, ap( kc+1 ), 1, work, 1 )
327 CALL zhpmv( uplo, n-k, -cone, ap( kc+n-k+1 ), work, 1,
328 $ zero, ap( kc+1 ), 1 )
329 ap( kc ) = ap( kc ) - dble( zdotc( n-k, work, 1,
339 t = abs( ap( kcnext+1 ) )
340 ak = dble( ap( kcnext ) ) / t
341 akp1 = dble( ap( kc ) ) / t
342 akkp1 = ap( kcnext+1 ) / t
343 d = t*( ak*akp1-one )
344 ap( kcnext ) = akp1 / d
346 ap( kcnext+1 ) = -akkp1 / d
351 CALL zcopy( n-k, ap( kc+1 ), 1, work, 1 )
352 CALL zhpmv( uplo, n-k, -cone, ap( kc+( n-k+1 ) ), work,
353 $ 1, zero, ap( kc+1 ), 1 )
354 ap( kc ) = ap( kc ) - dble( zdotc( n-k, work, 1,
356 ap( kcnext+1 ) = ap( kcnext+1 ) -
357 $ zdotc( n-k, ap( kc+1 ), 1,
358 $ ap( kcnext+2 ), 1 )
359 CALL zcopy( n-k, ap( kcnext+2 ), 1, work, 1 )
360 CALL zhpmv( uplo, n-k, -cone, ap( kc+( n-k+1 ) ), work,
361 $ 1, zero, ap( kcnext+2 ), 1 )
362 ap( kcnext ) = ap( kcnext ) -
363 $ dble( zdotc( n-k, work, 1, ap( kcnext+2 ),
367 kcnext = kcnext - ( n-k+3 )
370 kp = abs( ipiv( k ) )
376 kpc = npp - ( n-kp+1 )*( n-kp+2 ) / 2 + 1
378 $
CALL zswap( n-kp, ap( kc+kp-k+1 ), 1, ap( kpc+1 ), 1 )
380 DO 70 j = k + 1, kp - 1
382 temp = dconjg( ap( kc+j-k ) )
383 ap( kc+j-k ) = dconjg( ap( kx ) )
386 ap( kc+kp-k ) = dconjg( ap( kc+kp-k ) )
390 IF( kstep.EQ.2 )
THEN
391 temp = ap( kc-n+k-1 )
392 ap( kc-n+k-1 ) = ap( kc-n+kp-1 )
393 ap( kc-n+kp-1 ) = temp
subroutine xerbla(srname, info)
subroutine zcopy(n, zx, incx, zy, incy)
ZCOPY
subroutine zhpmv(uplo, n, alpha, ap, x, incx, beta, y, incy)
ZHPMV
subroutine zhptri(uplo, n, ap, ipiv, work, info)
ZHPTRI
subroutine zswap(n, zx, incx, zy, incy)
ZSWAP