117 SUBROUTINE dsytrs( UPLO, N, NRHS, A, LDA, IPIV, B, LDB, INFO )
125 INTEGER INFO, LDA, LDB, N, NRHS
129 DOUBLE PRECISION A( LDA, * ), B( LDB, * )
136 parameter( one = 1.0d+0 )
141 DOUBLE PRECISION AK, AKM1, AKM1K, BK, BKM1, DENOM
156 upper = lsame( uplo,
'U' )
157 IF( .NOT.upper .AND. .NOT.lsame( uplo,
'L' ) )
THEN
159 ELSE IF( n.LT.0 )
THEN
161 ELSE IF( nrhs.LT.0 )
THEN
163 ELSE IF( lda.LT.max( 1, n ) )
THEN
165 ELSE IF( ldb.LT.max( 1, n ) )
THEN
169 CALL xerbla(
'DSYTRS', -info )
175 IF( n.EQ.0 .OR. nrhs.EQ.0 )
195 IF( ipiv( k ).GT.0 )
THEN
203 $
CALL dswap( nrhs, b( k, 1 ), ldb, b( kp, 1 ), ldb )
208 CALL dger( k-1, nrhs, -one, a( 1, k ), 1, b( k, 1 ), ldb,
213 CALL dscal( nrhs, one / a( k, k ), b( k, 1 ), ldb )
223 $
CALL dswap( nrhs, b( k-1, 1 ), ldb, b( kp, 1 ), ldb )
228 CALL dger( k-2, nrhs, -one, a( 1, k ), 1, b( k, 1 ), ldb,
230 CALL dger( k-2, nrhs, -one, a( 1, k-1 ), 1, b( k-1, 1 ),
231 $ ldb, b( 1, 1 ), ldb )
236 akm1 = a( k-1, k-1 ) / akm1k
237 ak = a( k, k ) / akm1k
238 denom = akm1*ak - one
240 bkm1 = b( k-1, j ) / akm1k
241 bk = b( k, j ) / akm1k
242 b( k-1, j ) = ( ak*bkm1-bk ) / denom
243 b( k, j ) = ( akm1*bk-bkm1 ) / denom
264 IF( ipiv( k ).GT.0 )
THEN
271 CALL dgemv(
'Transpose', k-1, nrhs, -one, b, ldb, a( 1,
273 $ 1, one, b( k, 1 ), ldb )
279 $
CALL dswap( nrhs, b( k, 1 ), ldb, b( kp, 1 ), ldb )
288 CALL dgemv(
'Transpose', k-1, nrhs, -one, b, ldb, a( 1,
290 $ 1, one, b( k, 1 ), ldb )
291 CALL dgemv(
'Transpose', k-1, nrhs, -one, b, ldb,
292 $ a( 1, k+1 ), 1, one, b( k+1, 1 ), ldb )
298 $
CALL dswap( nrhs, b( k, 1 ), ldb, b( kp, 1 ), ldb )
322 IF( ipiv( k ).GT.0 )
THEN
330 $
CALL dswap( nrhs, b( k, 1 ), ldb, b( kp, 1 ), ldb )
336 $
CALL dger( n-k, nrhs, -one, a( k+1, k ), 1, b( k, 1 ),
337 $ ldb, b( k+1, 1 ), ldb )
341 CALL dscal( nrhs, one / a( k, k ), b( k, 1 ), ldb )
351 $
CALL dswap( nrhs, b( k+1, 1 ), ldb, b( kp, 1 ), ldb )
357 CALL dger( n-k-1, nrhs, -one, a( k+2, k ), 1, b( k,
359 $ ldb, b( k+2, 1 ), ldb )
360 CALL dger( n-k-1, nrhs, -one, a( k+2, k+1 ), 1,
361 $ b( k+1, 1 ), ldb, b( k+2, 1 ), ldb )
367 akm1 = a( k, k ) / akm1k
368 ak = a( k+1, k+1 ) / akm1k
369 denom = akm1*ak - one
371 bkm1 = b( k, j ) / akm1k
372 bk = b( k+1, j ) / akm1k
373 b( k, j ) = ( ak*bkm1-bk ) / denom
374 b( k+1, j ) = ( akm1*bk-bkm1 ) / denom
395 IF( ipiv( k ).GT.0 )
THEN
403 $
CALL dgemv(
'Transpose', n-k, nrhs, -one, b( k+1, 1 ),
404 $ ldb, a( k+1, k ), 1, one, b( k, 1 ), ldb )
410 $
CALL dswap( nrhs, b( k, 1 ), ldb, b( kp, 1 ), ldb )
420 CALL dgemv(
'Transpose', n-k, nrhs, -one, b( k+1, 1 ),
421 $ ldb, a( k+1, k ), 1, one, b( k, 1 ), ldb )
422 CALL dgemv(
'Transpose', n-k, nrhs, -one, b( k+1, 1 ),
423 $ ldb, a( k+1, k-1 ), 1, one, b( k-1, 1 ),
431 $
CALL dswap( nrhs, b( k, 1 ), ldb, b( kp, 1 ), ldb )