132 $ WORK, LWORK, INFO )
142 INTEGER N, LDA, LWORK, INFO
146 COMPLEX*16 A( LDA, * ), WORK( * )
152 parameter( zero = (0.0d+0, 0.0d+0), one = (1.0d+0, 0.0d+0) )
155 LOGICAL LQUERY, UPPER
156 INTEGER J, LWKMIN, LWKOPT
157 INTEGER NB, MJ, NJ, K1, K2, J1, J2, J3, JB
163 EXTERNAL lsame, ilaenv
170 INTRINSIC dble, dconjg, max
176 nb = ilaenv( 1,
'ZHETRF_AA', uplo, n, -1, -1, -1 )
181 upper = lsame( uplo,
'U' )
182 lquery = ( lwork.EQ.-1 )
191 IF( .NOT.upper .AND. .NOT.lsame( uplo,
'L' ) )
THEN
193 ELSE IF( n.LT.0 )
THEN
195 ELSE IF( lda.LT.max( 1, n ) )
THEN
197 ELSE IF( lwork.LT.lwkmin .AND. .NOT.lquery )
THEN
206 CALL xerbla(
'ZHETRF_AA', -info )
208 ELSE IF( lquery )
THEN
219 a( 1, 1 ) = dble( a( 1, 1 ) )
225 IF( lwork.LT.((1+nb)*n) )
THEN
237 CALL zcopy( n, a( 1, 1 ), lda, work( 1 ), 1 )
256 jb = min( n-j1+1, nb )
262 $ a( max(1, j), j+1 ), lda,
263 $ ipiv( j+1 ), work, n, work( n*nb+1 ) )
267 DO j2 = j+2, min(n, j+jb+1)
268 ipiv( j2 ) = ipiv( j2 ) + j
269 IF( (j2.NE.ipiv(j2)) .AND. ((j1-k1).GT.2) )
THEN
270 CALL zswap( j1-k1-2, a( 1, j2 ), 1,
271 $ a( 1, ipiv(j2) ), 1 )
284 IF( j1.GT.1 .OR. jb.GT.1 )
THEN
288 alpha = dconjg( a( j, j+1 ) )
290 CALL zcopy( n-j, a( j-1, j+1 ), lda,
291 $ work( (j+1-j1+1)+jb*n ), 1 )
292 CALL zscal( n-j, alpha, work( (j+1-j1+1)+jb*n ), 1 )
315 nj = min( nb, n-j2+1 )
321 CALL zgemm(
'Conjugate transpose',
'Transpose',
323 $ -one, a( j1-k2, j3 ), lda,
324 $ work( (j3-j1+1)+k1*n ), n,
325 $ one, a( j3, j3 ), lda )
331 CALL zgemm(
'Conjugate transpose',
'Transpose',
333 $ -one, a( j1-k2, j2 ), lda,
334 $ work( (j3-j1+1)+k1*n ), n,
335 $ one, a( j2, j3 ), lda )
340 a( j, j+1 ) = dconjg( alpha )
345 CALL zcopy( n-j, a( j+1, j+1 ), lda, work( 1 ), 1 )
357 CALL zcopy( n, a( 1, 1 ), 1, work( 1 ), 1 )
376 jb = min( n-j1+1, nb )
382 $ a( j+1, max(1, j) ), lda,
383 $ ipiv( j+1 ), work, n, work( n*nb+1 ) )
387 DO j2 = j+2, min(n, j+jb+1)
388 ipiv( j2 ) = ipiv( j2 ) + j
389 IF( (j2.NE.ipiv(j2)) .AND. ((j1-k1).GT.2) )
THEN
390 CALL zswap( j1-k1-2, a( j2, 1 ), lda,
391 $ a( ipiv(j2), 1 ), lda )
404 IF( j1.GT.1 .OR. jb.GT.1 )
THEN
408 alpha = dconjg( a( j+1, j ) )
410 CALL zcopy( n-j, a( j+1, j-1 ), 1,
411 $ work( (j+1-j1+1)+jb*n ), 1 )
412 CALL zscal( n-j, alpha, work( (j+1-j1+1)+jb*n ), 1 )
435 nj = min( nb, n-j2+1 )
441 CALL zgemm(
'No transpose',
442 $
'Conjugate transpose',
444 $ -one, work( (j3-j1+1)+k1*n ), n,
445 $ a( j3, j1-k2 ), lda,
446 $ one, a( j3, j3 ), lda )
452 CALL zgemm(
'No transpose',
'Conjugate transpose',
454 $ -one, work( (j3-j1+1)+k1*n ), n,
455 $ a( j2, j1-k2 ), lda,
456 $ one, a( j3, j2 ), lda )
461 a( j+1, j ) = dconjg( alpha )
466 CALL zcopy( n-j, a( j+1, j+1 ), 1, work( 1 ), 1 )