132 SUBROUTINE csytrs2( UPLO, N, NRHS, A, LDA, IPIV, B, LDB,
142 INTEGER INFO, LDA, LDB, N, NRHS
146 COMPLEX A( lda, * ), B( ldb, * ), WORK( * )
153 parameter ( one = (1.0e+0,0.0e+0) )
157 INTEGER I, IINFO, J, K, KP
158 COMPLEX AK, AKM1, AKM1K, BK, BKM1, DENOM
173 upper = lsame( uplo,
'U' )
174 IF( .NOT.upper .AND. .NOT.lsame( uplo,
'L' ) )
THEN
176 ELSE IF( n.LT.0 )
THEN
178 ELSE IF( nrhs.LT.0 )
THEN
180 ELSE IF( lda.LT.max( 1, n ) )
THEN
182 ELSE IF( ldb.LT.max( 1, n ) )
THEN
186 CALL xerbla(
'CSYTRS2', -info )
192 IF( n.EQ.0 .OR. nrhs.EQ.0 )
197 CALL csyconv( uplo,
'C', n, a, lda, ipiv, work, iinfo )
205 DO WHILE ( k .GE. 1 )
206 IF( ipiv( k ).GT.0 )
THEN
211 $
CALL cswap( nrhs, b( k, 1 ), ldb, b( kp, 1 ), ldb )
217 IF( kp.EQ.-ipiv( k-1 ) )
218 $
CALL cswap( nrhs, b( k-1, 1 ), ldb, b( kp, 1 ), ldb )
225 CALL ctrsm(
'L',
'U',
'N',
'U',n,nrhs,one,a,lda,b,ldb)
230 DO WHILE ( i .GE. 1 )
231 IF( ipiv(i) .GT. 0 )
THEN
232 CALL cscal( nrhs, one / a( i, i ), b( i, 1 ), ldb )
233 ELSEIF ( i .GT. 1)
THEN
234 IF ( ipiv(i-1) .EQ. ipiv(i) )
THEN
236 akm1 = a( i-1, i-1 ) / akm1k
237 ak = a( i, i ) / akm1k
238 denom = akm1*ak - one
240 bkm1 = b( i-1, j ) / akm1k
241 bk = b( i, j ) / akm1k
242 b( i-1, j ) = ( ak*bkm1-bk ) / denom
243 b( i, j ) = ( akm1*bk-bkm1 ) / denom
253 CALL ctrsm(
'L',
'U',
'T',
'U',n,nrhs,one,a,lda,b,ldb)
258 DO WHILE ( k .LE. n )
259 IF( ipiv( k ).GT.0 )
THEN
264 $
CALL cswap( nrhs, b( k, 1 ), ldb, b( kp, 1 ), ldb )
270 IF( k .LT. n .AND. kp.EQ.-ipiv( k+1 ) )
271 $
CALL cswap( nrhs, b( k, 1 ), ldb, b( kp, 1 ), ldb )
282 DO WHILE ( k .LE. n )
283 IF( ipiv( k ).GT.0 )
THEN
288 $
CALL cswap( nrhs, b( k, 1 ), ldb, b( kp, 1 ), ldb )
294 IF( kp.EQ.-ipiv( k ) )
295 $
CALL cswap( nrhs, b( k+1, 1 ), ldb, b( kp, 1 ), ldb )
302 CALL ctrsm(
'L',
'L',
'N',
'U',n,nrhs,one,a,lda,b,ldb)
307 DO WHILE ( i .LE. n )
308 IF( ipiv(i) .GT. 0 )
THEN
309 CALL cscal( nrhs, one / a( i, i ), b( i, 1 ), ldb )
312 akm1 = a( i, i ) / akm1k
313 ak = a( i+1, i+1 ) / akm1k
314 denom = akm1*ak - one
316 bkm1 = b( i, j ) / akm1k
317 bk = b( i+1, j ) / akm1k
318 b( i, j ) = ( ak*bkm1-bk ) / denom
319 b( i+1, j ) = ( akm1*bk-bkm1 ) / denom
328 CALL ctrsm(
'L',
'L',
'T',
'U',n,nrhs,one,a,lda,b,ldb)
333 DO WHILE ( k .GE. 1 )
334 IF( ipiv( k ).GT.0 )
THEN
339 $
CALL cswap( nrhs, b( k, 1 ), ldb, b( kp, 1 ), ldb )
345 IF( k.GT.1 .AND. kp.EQ.-ipiv( k-1 ) )
346 $
CALL cswap( nrhs, b( k, 1 ), ldb, b( kp, 1 ), ldb )
355 CALL csyconv( uplo,
'R', n, a, lda, ipiv, work, iinfo )
subroutine csytrs2(UPLO, N, NRHS, A, LDA, IPIV, B, LDB, WORK, INFO)
CSYTRS2
subroutine xerbla(SRNAME, INFO)
XERBLA
subroutine cscal(N, CA, CX, INCX)
CSCAL
subroutine ctrsm(SIDE, UPLO, TRANSA, DIAG, M, N, ALPHA, A, LDA, B, LDB)
CTRSM
subroutine csyconv(UPLO, WAY, N, A, LDA, IPIV, E, INFO)
CSYCONV
subroutine cswap(N, CX, INCX, CY, INCY)
CSWAP