117 SUBROUTINE ssytri2x( UPLO, N, A, LDA, IPIV, WORK, NB, INFO )
125 INTEGER INFO, LDA, N, NB
129 REAL A( LDA, * ), WORK( N+NB+1,* )
136 parameter( one = 1.0e+0, zero = 0.0e+0 )
140 INTEGER I, IINFO, IP, K, CUT, NNB
144 REAL AK, AKKP1, AKP1, D, T
145 REAL U01_I_J, U01_IP1_J
146 REAL U11_I_J, U11_IP1_J
164 upper = lsame( uplo,
'U' )
165 IF( .NOT.upper .AND. .NOT.lsame( uplo,
'L' ) )
THEN
167 ELSE IF( n.LT.0 )
THEN
169 ELSE IF( lda.LT.max( 1, n ) )
THEN
177 CALL xerbla(
'SSYTRI2X', -info )
186 CALL ssyconv( uplo,
'C', n, a, lda, ipiv, work, iinfo )
195 IF( ipiv( info ).GT.0 .AND. a( info, info ).EQ.zero )
203 IF( ipiv( info ).GT.0 .AND. a( info, info ).EQ.zero )
223 CALL strtri( uplo,
'U', n, a, lda, info )
228 DO WHILE ( k .LE. n )
229 IF( ipiv( k ).GT.0 )
THEN
231 work(k,invd) = one / a( k, k )
238 akp1 = a( k+1, k+1 ) / t
239 akkp1 = work(k+1,1) / t
240 d = t*( ak*akp1-one )
241 work(k,invd) = akp1 / d
242 work(k+1,invd+1) = ak / d
243 work(k,invd+1) = -akkp1 / d
244 work(k+1,invd) = -akkp1 / d
254 DO WHILE (cut .GT. 0)
256 IF (cut .LE. nnb)
THEN
262 IF (ipiv(i) .LT. 0) count=count+1
265 IF (mod(count,2) .EQ. 1) nnb=nnb+1
286 work(u11+i,j)=a(cut+i,cut+j)
293 DO WHILE (i .LE. cut)
294 IF (ipiv(i) > 0)
THEN
296 work(i,j)=work(i,invd)*work(i,j)
302 u01_ip1_j = work(i+1,j)
303 work(i,j)=work(i,invd)*u01_i_j+
304 $ work(i,invd+1)*u01_ip1_j
305 work(i+1,j)=work(i+1,invd)*u01_i_j+
306 $ work(i+1,invd+1)*u01_ip1_j
315 DO WHILE (i .LE. nnb)
316 IF (ipiv(cut+i) > 0)
THEN
318 work(u11+i,j)=work(cut+i,invd)*work(u11+i,j)
323 u11_i_j = work(u11+i,j)
324 u11_ip1_j = work(u11+i+1,j)
325 work(u11+i,j)=work(cut+i,invd)*work(u11+i,j) +
326 $ work(cut+i,invd+1)*work(u11+i+1,j)
327 work(u11+i+1,j)=work(cut+i+1,invd)*u11_i_j+
328 $ work(cut+i+1,invd+1)*u11_ip1_j
336 CALL strmm(
'L',
'U',
'T',
'U',nnb, nnb,
337 $ one,a(cut+1,cut+1),lda,work(u11+1,1),n+nb+1)
341 a(cut+i,cut+j)=work(u11+i,j)
347 CALL sgemm(
'T',
'N',nnb,nnb,cut,one,a(1,cut+1),lda,
348 $ work,n+nb+1, zero, work(u11+1,1), n+nb+1)
354 a(cut+i,cut+j)=a(cut+i,cut+j)+work(u11+i,j)
360 CALL strmm(
'L',uplo,
'T',
'U',cut, nnb,
361 $ one,a,lda,work,n+nb+1)
379 DO WHILE ( i .LE. n )
380 IF( ipiv(i) .GT. 0 )
THEN
382 IF (i .LT. ip)
CALL ssyswapr( uplo, n, a, lda, i ,
384 IF (i .GT. ip)
CALL ssyswapr( uplo, n, a, lda, ip ,
390 $
CALL ssyswapr( uplo, n, a, lda, i-1 ,ip )
392 $
CALL ssyswapr( uplo, n, a, lda, ip ,i-1 )
402 CALL strtri( uplo,
'U', n, a, lda, info )
407 DO WHILE ( k .GE. 1 )
408 IF( ipiv( k ).GT.0 )
THEN
410 work(k,invd) = one / a( k, k )
416 ak = a( k-1, k-1 ) / t
418 akkp1 = work(k-1,1) / t
419 d = t*( ak*akp1-one )
420 work(k-1,invd) = akp1 / d
421 work(k,invd) = ak / d
422 work(k,invd+1) = -akkp1 / d
423 work(k-1,invd+1) = -akkp1 / d
433 DO WHILE (cut .LT. n)
435 IF (cut + nnb .GT. n)
THEN
441 IF (ipiv(i) .LT. 0) count=count+1
444 IF (mod(count,2) .EQ. 1) nnb=nnb+1
449 work(i,j)=a(cut+nnb+i,cut+j)
459 work(u11+i,j)=a(cut+i,cut+j)
467 IF (ipiv(cut+nnb+i) > 0)
THEN
469 work(i,j)=work(cut+nnb+i,invd)*work(i,j)
475 u01_ip1_j = work(i-1,j)
476 work(i,j)=work(cut+nnb+i,invd)*u01_i_j+
477 $ work(cut+nnb+i,invd+1)*u01_ip1_j
478 work(i-1,j)=work(cut+nnb+i-1,invd+1)*u01_i_j+
479 $ work(cut+nnb+i-1,invd)*u01_ip1_j
489 IF (ipiv(cut+i) > 0)
THEN
491 work(u11+i,j)=work(cut+i,invd)*work(u11+i,j)
496 u11_i_j = work(u11+i,j)
497 u11_ip1_j = work(u11+i-1,j)
498 work(u11+i,j)=work(cut+i,invd)*work(u11+i,j) +
499 $ work(cut+i,invd+1)*u11_ip1_j
500 work(u11+i-1,j)=work(cut+i-1,invd+1)*u11_i_j+
501 $ work(cut+i-1,invd)*u11_ip1_j
509 CALL strmm(
'L',uplo,
'T',
'U',nnb, nnb,
510 $ 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 sgemm(
'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 strmm(
'L',uplo,
'T',
'U', n-nnb-cut, nnb,
538 $ one,a(cut+nnb+1,cut+nnb+1),lda,work,n+nb+1)
544 a(cut+nnb+i,cut+j)=work(i,j)
554 a(cut+i,cut+j)=work(u11+i,j)
567 DO WHILE ( i .GE. 1 )
568 IF( ipiv(i) .GT. 0 )
THEN
570 IF (i .LT. ip)
CALL ssyswapr( uplo, n, a, lda, i ,
572 IF (i .GT. ip)
CALL ssyswapr( uplo, n, a, lda, ip ,
576 IF ( i .LT. ip)
CALL ssyswapr( uplo, n, a, lda, i ,
578 IF ( i .GT. ip)
CALL ssyswapr( uplo, n, a, lda, ip ,