151 INTEGER M, NB, J1, LDA, LDH
155 COMPLEX*16 A( LDA, * ), H( LDH, * ), WORK( * )
161 parameter( zero = (0.0d+0, 0.0d+0), one = (1.0d+0, 0.0d+0) )
164 INTEGER J, K, K1, I1, I2, MJ
165 COMPLEX*16 PIV, ALPHA
169 INTEGER IZAMAX, ILAENV
170 EXTERNAL lsame, ilaenv, izamax
177 INTRINSIC dble, dconjg, max
188 IF( lsame( uplo,
'U' ) )
THEN
195 IF ( j.GT.min(m, nb) )
224 CALL zlacgv( j-k1, a( 1, j ), 1 )
225 CALL zgemv(
'No transpose', mj, j-k1,
226 $ -one, h( j, k1 ), ldh,
228 $ one, h( j, j ), 1 )
229 CALL zlacgv( j-k1, a( 1, j ), 1 )
234 CALL zcopy( mj, h( j, j ), 1, work( 1 ), 1 )
241 alpha = -dconjg( a( k-1, j ) )
242 CALL zaxpy( mj, alpha, a( k-2, j ), lda, work( 1 ), 1 )
247 a( k, j ) = dble( work( 1 ) )
256 CALL zaxpy( m-j, alpha, a( k-1, j+1 ), lda,
262 i2 = izamax( m-j, work( 2 ), 1 ) + 1
267 IF( (i2.NE.2) .AND. (piv.NE.0) )
THEN
272 work( i2 ) = work( i1 )
279 CALL zswap( i2-i1-1, a( j1+i1-1, i1+1 ), lda,
280 $ a( j1+i1, i2 ), 1 )
281 CALL zlacgv( i2-i1, a( j1+i1-1, i1+1 ), lda )
282 CALL zlacgv( i2-i1-1, a( j1+i1, i2 ), 1 )
287 $
CALL zswap( m-i2, a( j1+i1-1, i2+1 ), lda,
288 $ a( j1+i2-1, i2+1 ), lda )
292 piv = a( i1+j1-1, i1 )
293 a( j1+i1-1, i1 ) = a( j1+i2-1, i2 )
294 a( j1+i2-1, i2 ) = piv
298 CALL zswap( i1-1, h( i1, 1 ), ldh, h( i2, 1 ), ldh )
301 IF( i1.GT.(k1-1) )
THEN
306 CALL zswap( i1-k1+1, a( 1, i1 ), 1,
315 a( k, j+1 ) = work( 2 )
321 CALL zcopy( m-j, a( k+1, j+1 ), lda,
328 IF( j.LT.(m-1) )
THEN
329 IF( a( k, j+1 ).NE.zero )
THEN
330 alpha = one / a( k, j+1 )
331 CALL zcopy( m-j-1, work( 3 ), 1, a( k, j+2 ), lda )
332 CALL zscal( m-j-1, alpha, a( k, j+2 ), lda )
334 CALL zlaset(
'Full', 1, m-j-1, zero, zero,
350 IF( j.GT.min( m, nb ) )
379 CALL zlacgv( j-k1, a( j, 1 ), lda )
380 CALL zgemv(
'No transpose', mj, j-k1,
381 $ -one, h( j, k1 ), ldh,
383 $ one, h( j, j ), 1 )
384 CALL zlacgv( j-k1, a( j, 1 ), lda )
389 CALL zcopy( mj, h( j, j ), 1, work( 1 ), 1 )
396 alpha = -dconjg( a( j, k-1 ) )
397 CALL zaxpy( mj, alpha, a( j, k-2 ), 1, work( 1 ), 1 )
402 a( j, k ) = dble( work( 1 ) )
411 CALL zaxpy( m-j, alpha, a( j+1, k-1 ), 1,
417 i2 = izamax( m-j, work( 2 ), 1 ) + 1
422 IF( (i2.NE.2) .AND. (piv.NE.0) )
THEN
427 work( i2 ) = work( i1 )
434 CALL zswap( i2-i1-1, a( i1+1, j1+i1-1 ), 1,
435 $ a( i2, j1+i1 ), lda )
436 CALL zlacgv( i2-i1, a( i1+1, j1+i1-1 ), 1 )
437 CALL zlacgv( i2-i1-1, a( i2, j1+i1 ), lda )
442 $
CALL zswap( m-i2, a( i2+1, j1+i1-1 ), 1,
443 $ a( i2+1, j1+i2-1 ), 1 )
447 piv = a( i1, j1+i1-1 )
448 a( i1, j1+i1-1 ) = a( i2, j1+i2-1 )
449 a( i2, j1+i2-1 ) = piv
453 CALL zswap( i1-1, h( i1, 1 ), ldh, h( i2, 1 ), ldh )
456 IF( i1.GT.(k1-1) )
THEN
461 CALL zswap( i1-k1+1, a( i1, 1 ), lda,
470 a( j+1, k ) = work( 2 )
476 CALL zcopy( m-j, a( j+1, k+1 ), 1,
483 IF( j.LT.(m-1) )
THEN
484 IF( a( j+1, k ).NE.zero )
THEN
485 alpha = one / a( j+1, k )
486 CALL zcopy( m-j-1, work( 3 ), 1, a( j+2, k ), 1 )
487 CALL zscal( m-j-1, alpha, a( j+2, k ), 1 )
489 CALL zlaset(
'Full', m-j-1, 1, zero, zero,