119 SUBROUTINE ssytri2x( UPLO, N, A, LDA, IPIV, WORK, NB, INFO )
127 INTEGER INFO, LDA, N, NB
131 REAL A( LDA, * ), WORK( N+NB+1,* )
138 parameter( one = 1.0e+0, zero = 0.0e+0 )
142 INTEGER I, IINFO, IP, K, CUT, NNB
146 REAL AK, AKKP1, AKP1, D, T
147 REAL U01_I_J, U01_IP1_J
148 REAL U11_I_J, U11_IP1_J
166 upper = lsame( uplo,
'U' )
167 IF( .NOT.upper .AND. .NOT.lsame( uplo,
'L' ) )
THEN
169 ELSE IF( n.LT.0 )
THEN
171 ELSE IF( lda.LT.max( 1, n ) )
THEN
179 CALL xerbla(
'SSYTRI2X', -info )
188 CALL ssyconv( uplo,
'C', n, a, lda, ipiv, work, iinfo )
197 IF( ipiv( info ).GT.0 .AND. a( info, info ).EQ.zero )
205 IF( ipiv( info ).GT.0 .AND. a( info, info ).EQ.zero )
225 CALL strtri( uplo,
'U', n, a, lda, info )
230 DO WHILE ( k .LE. n )
231 IF( ipiv( k ).GT.0 )
THEN
233 work(k,invd) = one / a( k, k )
240 akp1 = a( k+1, k+1 ) / t
241 akkp1 = work(k+1,1) / t
242 d = t*( ak*akp1-one )
243 work(k,invd) = akp1 / d
244 work(k+1,invd+1) = ak / d
245 work(k,invd+1) = -akkp1 / d
246 work(k+1,invd) = -akkp1 / d
256 DO WHILE (cut .GT. 0)
258 IF (cut .LE. nnb)
THEN
264 IF (ipiv(i) .LT. 0) count=count+1
267 IF (mod(count,2) .EQ. 1) nnb=nnb+1
288 work(u11+i,j)=a(cut+i,cut+j)
295 DO WHILE (i .LE. cut)
296 IF (ipiv(i) > 0)
THEN
298 work(i,j)=work(i,invd)*work(i,j)
304 u01_ip1_j = work(i+1,j)
305 work(i,j)=work(i,invd)*u01_i_j+
306 $ work(i,invd+1)*u01_ip1_j
307 work(i+1,j)=work(i+1,invd)*u01_i_j+
308 $ work(i+1,invd+1)*u01_ip1_j
317 DO WHILE (i .LE. nnb)
318 IF (ipiv(cut+i) > 0)
THEN
320 work(u11+i,j)=work(cut+i,invd)*work(u11+i,j)
325 u11_i_j = work(u11+i,j)
326 u11_ip1_j = work(u11+i+1,j)
327 work(u11+i,j)=work(cut+i,invd)*work(u11+i,j) +
328 $ work(cut+i,invd+1)*work(u11+i+1,j)
329 work(u11+i+1,j)=work(cut+i+1,invd)*u11_i_j+
330 $ work(cut+i+1,invd+1)*u11_ip1_j
338 CALL strmm(
'L',
'U',
'T',
'U',nnb, nnb,
339 $ one,a(cut+1,cut+1),lda,work(u11+1,1),n+nb+1)
343 a(cut+i,cut+j)=work(u11+i,j)
349 CALL sgemm(
'T',
'N',nnb,nnb,cut,one,a(1,cut+1),lda,
350 $ work,n+nb+1, zero, work(u11+1,1), n+nb+1)
356 a(cut+i,cut+j)=a(cut+i,cut+j)+work(u11+i,j)
362 CALL strmm(
'L',uplo,
'T',
'U',cut, nnb,
363 $ one,a,lda,work,n+nb+1)
381 DO WHILE ( i .LE. n )
382 IF( ipiv(i) .GT. 0 )
THEN
384 IF (i .LT. ip)
CALL ssyswapr( uplo, n, a, lda, i ,ip )
385 IF (i .GT. ip)
CALL ssyswapr( uplo, n, a, lda, ip ,i )
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 ,ip )
571 IF (i .GT. ip)
CALL ssyswapr( uplo, n, a, lda, ip ,i )
574 IF ( i .LT. ip)
CALL ssyswapr( uplo, n, a, lda, i ,ip )
575 IF ( i .GT. ip)
CALL ssyswapr( uplo, n, a, lda, ip ,i )
subroutine xerbla(srname, info)
subroutine sgemm(transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc)
SGEMM
subroutine ssyswapr(uplo, n, a, lda, i1, i2)
SSYSWAPR applies an elementary permutation on the rows and columns of a symmetric matrix.
subroutine ssytri2x(uplo, n, a, lda, ipiv, work, nb, info)
SSYTRI2X
subroutine ssyconv(uplo, way, n, a, lda, ipiv, e, info)
SSYCONV
subroutine strmm(side, uplo, transa, diag, m, n, alpha, a, lda, b, ldb)
STRMM
subroutine strtri(uplo, diag, n, a, lda, info)
STRTRI