114 SUBROUTINE zhptrs( UPLO, N, NRHS, AP, IPIV, B, LDB, INFO )
122 INTEGER INFO, LDB, N, NRHS
126 COMPLEX*16 AP( * ), B( LDB, * )
133 parameter( one = ( 1.0d+0, 0.0d+0 ) )
139 COMPLEX*16 AK, AKM1, AKM1K, BK, BKM1, DENOM
149 INTRINSIC dble, dconjg, max
154 upper = lsame( uplo,
'U' )
155 IF( .NOT.upper .AND. .NOT.lsame( uplo,
'L' ) )
THEN
157 ELSE IF( n.LT.0 )
THEN
159 ELSE IF( nrhs.LT.0 )
THEN
161 ELSE IF( ldb.LT.max( 1, n ) )
THEN
165 CALL xerbla(
'ZHPTRS', -info )
171 IF( n.EQ.0 .OR. nrhs.EQ.0 )
184 kc = n*( n+1 ) / 2 + 1
193 IF( ipiv( k ).GT.0 )
THEN
201 $
CALL zswap( nrhs, b( k, 1 ), ldb, b( kp, 1 ), ldb )
206 CALL zgeru( k-1, nrhs, -one, ap( kc ), 1, b( k, 1 ), ldb,
211 s = dble( one ) / dble( ap( kc+k-1 ) )
212 CALL zdscal( nrhs, s, b( k, 1 ), ldb )
222 $
CALL zswap( nrhs, b( k-1, 1 ), ldb, b( kp, 1 ), ldb )
227 CALL zgeru( k-2, nrhs, -one, ap( kc ), 1, b( k, 1 ), ldb,
229 CALL zgeru( k-2, nrhs, -one, ap( kc-( k-1 ) ), 1,
230 $ b( k-1, 1 ), ldb, b( 1, 1 ), ldb )
235 akm1 = ap( kc-1 ) / akm1k
236 ak = ap( kc+k-1 ) / dconjg( akm1k )
237 denom = akm1*ak - one
239 bkm1 = b( k-1, j ) / akm1k
240 bk = b( k, j ) / dconjg( akm1k )
241 b( k-1, j ) = ( ak*bkm1-bk ) / denom
242 b( k, j ) = ( akm1*bk-bkm1 ) / denom
265 IF( ipiv( k ).GT.0 )
THEN
273 CALL zlacgv( nrhs, b( k, 1 ), ldb )
274 CALL zgemv(
'Conjugate transpose', k-1, nrhs, -one, b,
275 $ ldb, ap( kc ), 1, one, b( k, 1 ), ldb )
276 CALL zlacgv( nrhs, b( k, 1 ), ldb )
283 $
CALL zswap( nrhs, b( k, 1 ), ldb, b( kp, 1 ), ldb )
294 CALL zlacgv( nrhs, b( k, 1 ), ldb )
295 CALL zgemv(
'Conjugate transpose', k-1, nrhs, -one, b,
296 $ ldb, ap( kc ), 1, one, b( k, 1 ), ldb )
297 CALL zlacgv( nrhs, b( k, 1 ), ldb )
299 CALL zlacgv( nrhs, b( k+1, 1 ), ldb )
300 CALL zgemv(
'Conjugate transpose', k-1, nrhs, -one, b,
301 $ ldb, ap( kc+k ), 1, one, b( k+1, 1 ), ldb )
302 CALL zlacgv( nrhs, b( k+1, 1 ), ldb )
309 $
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, ap( kc+1 ), 1, b( k, 1 ),
350 $ ldb, b( k+1, 1 ), ldb )
354 s = dble( one ) / dble( ap( kc ) )
355 CALL zdscal( nrhs, s, b( k, 1 ), ldb )
366 $
CALL zswap( nrhs, b( k+1, 1 ), ldb, b( kp, 1 ), ldb )
372 CALL zgeru( n-k-1, nrhs, -one, ap( kc+2 ), 1, b( k, 1 ),
373 $ ldb, b( k+2, 1 ), ldb )
374 CALL zgeru( n-k-1, nrhs, -one, ap( kc+n-k+2 ), 1,
375 $ b( k+1, 1 ), ldb, b( k+2, 1 ), ldb )
381 akm1 = ap( kc ) / dconjg( akm1k )
382 ak = ap( kc+n-k+1 ) / akm1k
383 denom = akm1*ak - one
385 bkm1 = b( k, j ) / dconjg( akm1k )
386 bk = b( k+1, j ) / akm1k
387 b( k, j ) = ( ak*bkm1-bk ) / denom
388 b( k+1, j ) = ( akm1*bk-bkm1 ) / denom
390 kc = kc + 2*( n-k ) + 1
403 kc = n*( n+1 ) / 2 + 1
412 IF( ipiv( k ).GT.0 )
THEN
420 CALL zlacgv( nrhs, b( k, 1 ), ldb )
421 CALL zgemv(
'Conjugate transpose', n-k, nrhs, -one,
422 $ b( k+1, 1 ), ldb, ap( kc+1 ), 1, one,
424 CALL zlacgv( nrhs, b( k, 1 ), ldb )
431 $
CALL zswap( nrhs, b( k, 1 ), ldb, b( kp, 1 ), ldb )
441 CALL zlacgv( nrhs, b( k, 1 ), ldb )
442 CALL zgemv(
'Conjugate transpose', n-k, nrhs, -one,
443 $ b( k+1, 1 ), ldb, ap( kc+1 ), 1, one,
445 CALL zlacgv( nrhs, b( k, 1 ), ldb )
447 CALL zlacgv( nrhs, b( k-1, 1 ), ldb )
448 CALL zgemv(
'Conjugate transpose', n-k, nrhs, -one,
449 $ b( k+1, 1 ), ldb, ap( kc-( n-k ) ), 1, one,
451 CALL zlacgv( nrhs, b( k-1, 1 ), ldb )
458 $
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 zhptrs(uplo, n, nrhs, ap, ipiv, b, ldb, info)
ZHPTRS
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