111 SUBROUTINE csytri( UPLO, N, A, LDA, IPIV, WORK, INFO )
123 COMPLEX A( LDA, * ), WORK( * )
130 parameter( one = ( 1.0e+0, 0.0e+0 ),
131 $ zero = ( 0.0e+0, 0.0e+0 ) )
136 COMPLEX AK, AKKP1, AKP1, D, T, TEMP
141 EXTERNAL lsame, cdotu
154 upper = lsame( uplo,
'U' )
155 IF( .NOT.upper .AND. .NOT.lsame( uplo,
'L' ) )
THEN
157 ELSE IF( n.LT.0 )
THEN
159 ELSE IF( lda.LT.max( 1, n ) )
THEN
163 CALL xerbla(
'CSYTRI', -info )
178 DO 10 info = n, 1, -1
179 IF( ipiv( info ).GT.0 .AND. a( info, info ).EQ.zero )
187 IF( ipiv( info ).GT.0 .AND. a( info, info ).EQ.zero )
208 IF( ipiv( k ).GT.0 )
THEN
214 a( k, k ) = one / a( k, k )
219 CALL ccopy( k-1, a( 1, k ), 1, work, 1 )
220 CALL csymv( uplo, k-1, -one, a, lda, work, 1, zero,
222 a( k, k ) = a( k, k ) - cdotu( k-1, work, 1, a( 1,
235 akp1 = a( k+1, k+1 ) / t
236 akkp1 = a( k, k+1 ) / t
237 d = t*( ak*akp1-one )
239 a( k+1, k+1 ) = ak / d
240 a( k, k+1 ) = -akkp1 / d
245 CALL ccopy( k-1, a( 1, k ), 1, work, 1 )
246 CALL csymv( uplo, k-1, -one, a, lda, work, 1, zero,
248 a( k, k ) = a( k, k ) - cdotu( k-1, work, 1, a( 1,
251 a( k, k+1 ) = a( k, k+1 ) -
252 $ cdotu( k-1, a( 1, k ), 1, a( 1, k+1 ),
254 CALL ccopy( k-1, a( 1, k+1 ), 1, work, 1 )
255 CALL csymv( uplo, k-1, -one, a, lda, work, 1, zero,
257 a( k+1, k+1 ) = a( k+1, k+1 ) -
258 $ cdotu( k-1, work, 1, a( 1, k+1 ), 1 )
263 kp = abs( ipiv( k ) )
269 CALL cswap( kp-1, a( 1, k ), 1, a( 1, kp ), 1 )
270 CALL cswap( k-kp-1, a( kp+1, k ), 1, a( kp, kp+1 ), lda )
272 a( k, k ) = a( kp, kp )
274 IF( kstep.EQ.2 )
THEN
276 a( k, k+1 ) = a( kp, k+1 )
300 IF( ipiv( k ).GT.0 )
THEN
306 a( k, k ) = one / a( k, k )
311 CALL ccopy( n-k, a( k+1, k ), 1, work, 1 )
312 CALL csymv( uplo, n-k, -one, a( k+1, k+1 ), lda, work,
314 $ zero, a( k+1, k ), 1 )
315 a( k, k ) = a( k, k ) - cdotu( n-k, work, 1, a( k+1,
327 ak = a( k-1, k-1 ) / t
329 akkp1 = a( k, k-1 ) / t
330 d = t*( ak*akp1-one )
331 a( k-1, k-1 ) = akp1 / d
333 a( k, k-1 ) = -akkp1 / d
338 CALL ccopy( n-k, a( k+1, k ), 1, work, 1 )
339 CALL csymv( uplo, n-k, -one, a( k+1, k+1 ), lda, work,
341 $ zero, a( k+1, k ), 1 )
342 a( k, k ) = a( k, k ) - cdotu( n-k, work, 1, a( k+1,
345 a( k, k-1 ) = a( k, k-1 ) -
346 $ cdotu( n-k, a( k+1, k ), 1, a( k+1,
349 CALL ccopy( n-k, a( k+1, k-1 ), 1, work, 1 )
350 CALL csymv( uplo, n-k, -one, a( k+1, k+1 ), lda, work,
352 $ zero, a( k+1, k-1 ), 1 )
353 a( k-1, k-1 ) = a( k-1, k-1 ) -
354 $ cdotu( n-k, work, 1, a( k+1, k-1 ),
360 kp = abs( ipiv( k ) )
367 $
CALL cswap( n-kp, a( kp+1, k ), 1, a( kp+1, kp ), 1 )
368 CALL cswap( kp-k-1, a( k+1, k ), 1, a( kp, k+1 ), lda )
370 a( k, k ) = a( kp, kp )
372 IF( kstep.EQ.2 )
THEN
374 a( k, k-1 ) = a( kp, k-1 )