141 INTEGER INFO, LDA, LDB, N, NRHS
145 COMPLEX*16 A( LDA, * ), B( LDB, * )
152 parameter( one = ( 1.0d+0, 0.0d+0 ) )
158 COMPLEX*16 AK, AKM1, AKM1K, BK, BKM1, DENOM
169 INTRINSIC dconjg, max, dble
174 upper = lsame( uplo,
'U' )
175 IF( .NOT.upper .AND. .NOT.lsame( uplo,
'L' ) )
THEN
177 ELSE IF( n.LT.0 )
THEN
179 ELSE IF( nrhs.LT.0 )
THEN
181 ELSE IF( lda.LT.max( 1, n ) )
THEN
183 ELSE IF( ldb.LT.max( 1, n ) )
THEN
187 CALL xerbla(
'ZHETRS_ROOK', -info )
193 IF( n.EQ.0 .OR. nrhs.EQ.0 )
213 IF( ipiv( k ).GT.0 )
THEN
221 $
CALL zswap( nrhs, b( k, 1 ), ldb, b( kp, 1 ), ldb )
226 CALL zgeru( k-1, nrhs, -one, a( 1, k ), 1, b( k, 1 ),
232 s = dble( one ) / dble( a( k, k ) )
233 CALL zdscal( nrhs, s, b( k, 1 ), ldb )
243 $
CALL zswap( nrhs, b( k, 1 ), ldb, b( kp, 1 ), ldb )
247 $
CALL zswap( nrhs, b( k-1, 1 ), ldb, b( kp, 1 ), ldb )
252 CALL zgeru( k-2, nrhs, -one, a( 1, k ), 1, b( k, 1 ),
255 CALL zgeru( k-2, nrhs, -one, a( 1, k-1 ), 1, b( k-1, 1 ),
256 $ ldb, b( 1, 1 ), ldb )
261 akm1 = a( k-1, k-1 ) / akm1k
262 ak = a( k, k ) / dconjg( akm1k )
263 denom = akm1*ak - one
265 bkm1 = b( k-1, j ) / akm1k
266 bk = b( k, j ) / dconjg( akm1k )
267 b( k-1, j ) = ( ak*bkm1-bk ) / denom
268 b( k, j ) = ( akm1*bk-bkm1 ) / denom
289 IF( ipiv( k ).GT.0 )
THEN
297 CALL zlacgv( nrhs, b( k, 1 ), ldb )
298 CALL zgemv(
'Conjugate transpose', k-1, nrhs, -one, b,
299 $ ldb, a( 1, k ), 1, one, b( k, 1 ), ldb )
300 CALL zlacgv( nrhs, b( k, 1 ), ldb )
307 $
CALL zswap( nrhs, b( k, 1 ), ldb, b( kp, 1 ), ldb )
317 CALL zlacgv( nrhs, b( k, 1 ), ldb )
318 CALL zgemv(
'Conjugate transpose', k-1, nrhs, -one, b,
319 $ ldb, a( 1, k ), 1, one, b( k, 1 ), ldb )
320 CALL zlacgv( nrhs, b( k, 1 ), ldb )
322 CALL zlacgv( nrhs, b( k+1, 1 ), ldb )
323 CALL zgemv(
'Conjugate transpose', k-1, nrhs, -one, b,
324 $ ldb, a( 1, k+1 ), 1, one, b( k+1, 1 ), ldb )
325 CALL zlacgv( nrhs, b( k+1, 1 ), ldb )
332 $
CALL zswap( nrhs, b( k, 1 ), ldb, b( kp, 1 ), ldb )
336 $
CALL zswap( nrhs, b( k+1, 1 ), ldb, b( kp, 1 ), ldb )
361 IF( ipiv( k ).GT.0 )
THEN
369 $
CALL zswap( nrhs, b( k, 1 ), ldb, b( kp, 1 ), ldb )
375 $
CALL zgeru( n-k, nrhs, -one, a( k+1, k ), 1, b( k,
377 $ ldb, b( k+1, 1 ), ldb )
381 s = dble( one ) / dble( a( k, k ) )
382 CALL zdscal( nrhs, s, b( k, 1 ), ldb )
392 $
CALL zswap( nrhs, b( k, 1 ), ldb, b( kp, 1 ), ldb )
396 $
CALL zswap( nrhs, b( k+1, 1 ), ldb, b( kp, 1 ), ldb )
402 CALL zgeru( n-k-1, nrhs, -one, a( k+2, k ), 1, b( k,
404 $ ldb, b( k+2, 1 ), ldb )
405 CALL zgeru( n-k-1, nrhs, -one, a( k+2, k+1 ), 1,
406 $ b( k+1, 1 ), ldb, b( k+2, 1 ), ldb )
412 akm1 = a( k, k ) / dconjg( akm1k )
413 ak = a( k+1, k+1 ) / akm1k
414 denom = akm1*ak - one
416 bkm1 = b( k, j ) / dconjg( akm1k )
417 bk = b( k+1, j ) / akm1k
418 b( k, j ) = ( ak*bkm1-bk ) / denom
419 b( k+1, j ) = ( akm1*bk-bkm1 ) / denom
440 IF( ipiv( k ).GT.0 )
THEN
448 CALL zlacgv( nrhs, b( k, 1 ), ldb )
449 CALL zgemv(
'Conjugate transpose', n-k, nrhs, -one,
450 $ b( k+1, 1 ), ldb, a( k+1, k ), 1, one,
452 CALL zlacgv( nrhs, b( k, 1 ), ldb )
459 $
CALL zswap( nrhs, b( k, 1 ), ldb, b( kp, 1 ), ldb )
469 CALL zlacgv( nrhs, b( k, 1 ), ldb )
470 CALL zgemv(
'Conjugate transpose', n-k, nrhs, -one,
471 $ b( k+1, 1 ), ldb, a( k+1, k ), 1, one,
473 CALL zlacgv( nrhs, b( k, 1 ), ldb )
475 CALL zlacgv( nrhs, b( k-1, 1 ), ldb )
476 CALL zgemv(
'Conjugate transpose', n-k, nrhs, -one,
477 $ b( k+1, 1 ), ldb, a( k+1, k-1 ), 1, one,
479 CALL zlacgv( nrhs, b( k-1, 1 ), ldb )
486 $
CALL zswap( nrhs, b( k, 1 ), ldb, b( kp, 1 ), ldb )
490 $
CALL zswap( nrhs, b( k-1, 1 ), ldb, b( kp, 1 ), ldb )