114 SUBROUTINE chptrs( UPLO, N, NRHS, AP, IPIV, B, LDB, INFO )
122 INTEGER INFO, LDB, N, NRHS
126 COMPLEX AP( * ), B( LDB, * )
133 parameter( one = ( 1.0e+0, 0.0e+0 ) )
139 COMPLEX AK, AKM1, AKM1K, BK, BKM1, DENOM
149 INTRINSIC conjg, max, real
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(
'CHPTRS', -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 cswap( nrhs, b( k, 1 ), ldb, b( kp, 1 ), ldb )
206 CALL cgeru( k-1, nrhs, -one, ap( kc ), 1, b( k, 1 ), ldb,
211 s = real( one ) / real( ap( kc+k-1 ) )
212 CALL csscal( nrhs, s, b( k, 1 ), ldb )
222 $
CALL cswap( nrhs, b( k-1, 1 ), ldb, b( kp, 1 ), ldb )
227 CALL cgeru( k-2, nrhs, -one, ap( kc ), 1, b( k, 1 ), ldb,
229 CALL cgeru( 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 ) / conjg( akm1k )
237 denom = akm1*ak - one
239 bkm1 = b( k-1, j ) / akm1k
240 bk = b( k, j ) / conjg( 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 clacgv( nrhs, b( k, 1 ), ldb )
274 CALL cgemv(
'Conjugate transpose', k-1, nrhs, -one, b,
275 $ ldb, ap( kc ), 1, one, b( k, 1 ), ldb )
276 CALL clacgv( nrhs, b( k, 1 ), ldb )
283 $
CALL cswap( nrhs, b( k, 1 ), ldb, b( kp, 1 ), ldb )
294 CALL clacgv( nrhs, b( k, 1 ), ldb )
295 CALL cgemv(
'Conjugate transpose', k-1, nrhs, -one, b,
296 $ ldb, ap( kc ), 1, one, b( k, 1 ), ldb )
297 CALL clacgv( nrhs, b( k, 1 ), ldb )
299 CALL clacgv( nrhs, b( k+1, 1 ), ldb )
300 CALL cgemv(
'Conjugate transpose', k-1, nrhs, -one, b,
301 $ ldb, ap( kc+k ), 1, one, b( k+1, 1 ), ldb )
302 CALL clacgv( nrhs, b( k+1, 1 ), ldb )
309 $
CALL cswap( nrhs, b( k, 1 ), ldb, b( kp, 1 ), ldb )
335 IF( ipiv( k ).GT.0 )
THEN
343 $
CALL cswap( nrhs, b( k, 1 ), ldb, b( kp, 1 ), ldb )
349 $
CALL cgeru( n-k, nrhs, -one, ap( kc+1 ), 1, b( k, 1 ),
350 $ ldb, b( k+1, 1 ), ldb )
354 s = real( one ) / real( ap( kc ) )
355 CALL csscal( nrhs, s, b( k, 1 ), ldb )
366 $
CALL cswap( nrhs, b( k+1, 1 ), ldb, b( kp, 1 ), ldb )
372 CALL cgeru( n-k-1, nrhs, -one, ap( kc+2 ), 1, b( k, 1 ),
373 $ ldb, b( k+2, 1 ), ldb )
374 CALL cgeru( 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 ) / conjg( akm1k )
382 ak = ap( kc+n-k+1 ) / akm1k
383 denom = akm1*ak - one
385 bkm1 = b( k, j ) / conjg( 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 clacgv( nrhs, b( k, 1 ), ldb )
421 CALL cgemv(
'Conjugate transpose', n-k, nrhs, -one,
422 $ b( k+1, 1 ), ldb, ap( kc+1 ), 1, one,
424 CALL clacgv( nrhs, b( k, 1 ), ldb )
431 $
CALL cswap( nrhs, b( k, 1 ), ldb, b( kp, 1 ), ldb )
441 CALL clacgv( nrhs, b( k, 1 ), ldb )
442 CALL cgemv(
'Conjugate transpose', n-k, nrhs, -one,
443 $ b( k+1, 1 ), ldb, ap( kc+1 ), 1, one,
445 CALL clacgv( nrhs, b( k, 1 ), ldb )
447 CALL clacgv( nrhs, b( k-1, 1 ), ldb )
448 CALL cgemv(
'Conjugate transpose', n-k, nrhs, -one,
449 $ b( k+1, 1 ), ldb, ap( kc-( n-k ) ), 1, one,
451 CALL clacgv( nrhs, b( k-1, 1 ), ldb )
458 $
CALL cswap( nrhs, b( k, 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 chptrs(uplo, n, nrhs, ap, ipiv, b, ldb, info)
CHPTRS
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