113 SUBROUTINE chetri( UPLO, N, A, LDA, IPIV, WORK, INFO )
125 COMPLEX A( LDA, * ), WORK( * )
133 parameter( one = 1.0e+0, cone = ( 1.0e+0, 0.0e+0 ),
134 $ zero = ( 0.0e+0, 0.0e+0 ) )
138 INTEGER J, K, KP, KSTEP
145 EXTERNAL lsame, cdotc
151 INTRINSIC abs, conjg, max, real
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(
'CHETRI', -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 / real( a( k, k ) )
223 CALL ccopy( k-1, a( 1, k ), 1, work, 1 )
224 CALL chemv( uplo, k-1, -cone, a, lda, work, 1, zero,
226 a( k, k ) = a( k, k ) - real( cdotc( k-1, work, 1, a( 1,
236 t = abs( a( k, k+1 ) )
237 ak = real( a( k, k ) ) / t
238 akp1 = real( 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 ccopy( k-1, a( 1, k ), 1, work, 1 )
249 CALL chemv( uplo, k-1, -cone, a, lda, work, 1, zero,
251 a( k, k ) = a( k, k ) - real( cdotc( k-1, work, 1, a( 1,
253 a( k, k+1 ) = a( k, k+1 ) -
254 $ cdotc( k-1, a( 1, k ), 1, a( 1, k+1 ), 1 )
255 CALL ccopy( k-1, a( 1, k+1 ), 1, work, 1 )
256 CALL chemv( uplo, k-1, -cone, a, lda, work, 1, zero,
258 a( k+1, k+1 ) = a( k+1, k+1 ) -
259 $ real( cdotc( k-1, work, 1, a( 1, k+1 ),
265 kp = abs( ipiv( k ) )
271 CALL cswap( kp-1, a( 1, k ), 1, a( 1, kp ), 1 )
272 DO 40 j = kp + 1, k - 1
273 temp = conjg( a( j, k ) )
274 a( j, k ) = conjg( a( kp, j ) )
277 a( kp, k ) = conjg( 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 / real( a( k, k ) )
318 CALL ccopy( n-k, a( k+1, k ), 1, work, 1 )
319 CALL chemv( 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 ) - real( cdotc( n-k, work, 1,
331 t = abs( a( k, k-1 ) )
332 ak = real( a( k-1, k-1 ) ) / t
333 akp1 = real( 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 ccopy( n-k, a( k+1, k ), 1, work, 1 )
344 CALL chemv( 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 ) - real( cdotc( n-k, work, 1,
348 a( k, k-1 ) = a( k, k-1 ) -
349 $ cdotc( n-k, a( k+1, k ), 1, a( k+1, k-1 ),
351 CALL ccopy( n-k, a( k+1, k-1 ), 1, work, 1 )
352 CALL chemv( 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 $ real( cdotc( n-k, work, 1, a( k+1, k-1 ),
361 kp = abs( ipiv( k ) )
368 $
CALL cswap( n-kp, a( kp+1, k ), 1, a( kp+1, kp ), 1 )
369 DO 70 j = k + 1, kp - 1
370 temp = conjg( a( j, k ) )
371 a( j, k ) = conjg( a( kp, j ) )
374 a( kp, k ) = conjg( 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 ccopy(n, cx, incx, cy, incy)
CCOPY
subroutine chemv(uplo, n, alpha, a, lda, x, incx, beta, y, incy)
CHEMV
subroutine chetri(uplo, n, a, lda, ipiv, work, info)
CHETRI
subroutine cswap(n, cx, incx, cy, incy)
CSWAP