119 SUBROUTINE zhetrs( UPLO, N, NRHS, A, LDA, IPIV, B, LDB, INFO )
127 INTEGER INFO, LDA, LDB, N, NRHS
131 COMPLEX*16 A( LDA, * ), B( LDB, * )
138 parameter( one = ( 1.0d+0, 0.0d+0 ) )
144 COMPLEX*16 AK, AKM1, AKM1K, BK, BKM1, DENOM
154 INTRINSIC dble, dconjg, max
159 upper = lsame( uplo,
'U' )
160 IF( .NOT.upper .AND. .NOT.lsame( uplo,
'L' ) )
THEN
162 ELSE IF( n.LT.0 )
THEN
164 ELSE IF( nrhs.LT.0 )
THEN
166 ELSE IF( lda.LT.max( 1, n ) )
THEN
168 ELSE IF( ldb.LT.max( 1, n ) )
THEN
172 CALL xerbla(
'ZHETRS', -info )
178 IF( n.EQ.0 .OR. nrhs.EQ.0 )
198 IF( ipiv( k ).GT.0 )
THEN
206 $
CALL zswap( nrhs, b( k, 1 ), ldb, b( kp, 1 ), ldb )
211 CALL zgeru( k-1, nrhs, -one, a( 1, k ), 1, b( k, 1 ), ldb,
216 s = dble( one ) / dble( a( k, k ) )
217 CALL zdscal( nrhs, s, b( k, 1 ), ldb )
227 $
CALL zswap( nrhs, b( k-1, 1 ), ldb, b( kp, 1 ), ldb )
232 CALL zgeru( k-2, nrhs, -one, a( 1, k ), 1, b( k, 1 ), ldb,
234 CALL zgeru( k-2, nrhs, -one, a( 1, k-1 ), 1, b( k-1, 1 ),
235 $ ldb, b( 1, 1 ), ldb )
240 akm1 = a( k-1, k-1 ) / akm1k
241 ak = a( k, k ) / dconjg( akm1k )
242 denom = akm1*ak - one
244 bkm1 = b( k-1, j ) / akm1k
245 bk = b( k, j ) / dconjg( akm1k )
246 b( k-1, j ) = ( ak*bkm1-bk ) / denom
247 b( k, j ) = ( akm1*bk-bkm1 ) / denom
268 IF( ipiv( k ).GT.0 )
THEN
276 CALL zlacgv( nrhs, b( k, 1 ), ldb )
277 CALL zgemv(
'Conjugate transpose', k-1, nrhs, -one, b,
278 $ ldb, a( 1, k ), 1, one, b( k, 1 ), ldb )
279 CALL zlacgv( nrhs, b( k, 1 ), ldb )
286 $
CALL zswap( nrhs, b( k, 1 ), ldb, b( kp, 1 ), ldb )
296 CALL zlacgv( nrhs, b( k, 1 ), ldb )
297 CALL zgemv(
'Conjugate transpose', k-1, nrhs, -one, b,
298 $ ldb, a( 1, k ), 1, one, b( k, 1 ), ldb )
299 CALL zlacgv( nrhs, b( k, 1 ), ldb )
301 CALL zlacgv( nrhs, b( k+1, 1 ), ldb )
302 CALL zgemv(
'Conjugate transpose', k-1, nrhs, -one, b,
303 $ ldb, a( 1, k+1 ), 1, one, b( k+1, 1 ), ldb )
304 CALL zlacgv( nrhs, b( k+1, 1 ), ldb )
311 $
CALL zswap( nrhs, b( k, 1 ), ldb, b( kp, 1 ), ldb )
335 IF( ipiv( k ).GT.0 )
THEN
343 $
CALL zswap( nrhs, b( k, 1 ), ldb, b( kp, 1 ), ldb )
349 $
CALL zgeru( n-k, nrhs, -one, a( k+1, k ), 1, b( k, 1 ),
350 $ ldb, b( k+1, 1 ), ldb )
354 s = dble( one ) / dble( a( k, k ) )
355 CALL zdscal( nrhs, s, b( k, 1 ), ldb )
365 $
CALL zswap( nrhs, b( k+1, 1 ), ldb, b( kp, 1 ), ldb )
371 CALL zgeru( n-k-1, nrhs, -one, a( k+2, k ), 1, b( k, 1 ),
372 $ ldb, b( k+2, 1 ), ldb )
373 CALL zgeru( n-k-1, nrhs, -one, a( k+2, k+1 ), 1,
374 $ b( k+1, 1 ), ldb, b( k+2, 1 ), ldb )
380 akm1 = a( k, k ) / dconjg( akm1k )
381 ak = a( k+1, k+1 ) / akm1k
382 denom = akm1*ak - one
384 bkm1 = b( k, j ) / dconjg( akm1k )
385 bk = b( k+1, j ) / akm1k
386 b( k, j ) = ( ak*bkm1-bk ) / denom
387 b( k+1, j ) = ( akm1*bk-bkm1 ) / denom
408 IF( ipiv( k ).GT.0 )
THEN
416 CALL zlacgv( nrhs, b( k, 1 ), ldb )
417 CALL zgemv(
'Conjugate transpose', n-k, nrhs, -one,
418 $ b( k+1, 1 ), ldb, a( k+1, k ), 1, one,
420 CALL zlacgv( nrhs, b( k, 1 ), ldb )
427 $
CALL zswap( nrhs, b( k, 1 ), ldb, b( kp, 1 ), ldb )
437 CALL zlacgv( nrhs, b( k, 1 ), ldb )
438 CALL zgemv(
'Conjugate transpose', n-k, nrhs, -one,
439 $ b( k+1, 1 ), ldb, a( k+1, k ), 1, one,
441 CALL zlacgv( nrhs, b( k, 1 ), ldb )
443 CALL zlacgv( nrhs, b( k-1, 1 ), ldb )
444 CALL zgemv(
'Conjugate transpose', n-k, nrhs, -one,
445 $ b( k+1, 1 ), ldb, a( k+1, k-1 ), 1, one,
447 CALL zlacgv( nrhs, b( k-1, 1 ), ldb )
454 $
CALL zswap( nrhs, b( k, 1 ), ldb, b( kp, 1 ), ldb )
subroutine xerbla(srname, info)
subroutine zgemv(trans, m, n, alpha, a, lda, x, incx, beta, y, incy)
ZGEMV
subroutine zgeru(m, n, alpha, x, incx, y, incy, a, lda)
ZGERU
subroutine zhetrs(uplo, n, nrhs, a, lda, ipiv, b, ldb, info)
ZHETRS
subroutine zlacgv(n, x, incx)
ZLACGV conjugates a complex vector.
subroutine zdscal(n, da, zx, incx)
ZDSCAL
subroutine zswap(n, zx, incx, zy, incy)
ZSWAP