151 SUBROUTINE zlavhe( UPLO, TRANS, DIAG, N, NRHS, A, LDA, IPIV, B,
159 CHARACTER DIAG, TRANS, UPLO
160 INTEGER INFO, LDA, LDB, N, NRHS
164 COMPLEX*16 A( LDA, * ), B( LDB, * )
171 parameter( one = ( 1.0d+0, 0.0d+0 ) )
176 COMPLEX*16 D11, D12, D21, D22, T1, T2
186 INTRINSIC abs, dconjg, max
193 IF( .NOT.lsame( uplo,
'U' ) .AND. .NOT.lsame( uplo,
'L' ) )
THEN
195 ELSE IF( .NOT.lsame( trans,
'N' ) .AND. .NOT.lsame( trans,
'C' ) )
198 ELSE IF( .NOT.lsame( diag,
'U' ) .AND. .NOT.lsame( diag,
'N' ) )
201 ELSE IF( n.LT.0 )
THEN
203 ELSE IF( lda.LT.max( 1, n ) )
THEN
205 ELSE IF( ldb.LT.max( 1, n ) )
THEN
209 CALL xerbla(
'ZLAVHE ', -info )
218 nounit = lsame( diag,
'N' )
224 IF( lsame( trans,
'N' ) )
THEN
229 IF( lsame( uplo,
'U' ) )
THEN
237 IF( ipiv( k ).GT.0 )
THEN
244 $
CALL zscal( nrhs, a( k, k ), b( k, 1 ), ldb )
252 CALL zgeru( k-1, nrhs, one, a( 1, k ), 1, b( k, 1 ),
253 $ ldb, b( 1, 1 ), ldb )
259 $
CALL zswap( nrhs, b( k, 1 ), ldb, b( kp, 1 ), ldb )
276 b( k, j ) = d11*t1 + d12*t2
277 b( k+1, j ) = d21*t1 + d22*t2
287 CALL zgeru( k-1, nrhs, one, a( 1, k ), 1, b( k, 1 ),
288 $ ldb, b( 1, 1 ), ldb )
289 CALL zgeru( k-1, nrhs, one, a( 1, k+1 ), 1,
290 $ b( k+1, 1 ), ldb, b( 1, 1 ), ldb )
294 kp = abs( ipiv( k ) )
296 $
CALL zswap( nrhs, b( k, 1 ), ldb, b( kp, 1 ), ldb )
318 IF( ipiv( k ).GT.0 )
THEN
325 $
CALL zscal( nrhs, a( k, k ), b( k, 1 ), ldb )
334 CALL zgeru( n-k, nrhs, one, a( k+1, k ), 1, b( k, 1 ),
335 $ ldb, b( k+1, 1 ), ldb )
341 $
CALL zswap( nrhs, b( k, 1 ), ldb, b( kp, 1 ), ldb )
359 b( k-1, j ) = d11*t1 + d12*t2
360 b( k, j ) = d21*t1 + d22*t2
370 CALL zgeru( n-k, nrhs, one, a( k+1, k ), 1, b( k, 1 ),
371 $ ldb, b( k+1, 1 ), ldb )
372 CALL zgeru( n-k, nrhs, one, a( k+1, k-1 ), 1,
373 $ b( k-1, 1 ), ldb, b( k+1, 1 ), ldb )
378 kp = abs( ipiv( k ) )
380 $
CALL zswap( nrhs, b( k, 1 ), ldb, b( kp, 1 ), ldb )
398 IF( lsame( uplo,
'U' ) )
THEN
409 IF( ipiv( k ).GT.0 )
THEN
416 $
CALL zswap( nrhs, b( k, 1 ), ldb, b( kp, 1 ), ldb )
422 CALL zlacgv( nrhs, b( k, 1 ), ldb )
423 CALL zgemv(
'Conjugate', k-1, nrhs, one, b, ldb,
424 $ a( 1, k ), 1, one, b( k, 1 ), ldb )
425 CALL zlacgv( nrhs, b( k, 1 ), ldb )
428 $
CALL zscal( nrhs, a( k, k ), b( k, 1 ), ldb )
438 kp = abs( ipiv( k ) )
440 $
CALL zswap( nrhs, b( k-1, 1 ), ldb, b( kp, 1 ),
448 CALL zlacgv( nrhs, b( k, 1 ), ldb )
449 CALL zgemv(
'Conjugate', k-2, nrhs, one, b, ldb,
450 $ a( 1, k ), 1, one, b( k, 1 ), ldb )
451 CALL zlacgv( nrhs, b( k, 1 ), ldb )
453 CALL zlacgv( nrhs, b( k-1, 1 ), ldb )
454 CALL zgemv(
'Conjugate', k-2, nrhs, one, b, ldb,
455 $ a( 1, k-1 ), 1, one, b( k-1, 1 ), ldb )
456 CALL zlacgv( nrhs, b( k-1, 1 ), ldb )
469 b( k-1, j ) = d11*t1 + d12*t2
470 b( k, j ) = d21*t1 + d22*t2
493 IF( ipiv( k ).GT.0 )
THEN
500 $
CALL zswap( nrhs, b( k, 1 ), ldb, b( kp, 1 ), ldb )
504 CALL zlacgv( nrhs, b( k, 1 ), ldb )
505 CALL zgemv(
'Conjugate', n-k, nrhs, one, b( k+1, 1 ),
506 $ ldb, a( k+1, k ), 1, one, b( k, 1 ), ldb )
507 CALL zlacgv( nrhs, b( k, 1 ), ldb )
510 $
CALL zscal( nrhs, a( k, k ), b( k, 1 ), ldb )
520 kp = abs( ipiv( k ) )
522 $
CALL zswap( nrhs, b( k+1, 1 ), ldb, b( kp, 1 ),
527 CALL zlacgv( nrhs, b( k+1, 1 ), ldb )
528 CALL zgemv(
'Conjugate', n-k-1, nrhs, one,
529 $ b( k+2, 1 ), ldb, a( k+2, k+1 ), 1, one,
531 CALL zlacgv( nrhs, b( k+1, 1 ), ldb )
533 CALL zlacgv( nrhs, b( k, 1 ), ldb )
534 CALL zgemv(
'Conjugate', n-k-1, nrhs, one,
535 $ b( k+2, 1 ), ldb, a( k+2, k ), 1, one,
537 CALL zlacgv( nrhs, b( k, 1 ), ldb )
550 b( k, j ) = d11*t1 + d12*t2
551 b( k+1, j ) = d21*t1 + d22*t2