161 SUBROUTINE zhetrs_3( UPLO, N, NRHS, A, LDA, E, IPIV, B, LDB,
170 INTEGER INFO, LDA, LDB, N, NRHS
174 COMPLEX*16 A( LDA, * ), B( LDB, * ), E( * )
181 parameter( one = ( 1.0d+0,0.0d+0 ) )
187 COMPLEX*16 AK, AKM1, AKM1K, BK, BKM1, DENOM
197 INTRINSIC abs, dble, dconjg, max
202 upper = lsame( uplo,
'U' )
203 IF( .NOT.upper .AND. .NOT.lsame( uplo,
'L' ) )
THEN
205 ELSE IF( n.LT.0 )
THEN
207 ELSE IF( nrhs.LT.0 )
THEN
209 ELSE IF( lda.LT.max( 1, n ) )
THEN
211 ELSE IF( ldb.LT.max( 1, n ) )
THEN
215 CALL xerbla(
'ZHETRS_3', -info )
221 IF( n.EQ.0 .OR. nrhs.EQ.0 )
240 kp = abs( ipiv( k ) )
242 CALL zswap( nrhs, b( k, 1 ), ldb, b( kp, 1 ), ldb )
248 CALL ztrsm(
'L',
'U',
'N',
'U', n, nrhs, one, a, lda, b,
255 IF( ipiv( i ).GT.0 )
THEN
256 s = dble( one ) / dble( a( i, i ) )
257 CALL zdscal( nrhs, s, b( i, 1 ), ldb )
258 ELSE IF ( i.GT.1 )
THEN
260 akm1 = a( i-1, i-1 ) / akm1k
261 ak = a( i, i ) / dconjg( akm1k )
262 denom = akm1*ak - one
264 bkm1 = b( i-1, j ) / akm1k
265 bk = b( i, j ) / dconjg( akm1k )
266 b( i-1, j ) = ( ak*bkm1-bk ) / denom
267 b( i, j ) = ( akm1*bk-bkm1 ) / denom
276 CALL ztrsm(
'L',
'U',
'C',
'U', n, nrhs, one, a, lda, b,
289 kp = abs( ipiv( k ) )
291 CALL zswap( nrhs, b( k, 1 ), ldb, b( kp, 1 ), ldb )
310 kp = abs( ipiv( k ) )
312 CALL zswap( nrhs, b( k, 1 ), ldb, b( kp, 1 ), ldb )
318 CALL ztrsm(
'L',
'L',
'N',
'U', n, nrhs, one, a, lda, b,
325 IF( ipiv( i ).GT.0 )
THEN
326 s = dble( one ) / dble( a( i, i ) )
327 CALL zdscal( nrhs, s, b( i, 1 ), ldb )
328 ELSE IF( i.LT.n )
THEN
330 akm1 = a( i, i ) / dconjg( akm1k )
331 ak = a( i+1, i+1 ) / akm1k
332 denom = akm1*ak - one
334 bkm1 = b( i, j ) / dconjg( akm1k )
335 bk = b( i+1, j ) / akm1k
336 b( i, j ) = ( ak*bkm1-bk ) / denom
337 b( i+1, j ) = ( akm1*bk-bkm1 ) / denom
346 CALL ztrsm(
'L',
'L',
'C',
'U', n, nrhs, one, a, lda, b,
359 kp = abs( ipiv( k ) )
361 CALL zswap( nrhs, b( k, 1 ), ldb, b( kp, 1 ), ldb )