119 SUBROUTINE chetrs( UPLO, N, NRHS, A, LDA, IPIV, B, LDB, INFO )
127 INTEGER INFO, LDA, LDB, N, NRHS
131 COMPLEX A( LDA, * ), B( LDB, * )
138 parameter( one = ( 1.0e+0, 0.0e+0 ) )
144 COMPLEX AK, AKM1, AKM1K, BK, BKM1, DENOM
154 INTRINSIC conjg, max, real
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(
'CHETRS', -info )
178 IF( n.EQ.0 .OR. nrhs.EQ.0 )
198 IF( ipiv( k ).GT.0 )
THEN
206 $
CALL cswap( nrhs, b( k, 1 ), ldb, b( kp, 1 ), ldb )
211 CALL cgeru( k-1, nrhs, -one, a( 1, k ), 1, b( k, 1 ), ldb,
216 s = real( one ) / real( a( k, k ) )
217 CALL csscal( nrhs, s, b( k, 1 ), ldb )
227 $
CALL cswap( nrhs, b( k-1, 1 ), ldb, b( kp, 1 ), ldb )
232 CALL cgeru( k-2, nrhs, -one, a( 1, k ), 1, b( k, 1 ), ldb,
234 CALL cgeru( 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 ) / conjg( akm1k )
242 denom = akm1*ak - one
244 bkm1 = b( k-1, j ) / akm1k
245 bk = b( k, j ) / conjg( 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 clacgv( nrhs, b( k, 1 ), ldb )
277 CALL cgemv(
'Conjugate transpose', k-1, nrhs, -one, b,
278 $ ldb, a( 1, k ), 1, one, b( k, 1 ), ldb )
279 CALL clacgv( nrhs, b( k, 1 ), ldb )
286 $
CALL cswap( nrhs, b( k, 1 ), ldb, b( kp, 1 ), ldb )
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 )
301 CALL clacgv( nrhs, b( k+1, 1 ), ldb )
302 CALL cgemv(
'Conjugate transpose', k-1, nrhs, -one, b,
303 $ ldb, a( 1, k+1 ), 1, one, b( k+1, 1 ), ldb )
304 CALL clacgv( nrhs, b( k+1, 1 ), ldb )
311 $
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, a( k+1, k ), 1, b( k, 1 ),
350 $ ldb, b( k+1, 1 ), ldb )
354 s = real( one ) / real( a( k, k ) )
355 CALL csscal( nrhs, s, b( k, 1 ), ldb )
365 $
CALL cswap( nrhs, b( k+1, 1 ), ldb, b( kp, 1 ), ldb )
371 CALL cgeru( n-k-1, nrhs, -one, a( k+2, k ), 1, b( k, 1 ),
372 $ ldb, b( k+2, 1 ), ldb )
373 CALL cgeru( 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 ) / conjg( akm1k )
381 ak = a( k+1, k+1 ) / akm1k
382 denom = akm1*ak - one
384 bkm1 = b( k, j ) / conjg( 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 clacgv( nrhs, b( k, 1 ), ldb )
417 CALL cgemv(
'Conjugate transpose', n-k, nrhs, -one,
418 $ b( k+1, 1 ), ldb, a( k+1, k ), 1, one,
420 CALL clacgv( nrhs, b( k, 1 ), ldb )
427 $
CALL cswap( nrhs, b( k, 1 ), ldb, b( kp, 1 ), ldb )
437 CALL clacgv( nrhs, b( k, 1 ), ldb )
438 CALL cgemv(
'Conjugate transpose', n-k, nrhs, -one,
439 $ b( k+1, 1 ), ldb, a( k+1, k ), 1, one,
441 CALL clacgv( nrhs, b( k, 1 ), ldb )
443 CALL clacgv( nrhs, b( k-1, 1 ), ldb )
444 CALL cgemv(
'Conjugate transpose', n-k, nrhs, -one,
445 $ b( k+1, 1 ), ldb, a( k+1, k-1 ), 1, one,
447 CALL clacgv( nrhs, b( k-1, 1 ), ldb )
454 $
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 chetrs(uplo, n, nrhs, a, lda, ipiv, b, ldb, info)
CHETRS
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