158 SUBROUTINE csytri_3x( UPLO, N, A, LDA, E, IPIV, WORK, NB, INFO )
166 INTEGER INFO, LDA, N, NB
170 COMPLEX A( LDA, * ), E( * ), WORK( N+NB+1, * )
177 parameter( cone = ( 1.0e+0, 0.0e+0 ),
178 $ czero = ( 0.0e+0, 0.0e+0 ) )
182 INTEGER CUT, I, ICOUNT, INVD, IP, K, NNB, J, U11
183 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 ,ip )
437 IF (i .GT. ip)
CALL csyswapr( uplo, n, a, lda, ip ,i )
447 CALL ctrtri( uplo,
'U', n, a, lda, info )
452 DO WHILE ( k .GE. 1 )
453 IF( ipiv( k ).GT.0 )
THEN
455 work( k, invd ) = cone / a( k, k )
456 work( k, invd+1 ) = czero
460 ak = a( k-1, k-1 ) / t
462 akkp1 = work( k-1, 1 ) / t
463 d = t*( ak*akp1-cone )
464 work( k-1, invd ) = akp1 / d
465 work( k, invd ) = ak / d
466 work( k, invd+1 ) = -akkp1 / d
467 work( k-1, invd+1 ) = work( k, invd+1 )
480 IF( (cut + nnb).GT.n )
THEN
485 DO i = cut + 1, cut+nnb
486 IF ( ipiv( i ).LT.0 ) icount = icount + 1
489 IF( mod( icount, 2 ).EQ.1 ) nnb = nnb + 1
496 work( i, j ) = a( cut+nnb+i, cut+j )
503 work( u11+i, i) = cone
505 work( u11+i, j ) = czero
508 work( u11+i, j ) = a( cut+i, cut+j )
516 IF( ipiv( cut+nnb+i ).GT.0 )
THEN
518 work( i, j ) = work( cut+nnb+i, invd) * work( i, j)
523 u01_ip1_j = work(i-1,j)
524 work(i,j)=work(cut+nnb+i,invd)*u01_i_j+
525 $ work(cut+nnb+i,invd+1)*u01_ip1_j
526 work(i-1,j)=work(cut+nnb+i-1,invd+1)*u01_i_j+
527 $ work(cut+nnb+i-1,invd)*u01_ip1_j
538 IF( ipiv( cut+i ).GT.0 )
THEN
540 work( u11+i, j ) = work( cut+i, invd)*work(u11+i,j)
545 u11_i_j = work( u11+i, j )
546 u11_ip1_j = work( u11+i-1, j )
547 work( u11+i, j ) = work(cut+i,invd) * work(u11+i,j)
548 $ + work(cut+i,invd+1) * u11_ip1_j
549 work( u11+i-1, j ) = work(cut+i-1,invd+1) * u11_i_j
550 $ + work(cut+i-1,invd) * u11_ip1_j
559 CALL ctrmm(
'L', uplo,
'T',
'U', nnb, nnb, cone,
560 $ a( cut+1, cut+1 ), lda, work( u11+1, 1 ),
566 a( cut+i, cut+j ) = work( u11+i, j )
570 IF( (cut+nnb).LT.n )
THEN
574 CALL cgemm(
'T',
'N', nnb, nnb, n-nnb-cut, cone,
575 $ a( cut+nnb+1, cut+1 ), lda, work, n+nb+1,
576 $ czero, work( u11+1, 1 ), n+nb+1 )
583 a( cut+i, cut+j ) = a( cut+i, cut+j )+work(u11+i,j)
589 CALL ctrmm(
'L', uplo,
'T',
'U', n-nnb-cut, nnb, cone,
590 $ a( cut+nnb+1, cut+nnb+1 ), lda, work,
597 a( cut+nnb+i, cut+j ) = work( i, j )
607 a( cut+i, cut+j ) = work( u11+i, j )
630 ip = abs( ipiv( i ) )
632 IF (i .LT. ip)
CALL csyswapr( uplo, n, a, lda, i ,ip )
633 IF (i .GT. ip)
CALL csyswapr( uplo, n, a, lda, ip ,i )
subroutine xerbla(srname, info)
subroutine cgemm(transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc)
CGEMM
subroutine csyswapr(uplo, n, a, lda, i1, i2)
CSYSWAPR
subroutine csytri_3x(uplo, n, a, lda, e, ipiv, work, nb, info)
CSYTRI_3X
subroutine ctrmm(side, uplo, transa, diag, m, n, alpha, a, lda, b, ldb)
CTRMM
subroutine ctrtri(uplo, diag, n, a, lda, info)
CTRTRI