117 SUBROUTINE zsytrs( UPLO, N, NRHS, A, LDA, IPIV, B, LDB, INFO )
125 INTEGER INFO, LDA, LDB, N, NRHS
129 COMPLEX*16 A( LDA, * ), B( LDB, * )
136 parameter( one = ( 1.0d+0, 0.0d+0 ) )
141 COMPLEX*16 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(
'ZSYTRS', -info )
175 IF( n.EQ.0 .OR. nrhs.EQ.0 )
195 IF( ipiv( k ).GT.0 )
THEN
203 $
CALL zswap( nrhs, b( k, 1 ), ldb, b( kp, 1 ), ldb )
208 CALL zgeru( k-1, nrhs, -one, a( 1, k ), 1, b( k, 1 ),
214 CALL zscal( nrhs, one / a( k, k ), b( k, 1 ), ldb )
224 $
CALL zswap( nrhs, b( k-1, 1 ), ldb, b( kp, 1 ), ldb )
229 CALL zgeru( k-2, nrhs, -one, a( 1, k ), 1, b( k, 1 ),
232 CALL zgeru( k-2, nrhs, -one, a( 1, k-1 ), 1, b( k-1, 1 ),
233 $ ldb, b( 1, 1 ), ldb )
238 akm1 = a( k-1, k-1 ) / akm1k
239 ak = a( k, k ) / akm1k
240 denom = akm1*ak - one
242 bkm1 = b( k-1, j ) / akm1k
243 bk = b( k, j ) / akm1k
244 b( k-1, j ) = ( ak*bkm1-bk ) / denom
245 b( k, j ) = ( akm1*bk-bkm1 ) / denom
266 IF( ipiv( k ).GT.0 )
THEN
273 CALL zgemv(
'Transpose', k-1, nrhs, -one, b, ldb, a( 1,
275 $ 1, one, b( k, 1 ), ldb )
281 $
CALL zswap( nrhs, b( k, 1 ), ldb, b( kp, 1 ), ldb )
290 CALL zgemv(
'Transpose', k-1, nrhs, -one, b, ldb, a( 1,
292 $ 1, one, b( k, 1 ), ldb )
293 CALL zgemv(
'Transpose', k-1, nrhs, -one, b, ldb,
294 $ a( 1, k+1 ), 1, one, b( k+1, 1 ), ldb )
300 $
CALL zswap( nrhs, b( k, 1 ), ldb, b( kp, 1 ), ldb )
324 IF( ipiv( k ).GT.0 )
THEN
332 $
CALL zswap( nrhs, b( k, 1 ), ldb, b( kp, 1 ), ldb )
338 $
CALL zgeru( n-k, nrhs, -one, a( k+1, k ), 1, b( k,
340 $ ldb, b( k+1, 1 ), ldb )
344 CALL zscal( nrhs, one / a( k, k ), b( k, 1 ), ldb )
354 $
CALL zswap( nrhs, b( k+1, 1 ), ldb, b( kp, 1 ), ldb )
360 CALL zgeru( n-k-1, nrhs, -one, a( k+2, k ), 1, b( k,
362 $ ldb, b( k+2, 1 ), ldb )
363 CALL zgeru( n-k-1, nrhs, -one, a( k+2, k+1 ), 1,
364 $ b( k+1, 1 ), ldb, b( k+2, 1 ), ldb )
370 akm1 = a( k, k ) / akm1k
371 ak = a( k+1, k+1 ) / akm1k
372 denom = akm1*ak - one
374 bkm1 = b( k, j ) / akm1k
375 bk = b( k+1, j ) / akm1k
376 b( k, j ) = ( ak*bkm1-bk ) / denom
377 b( k+1, j ) = ( akm1*bk-bkm1 ) / denom
398 IF( ipiv( k ).GT.0 )
THEN
406 $
CALL zgemv(
'Transpose', n-k, nrhs, -one, b( k+1, 1 ),
407 $ ldb, a( k+1, k ), 1, one, b( k, 1 ), ldb )
413 $
CALL zswap( nrhs, b( k, 1 ), ldb, b( kp, 1 ), ldb )
423 CALL zgemv(
'Transpose', n-k, nrhs, -one, b( k+1, 1 ),
424 $ ldb, a( k+1, k ), 1, one, b( k, 1 ), ldb )
425 CALL zgemv(
'Transpose', n-k, nrhs, -one, b( k+1, 1 ),
426 $ ldb, a( k+1, k-1 ), 1, one, b( k-1, 1 ),
434 $
CALL zswap( nrhs, b( k, 1 ), ldb, b( kp, 1 ), ldb )