143 INTEGER INFO, LDA, LDB, N, NRHS
147 COMPLEX A( LDA, * ), B( LDB, * )
154 parameter( one = ( 1.0e+0, 0.0e+0 ) )
160 COMPLEX AK, AKM1, AKM1K, BK, BKM1, DENOM
170 INTRINSIC conjg, max, real
175 upper = lsame( uplo,
'U' )
176 IF( .NOT.upper .AND. .NOT.lsame( uplo,
'L' ) )
THEN
178 ELSE IF( n.LT.0 )
THEN
180 ELSE IF( nrhs.LT.0 )
THEN
182 ELSE IF( lda.LT.max( 1, n ) )
THEN
184 ELSE IF( ldb.LT.max( 1, n ) )
THEN
188 CALL xerbla(
'CHETRS_ROOK', -info )
194 IF( n.EQ.0 .OR. nrhs.EQ.0 )
214 IF( ipiv( k ).GT.0 )
THEN
222 $
CALL cswap( nrhs, b( k, 1 ), ldb, b( kp, 1 ), ldb )
227 CALL cgeru( k-1, nrhs, -one, a( 1, k ), 1, b( k, 1 ), ldb,
232 s = real( one ) / real( a( k, k ) )
233 CALL csscal( nrhs, s, b( k, 1 ), ldb )
243 $
CALL cswap( nrhs, b( k, 1 ), ldb, b( kp, 1 ), ldb )
247 $
CALL cswap( nrhs, b( k-1, 1 ), ldb, b( kp, 1 ), ldb )
252 CALL cgeru( k-2, nrhs, -one, a( 1, k ), 1, b( k, 1 ), ldb,
254 CALL cgeru( k-2, nrhs, -one, a( 1, k-1 ), 1, b( k-1, 1 ),
255 $ ldb, b( 1, 1 ), ldb )
260 akm1 = a( k-1, k-1 ) / akm1k
261 ak = a( k, k ) / conjg( akm1k )
262 denom = akm1*ak - one
264 bkm1 = b( k-1, j ) / akm1k
265 bk = b( k, j ) / conjg( akm1k )
266 b( k-1, j ) = ( ak*bkm1-bk ) / denom
267 b( k, j ) = ( akm1*bk-bkm1 ) / denom
288 IF( ipiv( k ).GT.0 )
THEN
296 CALL clacgv( nrhs, b( k, 1 ), ldb )
297 CALL cgemv(
'Conjugate transpose', k-1, nrhs, -one, b,
298 $ ldb, a( 1, k ), 1, one, b( k, 1 ), ldb )
299 CALL clacgv( nrhs, b( k, 1 ), ldb )
306 $
CALL cswap( nrhs, b( k, 1 ), ldb, b( kp, 1 ), ldb )
316 CALL clacgv( nrhs, b( k, 1 ), ldb )
317 CALL cgemv(
'Conjugate transpose', k-1, nrhs, -one, b,
318 $ ldb, a( 1, k ), 1, one, b( k, 1 ), ldb )
319 CALL clacgv( nrhs, b( k, 1 ), ldb )
321 CALL clacgv( nrhs, b( k+1, 1 ), ldb )
322 CALL cgemv(
'Conjugate transpose', k-1, nrhs, -one, b,
323 $ ldb, a( 1, k+1 ), 1, one, b( k+1, 1 ), ldb )
324 CALL clacgv( nrhs, b( k+1, 1 ), ldb )
331 $
CALL cswap( nrhs, b( k, 1 ), ldb, b( kp, 1 ), ldb )
335 $
CALL cswap( nrhs, b( k+1, 1 ), ldb, b( kp, 1 ), ldb )
360 IF( ipiv( k ).GT.0 )
THEN
368 $
CALL cswap( nrhs, b( k, 1 ), ldb, b( kp, 1 ), ldb )
374 $
CALL cgeru( n-k, nrhs, -one, a( k+1, k ), 1, b( k, 1 ),
375 $ ldb, b( k+1, 1 ), ldb )
379 s = real( one ) / real( a( k, k ) )
380 CALL csscal( nrhs, s, b( k, 1 ), ldb )
390 $
CALL cswap( nrhs, b( k, 1 ), ldb, b( kp, 1 ), ldb )
394 $
CALL cswap( nrhs, b( k+1, 1 ), ldb, b( kp, 1 ), ldb )
400 CALL cgeru( n-k-1, nrhs, -one, a( k+2, k ), 1, b( k, 1 ),
401 $ ldb, b( k+2, 1 ), ldb )
402 CALL cgeru( n-k-1, nrhs, -one, a( k+2, k+1 ), 1,
403 $ b( k+1, 1 ), ldb, b( k+2, 1 ), ldb )
409 akm1 = a( k, k ) / conjg( akm1k )
410 ak = a( k+1, k+1 ) / akm1k
411 denom = akm1*ak - one
413 bkm1 = b( k, j ) / conjg( akm1k )
414 bk = b( k+1, j ) / akm1k
415 b( k, j ) = ( ak*bkm1-bk ) / denom
416 b( k+1, j ) = ( akm1*bk-bkm1 ) / denom
437 IF( ipiv( k ).GT.0 )
THEN
445 CALL clacgv( nrhs, b( k, 1 ), ldb )
446 CALL cgemv(
'Conjugate transpose', n-k, nrhs, -one,
447 $ b( k+1, 1 ), ldb, a( k+1, k ), 1, one,
449 CALL clacgv( nrhs, b( k, 1 ), ldb )
456 $
CALL cswap( nrhs, b( k, 1 ), ldb, b( kp, 1 ), ldb )
466 CALL clacgv( nrhs, b( k, 1 ), ldb )
467 CALL cgemv(
'Conjugate transpose', n-k, nrhs, -one,
468 $ b( k+1, 1 ), ldb, a( k+1, k ), 1, one,
470 CALL clacgv( nrhs, b( k, 1 ), ldb )
472 CALL clacgv( nrhs, b( k-1, 1 ), ldb )
473 CALL cgemv(
'Conjugate transpose', n-k, nrhs, -one,
474 $ b( k+1, 1 ), ldb, a( k+1, k-1 ), 1, one,
476 CALL clacgv( nrhs, b( k-1, 1 ), ldb )
483 $
CALL cswap( nrhs, b( k, 1 ), ldb, b( kp, 1 ), ldb )
487 $
CALL cswap( nrhs, b( k-1, 1 ), ldb, b( kp, 1 ), ldb )
subroutine xerbla(srname, info)
subroutine cgemv(trans, m, n, alpha, a, lda, x, incx, beta, y, incy)
CGEMV
subroutine cgeru(m, n, alpha, x, incx, y, incy, a, lda)
CGERU
subroutine chetrs_rook(uplo, n, nrhs, a, lda, ipiv, b, ldb, info)
CHETRS_ROOK computes the solution to a system of linear equations A * X = B for HE matrices using fac...
subroutine clacgv(n, x, incx)
CLACGV conjugates a complex vector.
subroutine csscal(n, sa, cx, incx)
CSSCAL
subroutine cswap(n, cx, incx, cy, incy)
CSWAP