132 $ WORK, LWORK, INFO )
142 INTEGER N, LDA, LWORK, INFO
146 COMPLEX A( LDA, * ), WORK( * )
152 parameter( zero = (0.0e+0, 0.0e+0), one = (1.0e+0, 0.0e+0) )
155 LOGICAL LQUERY, UPPER
156 INTEGER J, LWKMIN, LWKOPT
157 INTEGER NB, MJ, NJ, K1, K2, J1, J2, J3, JB
164 EXTERNAL lsame, ilaenv, sroundup_lwork
171 INTRINSIC real, conjg, max
177 nb = ilaenv( 1,
'CHETRF_AA', uplo, n, -1, -1, -1 )
182 upper = lsame( uplo,
'U' )
183 lquery = ( lwork.EQ.-1 )
192 IF( .NOT.upper .AND. .NOT.lsame( uplo,
'L' ) )
THEN
194 ELSE IF( n.LT.0 )
THEN
196 ELSE IF( lda.LT.max( 1, n ) )
THEN
198 ELSE IF( lwork.LT.lwkmin .AND. .NOT.lquery )
THEN
203 work( 1 ) = sroundup_lwork( lwkopt )
207 CALL xerbla(
'CHETRF_AA', -info )
209 ELSE IF( lquery )
THEN
220 a( 1, 1 ) = real( a( 1, 1 ) )
226 IF( lwork.LT.((1+nb)*n) )
THEN
238 CALL ccopy( n, a( 1, 1 ), lda, work( 1 ), 1 )
257 jb = min( n-j1+1, nb )
263 $ a( max(1, j), j+1 ), lda,
264 $ ipiv( j+1 ), work, n, work( n*nb+1 ) )
268 DO j2 = j+2, min(n, j+jb+1)
269 ipiv( j2 ) = ipiv( j2 ) + j
270 IF( (j2.NE.ipiv(j2)) .AND. ((j1-k1).GT.2) )
THEN
271 CALL cswap( j1-k1-2, a( 1, j2 ), 1,
272 $ a( 1, ipiv(j2) ), 1 )
285 IF( j1.GT.1 .OR. jb.GT.1 )
THEN
289 alpha = conjg( a( j, j+1 ) )
291 CALL ccopy( n-j, a( j-1, j+1 ), lda,
292 $ work( (j+1-j1+1)+jb*n ), 1 )
293 CALL cscal( n-j, alpha, work( (j+1-j1+1)+jb*n ), 1 )
316 nj = min( nb, n-j2+1 )
322 CALL cgemm(
'Conjugate transpose',
'Transpose',
324 $ -one, a( j1-k2, j3 ), lda,
325 $ work( (j3-j1+1)+k1*n ), n,
326 $ one, a( j3, j3 ), lda )
332 CALL cgemm(
'Conjugate transpose',
'Transpose',
334 $ -one, a( j1-k2, j2 ), lda,
335 $ work( (j3-j1+1)+k1*n ), n,
336 $ one, a( j2, j3 ), lda )
341 a( j, j+1 ) = conjg( alpha )
346 CALL ccopy( n-j, a( j+1, j+1 ), lda, work( 1 ), 1 )
358 CALL ccopy( n, a( 1, 1 ), 1, work( 1 ), 1 )
377 jb = min( n-j1+1, nb )
383 $ a( j+1, max(1, j) ), lda,
384 $ ipiv( j+1 ), work, n, work( n*nb+1 ) )
388 DO j2 = j+2, min(n, j+jb+1)
389 ipiv( j2 ) = ipiv( j2 ) + j
390 IF( (j2.NE.ipiv(j2)) .AND. ((j1-k1).GT.2) )
THEN
391 CALL cswap( j1-k1-2, a( j2, 1 ), lda,
392 $ a( ipiv(j2), 1 ), lda )
405 IF( j1.GT.1 .OR. jb.GT.1 )
THEN
409 alpha = conjg( a( j+1, j ) )
411 CALL ccopy( n-j, a( j+1, j-1 ), 1,
412 $ work( (j+1-j1+1)+jb*n ), 1 )
413 CALL cscal( n-j, alpha, work( (j+1-j1+1)+jb*n ), 1 )
436 nj = min( nb, n-j2+1 )
442 CALL cgemm(
'No transpose',
443 $
'Conjugate transpose',
445 $ -one, work( (j3-j1+1)+k1*n ), n,
446 $ a( j3, j1-k2 ), lda,
447 $ one, a( j3, j3 ), lda )
453 CALL cgemm(
'No transpose',
'Conjugate transpose',
455 $ -one, work( (j3-j1+1)+k1*n ), n,
456 $ a( j2, j1-k2 ), lda,
457 $ one, a( j3, j2 ), lda )
462 a( j+1, j ) = conjg( alpha )
467 CALL ccopy( n-j, a( j+1, j+1 ), 1, work( 1 ), 1 )
473 work( 1 ) = sroundup_lwork( lwkopt )