155 SUBROUTINE csptrf( UPLO, N, AP, IPIV, INFO )
174 parameter( zero = 0.0e+0, one = 1.0e+0 )
176 parameter( eight = 8.0e+0, sevten = 17.0e+0 )
178 parameter( cone = ( 1.0e+0, 0.0e+0 ) )
182 INTEGER I, IMAX, J, JMAX, K, KC, KK, KNC, KP, KPC,
184 REAL ABSAKK, ALPHA, COLMAX, ROWMAX
185 COMPLEX D11, D12, D21, D22, R1, T, WK, WKM1, WKP1, ZDUM
190 EXTERNAL lsame, icamax
196 INTRINSIC abs, aimag, max, real, sqrt
202 cabs1( zdum ) = abs( real( zdum ) ) + abs( aimag( zdum ) )
209 upper = lsame( uplo,
'U' )
210 IF( .NOT.upper .AND. .NOT.lsame( uplo,
'L' ) )
THEN
212 ELSE IF( n.LT.0 )
THEN
216 CALL xerbla(
'CSPTRF', -info )
222 alpha = ( one+sqrt( sevten ) ) / eight
232 kc = ( n-1 )*n / 2 + 1
245 absakk = cabs1( ap( kc+k-1 ) )
251 imax = icamax( k-1, ap( kc ), 1 )
252 colmax = cabs1( ap( kc+imax-1 ) )
257 IF( max( absakk, colmax ).EQ.zero )
THEN
265 IF( absakk.GE.alpha*colmax )
THEN
274 kx = imax*( imax+1 ) / 2 + imax
275 DO 20 j = imax + 1, k
276 IF( cabs1( ap( kx ) ).GT.rowmax )
THEN
277 rowmax = cabs1( ap( kx ) )
282 kpc = ( imax-1 )*imax / 2 + 1
284 jmax = icamax( imax-1, ap( kpc ), 1 )
285 rowmax = max( rowmax, cabs1( ap( kpc+jmax-1 ) ) )
288 IF( absakk.GE.alpha*colmax*( colmax / rowmax ) )
THEN
293 ELSE IF( cabs1( ap( kpc+imax-1 ) ).GE.alpha*rowmax )
THEN
317 CALL cswap( kp-1, ap( knc ), 1, ap( kpc ), 1 )
319 DO 30 j = kp + 1, kk - 1
322 ap( knc+j-1 ) = ap( kx )
326 ap( knc+kk-1 ) = ap( kpc+kp-1 )
328 IF( kstep.EQ.2 )
THEN
330 ap( kc+k-2 ) = ap( kc+kp-1 )
337 IF( kstep.EQ.1 )
THEN
349 r1 = cone / ap( kc+k-1 )
350 CALL cspr( uplo, k-1, -r1, ap( kc ), 1, ap )
354 CALL cscal( k-1, r1, ap( kc ), 1 )
371 d12 = ap( k-1+( k-1 )*k / 2 )
372 d22 = ap( k-1+( k-2 )*( k-1 ) / 2 ) / d12
373 d11 = ap( k+( k-1 )*k / 2 ) / d12
374 t = cone / ( d11*d22-cone )
377 DO 50 j = k - 2, 1, -1
378 wkm1 = d12*( d11*ap( j+( k-2 )*( k-1 ) / 2 )-
379 $ ap( j+( k-1 )*k / 2 ) )
380 wk = d12*( d22*ap( j+( k-1 )*k / 2 )-
381 $ ap( j+( k-2 )*( k-1 ) / 2 ) )
383 ap( i+( j-1 )*j / 2 ) = ap( i+( j-1 )*j / 2 ) -
384 $ ap( i+( k-1 )*k / 2 )*wk -
385 $ ap( i+( k-2 )*( k-1 ) / 2 )*wkm1
387 ap( j+( k-1 )*k / 2 ) = wk
388 ap( j+( k-2 )*( k-1 ) / 2 ) = wkm1
397 IF( kstep.EQ.1 )
THEN
432 absakk = cabs1( ap( kc ) )
438 imax = k + icamax( n-k, ap( kc+1 ), 1 )
439 colmax = cabs1( ap( kc+imax-k ) )
444 IF( max( absakk, colmax ).EQ.zero )
THEN
452 IF( absakk.GE.alpha*colmax )
THEN
464 DO 70 j = k, imax - 1
465 IF( cabs1( ap( kx ) ).GT.rowmax )
THEN
466 rowmax = cabs1( ap( kx ) )
471 kpc = npp - ( n-imax+1 )*( n-imax+2 ) / 2 + 1
473 jmax = imax + icamax( n-imax, ap( kpc+1 ), 1 )
474 rowmax = max( rowmax, cabs1( ap( kpc+jmax-imax ) ) )
477 IF( absakk.GE.alpha*colmax*( colmax / rowmax ) )
THEN
482 ELSE IF( cabs1( ap( kpc ) ).GE.alpha*rowmax )
THEN
500 $ knc = knc + n - k + 1
507 $
CALL cswap( n-kp, ap( knc+kp-kk+1 ), 1,
511 DO 80 j = kk + 1, kp - 1
514 ap( knc+j-kk ) = ap( kx )
518 ap( knc ) = ap( kpc )
520 IF( kstep.EQ.2 )
THEN
522 ap( kc+1 ) = ap( kc+kp-k )
529 IF( kstep.EQ.1 )
THEN
544 CALL cspr( uplo, n-k, -r1, ap( kc+1 ), 1,
549 CALL cscal( n-k, r1, ap( kc+1 ), 1 )
570 d21 = ap( k+1+( k-1 )*( 2*n-k ) / 2 )
571 d11 = ap( k+1+k*( 2*n-k-1 ) / 2 ) / d21
572 d22 = ap( k+( k-1 )*( 2*n-k ) / 2 ) / d21
573 t = cone / ( d11*d22-cone )
577 wk = d21*( d11*ap( j+( k-1 )*( 2*n-k ) / 2 )-
578 $ ap( j+k*( 2*n-k-1 ) / 2 ) )
579 wkp1 = d21*( d22*ap( j+k*( 2*n-k-1 ) / 2 )-
580 $ ap( j+( k-1 )*( 2*n-k ) / 2 ) )
582 ap( i+( j-1 )*( 2*n-j ) / 2 ) = ap( i+( j-1 )*
583 $ ( 2*n-j ) / 2 ) - ap( i+( k-1 )*( 2*n-k ) /
584 $ 2 )*wk - ap( i+k*( 2*n-k-1 ) / 2 )*wkp1
586 ap( j+( k-1 )*( 2*n-k ) / 2 ) = wk
587 ap( j+k*( 2*n-k-1 ) / 2 ) = wkp1
595 IF( kstep.EQ.1 )
THEN