156 SUBROUTINE csytri_3x( UPLO, N, A, LDA, E, IPIV, WORK, NB,
165 INTEGER INFO, LDA, N, NB
169 COMPLEX A( LDA, * ), E( * ), WORK( N+NB+1, * )
176 parameter( cone = ( 1.0e+0, 0.0e+0 ),
177 $ czero = ( 0.0e+0, 0.0e+0 ) )
181 INTEGER CUT, I, ICOUNT, INVD, IP, K, NNB, J, U11
182 COMPLEX AK, AKKP1, AKP1, D, T, U01_I_J, U01_IP1_J,
194 INTRINSIC abs, max, mod
201 upper = lsame( uplo,
'U' )
202 IF( .NOT.upper .AND. .NOT.lsame( uplo,
'L' ) )
THEN
204 ELSE IF( n.LT.0 )
THEN
206 ELSE IF( lda.LT.max( 1, n ) )
THEN
213 CALL xerbla(
'CSYTRI_3X', -info )
222 work( k, 1 ) = e( k )
232 IF( ipiv( info ).GT.0 .AND. a( info, info ).EQ.czero )
240 IF( ipiv( info ).GT.0 .AND. a( info, info ).EQ.czero )
266 CALL ctrtri( uplo,
'U', n, a, lda, info )
272 IF( ipiv( k ).GT.0 )
THEN
274 work( k, invd ) = cone / a( k, k )
275 work( k, invd+1 ) = czero
280 akp1 = a( k+1, k+1 ) / t
281 akkp1 = work( k+1, 1 ) / t
282 d = t*( ak*akp1-cone )
283 work( k, invd ) = akp1 / d
284 work( k+1, invd+1 ) = ak / d
285 work( k, invd+1 ) = -akkp1 / d
286 work( k+1, invd ) = work( k, invd+1 )
299 IF( cut.LE.nnb )
THEN
304 DO i = cut+1-nnb, cut
305 IF( ipiv( i ).LT.0 ) icount = icount + 1
308 IF( mod( icount, 2 ).EQ.1 ) nnb = nnb + 1
317 work( i, j ) = a( i, cut+j )
324 work( u11+i, i ) = cone
326 work( u11+i, j ) = czero
329 work( u11+i, j ) = a( cut+i, cut+j )
337 IF( ipiv( i ).GT.0 )
THEN
339 work( i, j ) = work( i, invd ) * work( i, j )
343 u01_i_j = work( i, j )
344 u01_ip1_j = work( i+1, j )
345 work( i, j ) = work( i, invd ) * u01_i_j
346 $ + work( i, invd+1 ) * u01_ip1_j
347 work( i+1, j ) = work( i+1, invd ) * u01_i_j
348 $ + work( i+1, invd+1 ) * u01_ip1_j
358 DO WHILE ( i.LE.nnb )
359 IF( ipiv( cut+i ).GT.0 )
THEN
361 work( u11+i, j ) = work(cut+i,invd) * work(u11+i,j)
365 u11_i_j = work(u11+i,j)
366 u11_ip1_j = work(u11+i+1,j)
367 work( u11+i, j ) = work(cut+i,invd) * work(u11+i,j)
368 $ + work(cut+i,invd+1) * work(u11+i+1,j)
369 work( u11+i+1, j ) = work(cut+i+1,invd) * u11_i_j
370 $ + work(cut+i+1,invd+1) * u11_ip1_j
379 CALL ctrmm(
'L',
'U',
'T',
'U', nnb, nnb,
380 $ cone, a( cut+1, cut+1 ), lda, work( u11+1, 1 ),
385 a( cut+i, cut+j ) = work( u11+i, j )
391 CALL cgemm(
'T',
'N', nnb, nnb, cut, cone, a( 1, cut+1 ),
392 $ lda, work, n+nb+1, czero, work(u11+1,1),
400 a( cut+i, cut+j ) = a( cut+i, cut+j ) + work(u11+i,j)
406 CALL ctrmm(
'L', uplo,
'T',
'U', cut, nnb,
407 $ cone, a, lda, work, n+nb+1 )
414 a( i, cut+j ) = work( i, j )
434 ip = abs( ipiv( i ) )
436 IF (i .LT. ip)
CALL csyswapr( uplo, n, a, lda, i ,
438 IF (i .GT. ip)
CALL csyswapr( uplo, n, a, lda, ip ,
449 CALL ctrtri( uplo,
'U', n, a, lda, info )
454 DO WHILE ( k .GE. 1 )
455 IF( ipiv( k ).GT.0 )
THEN
457 work( k, invd ) = cone / a( k, k )
458 work( k, invd+1 ) = czero
462 ak = a( k-1, k-1 ) / t
464 akkp1 = work( k-1, 1 ) / t
465 d = t*( ak*akp1-cone )
466 work( k-1, invd ) = akp1 / d
467 work( k, invd ) = ak / d
468 work( k, invd+1 ) = -akkp1 / d
469 work( k-1, invd+1 ) = work( k, invd+1 )
482 IF( (cut + nnb).GT.n )
THEN
487 DO i = cut + 1, cut+nnb
488 IF ( ipiv( i ).LT.0 ) icount = icount + 1
491 IF( mod( icount, 2 ).EQ.1 ) nnb = nnb + 1
498 work( i, j ) = a( cut+nnb+i, cut+j )
505 work( u11+i, i) = cone
507 work( u11+i, j ) = czero
510 work( u11+i, j ) = a( cut+i, cut+j )
518 IF( ipiv( cut+nnb+i ).GT.0 )
THEN
520 work( i, j ) = work( cut+nnb+i, invd) * work( i, j)
525 u01_ip1_j = work(i-1,j)
526 work(i,j)=work(cut+nnb+i,invd)*u01_i_j+
527 $ work(cut+nnb+i,invd+1)*u01_ip1_j
528 work(i-1,j)=work(cut+nnb+i-1,invd+1)*u01_i_j+
529 $ work(cut+nnb+i-1,invd)*u01_ip1_j
540 IF( ipiv( cut+i ).GT.0 )
THEN
542 work( u11+i, j ) = work( cut+i, invd)*work(u11+i,j)
547 u11_i_j = work( u11+i, j )
548 u11_ip1_j = work( u11+i-1, j )
549 work( u11+i, j ) = work(cut+i,invd) * work(u11+i,j)
550 $ + work(cut+i,invd+1) * u11_ip1_j
551 work( u11+i-1, j ) = work(cut+i-1,invd+1) * u11_i_j
552 $ + work(cut+i-1,invd) * u11_ip1_j
561 CALL ctrmm(
'L', uplo,
'T',
'U', nnb, nnb, cone,
562 $ a( cut+1, cut+1 ), lda, work( u11+1, 1 ),
568 a( cut+i, cut+j ) = work( u11+i, j )
572 IF( (cut+nnb).LT.n )
THEN
576 CALL cgemm(
'T',
'N', nnb, nnb, n-nnb-cut, cone,
577 $ a( cut+nnb+1, cut+1 ), lda, work, n+nb+1,
578 $ czero, work( u11+1, 1 ), n+nb+1 )
585 a( cut+i, cut+j ) = a( cut+i, cut+j )+work(u11+i,j)
591 CALL ctrmm(
'L', uplo,
'T',
'U', n-nnb-cut, nnb, cone,
592 $ a( cut+nnb+1, cut+nnb+1 ), lda, work,
599 a( cut+nnb+i, cut+j ) = work( i, j )
609 a( cut+i, cut+j ) = work( u11+i, j )
632 ip = abs( ipiv( i ) )
634 IF (i .LT. ip)
CALL csyswapr( uplo, n, a, lda, i ,
636 IF (i .GT. ip)
CALL csyswapr( uplo, n, a, lda, ip ,