117 SUBROUTINE csytri2x( UPLO, N, A, LDA, IPIV, WORK, NB, INFO )
125 INTEGER INFO, LDA, N, NB
129 COMPLEX A( LDA, * ), WORK( N+NB+1,* )
136 parameter( one = ( 1.0e+0, 0.0e+0 ),
137 $ zero = ( 0.0e+0, 0.0e+0 ) )
141 INTEGER I, IINFO, IP, K, CUT, NNB
145 COMPLEX AK, AKKP1, AKP1, D, T
146 COMPLEX U01_I_J, U01_IP1_J
147 COMPLEX U11_I_J, U11_IP1_J
165 upper = lsame( uplo,
'U' )
166 IF( .NOT.upper .AND. .NOT.lsame( uplo,
'L' ) )
THEN
168 ELSE IF( n.LT.0 )
THEN
170 ELSE IF( lda.LT.max( 1, n ) )
THEN
178 CALL xerbla(
'CSYTRI2X', -info )
187 CALL csyconv( uplo,
'C', n, a, lda, ipiv, work, iinfo )
196 IF( ipiv( info ).GT.0 .AND. a( info, info ).EQ.zero )
204 IF( ipiv( info ).GT.0 .AND. a( info, info ).EQ.zero )
224 CALL ctrtri( uplo,
'U', n, a, lda, info )
229 DO WHILE ( k .LE. n )
230 IF( ipiv( k ).GT.0 )
THEN
232 work(k,invd) = one / a( k, k )
239 akp1 = a( k+1, k+1 ) / t
240 akkp1 = work(k+1,1) / t
241 d = t*( ak*akp1-one )
242 work(k,invd) = akp1 / d
243 work(k+1,invd+1) = ak / d
244 work(k,invd+1) = -akkp1 / d
245 work(k+1,invd) = -akkp1 / d
255 DO WHILE (cut .GT. 0)
257 IF (cut .LE. nnb)
THEN
263 IF (ipiv(i) .LT. 0) count=count+1
266 IF (mod(count,2) .EQ. 1) nnb=nnb+1
287 work(u11+i,j)=a(cut+i,cut+j)
294 DO WHILE (i .LE. cut)
295 IF (ipiv(i) > 0)
THEN
297 work(i,j)=work(i,invd)*work(i,j)
303 u01_ip1_j = work(i+1,j)
304 work(i,j)=work(i,invd)*u01_i_j+
305 $ work(i,invd+1)*u01_ip1_j
306 work(i+1,j)=work(i+1,invd)*u01_i_j+
307 $ work(i+1,invd+1)*u01_ip1_j
316 DO WHILE (i .LE. nnb)
317 IF (ipiv(cut+i) > 0)
THEN
319 work(u11+i,j)=work(cut+i,invd)*work(u11+i,j)
324 u11_i_j = work(u11+i,j)
325 u11_ip1_j = work(u11+i+1,j)
326 work(u11+i,j)=work(cut+i,invd)*work(u11+i,j) +
327 $ work(cut+i,invd+1)*work(u11+i+1,j)
328 work(u11+i+1,j)=work(cut+i+1,invd)*u11_i_j+
329 $ work(cut+i+1,invd+1)*u11_ip1_j
337 CALL ctrmm(
'L',
'U',
'T',
'U',nnb, nnb,
338 $ one,a(cut+1,cut+1),lda,work(u11+1,1),n+nb+1)
342 a(cut+i,cut+j)=work(u11+i,j)
348 CALL cgemm(
'T',
'N',nnb,nnb,cut,one,a(1,cut+1),lda,
349 $ work,n+nb+1, zero, work(u11+1,1), n+nb+1)
355 a(cut+i,cut+j)=a(cut+i,cut+j)+work(u11+i,j)
361 CALL ctrmm(
'L',uplo,
'T',
'U',cut, nnb,
362 $ one,a,lda,work,n+nb+1)
380 DO WHILE ( i .LE. n )
381 IF( ipiv(i) .GT. 0 )
THEN
383 IF (i .LT. ip)
CALL csyswapr( uplo, n, a, lda, i ,
385 IF (i .GT. ip)
CALL csyswapr( uplo, n, a, lda, ip ,
391 $
CALL csyswapr( uplo, n, a, lda, i-1 ,ip )
393 $
CALL csyswapr( uplo, n, a, lda, ip ,i-1 )
403 CALL ctrtri( uplo,
'U', n, a, lda, info )
408 DO WHILE ( k .GE. 1 )
409 IF( ipiv( k ).GT.0 )
THEN
411 work(k,invd) = one / a( k, k )
417 ak = a( k-1, k-1 ) / t
419 akkp1 = work(k-1,1) / t
420 d = t*( ak*akp1-one )
421 work(k-1,invd) = akp1 / d
422 work(k,invd) = ak / d
423 work(k,invd+1) = -akkp1 / d
424 work(k-1,invd+1) = -akkp1 / d
434 DO WHILE (cut .LT. n)
436 IF (cut + nnb .GE. n)
THEN
442 IF (ipiv(i) .LT. 0) count=count+1
445 IF (mod(count,2) .EQ. 1) nnb=nnb+1
450 work(i,j)=a(cut+nnb+i,cut+j)
460 work(u11+i,j)=a(cut+i,cut+j)
468 IF (ipiv(cut+nnb+i) > 0)
THEN
470 work(i,j)=work(cut+nnb+i,invd)*work(i,j)
476 u01_ip1_j = work(i-1,j)
477 work(i,j)=work(cut+nnb+i,invd)*u01_i_j+
478 $ work(cut+nnb+i,invd+1)*u01_ip1_j
479 work(i-1,j)=work(cut+nnb+i-1,invd+1)*u01_i_j+
480 $ work(cut+nnb+i-1,invd)*u01_ip1_j
490 IF (ipiv(cut+i) > 0)
THEN
492 work(u11+i,j)=work(cut+i,invd)*work(u11+i,j)
497 u11_i_j = work(u11+i,j)
498 u11_ip1_j = work(u11+i-1,j)
499 work(u11+i,j)=work(cut+i,invd)*work(u11+i,j) +
500 $ work(cut+i,invd+1)*u11_ip1_j
501 work(u11+i-1,j)=work(cut+i-1,invd+1)*u11_i_j+
502 $ work(cut+i-1,invd)*u11_ip1_j
510 CALL ctrmm(
'L',uplo,
'T',
'U',nnb, nnb,
511 $ one,a(cut+1,cut+1),lda,work(u11+1,1),n+nb+1)
515 a(cut+i,cut+j)=work(u11+i,j)
519 IF ( (cut+nnb) .LT. n )
THEN
523 CALL cgemm(
'T',
'N',nnb,nnb,n-nnb-cut,one,a(cut+nnb+1,cut+1)
524 $ ,lda,work,n+nb+1, zero, work(u11+1,1), n+nb+1)
531 a(cut+i,cut+j)=a(cut+i,cut+j)+work(u11+i,j)
537 CALL ctrmm(
'L',uplo,
'T',
'U', n-nnb-cut, nnb,
538 $ one,a(cut+nnb+1,cut+nnb+1),lda,work,n+nb+1)
543 a(cut+nnb+i,cut+j)=work(i,j)
552 a(cut+i,cut+j)=work(u11+i,j)
565 DO WHILE ( i .GE. 1 )
566 IF( ipiv(i) .GT. 0 )
THEN
568 IF (i .LT. ip)
CALL csyswapr( uplo, n, a, lda, i ,
570 IF (i .GT. ip)
CALL csyswapr( uplo, n, a, lda, ip ,
574 IF ( i .LT. ip)
CALL csyswapr( uplo, n, a, lda, i ,
576 IF ( i .GT. ip)
CALL csyswapr( uplo, n, a, lda, ip ,