209 SUBROUTINE zcposv( UPLO, N, NRHS, A, LDA, B, LDB, X, LDX, WORK,
210 $ swork, rwork, iter, info )
219 INTEGER info, iter, lda, ldb, ldx, n, nrhs
222 DOUBLE PRECISION rwork( * )
224 COMPLEX*16 a( lda, * ), b( ldb, * ), work( n, * ),
232 parameter( doitref = .true. )
235 parameter( itermax = 30 )
237 DOUBLE PRECISION bwdmax
238 parameter( bwdmax = 1.0e+00 )
240 COMPLEX*16 negone, one
241 parameter( negone = ( -1.0d+00, 0.0d+00 ),
242 $ one = ( 1.0d+00, 0.0d+00 ) )
245 INTEGER i, iiter, ptsa, ptsx
246 DOUBLE PRECISION anrm, cte, eps, rnrm, xnrm
260 INTRINSIC abs, dble, max, sqrt
262 DOUBLE PRECISION cabs1
265 cabs1( zdum ) = abs( dble( zdum ) ) + abs( dimag( zdum ) )
274 IF( .NOT.
lsame( uplo,
'U' ) .AND. .NOT.
lsame( uplo,
'L' ) )
THEN
276 ELSE IF( n.LT.0 )
THEN
278 ELSE IF( nrhs.LT.0 )
THEN
280 ELSE IF( lda.LT.max( 1, n ) )
THEN
282 ELSE IF( ldb.LT.max( 1, n ) )
THEN
284 ELSE IF( ldx.LT.max( 1, n ) )
THEN
288 CALL
xerbla(
'ZCPOSV', -info )
300 IF( .NOT.doitref )
THEN
307 anrm =
zlanhe(
'I', uplo, n, a, lda, rwork )
309 cte = anrm*eps*sqrt( dble( n ) )*bwdmax
319 CALL
zlag2c( n, nrhs, b, ldb, swork( ptsx ), n, info )
329 CALL
zlat2c( uplo, n, a, lda, swork( ptsa ), n, info )
338 CALL
cpotrf( uplo, n, swork( ptsa ), n, info )
347 CALL
cpotrs( uplo, n, nrhs, swork( ptsa ), n, swork( ptsx ), n,
352 CALL
clag2z( n, nrhs, swork( ptsx ), n, x, ldx, info )
356 CALL
zlacpy(
'All', n, nrhs, b, ldb, work, n )
358 CALL
zhemm(
'Left', uplo, n, nrhs, negone, a, lda, x, ldx, one,
365 xnrm = cabs1( x(
izamax( n, x( 1, i ), 1 ), i ) )
366 rnrm = cabs1( work(
izamax( n, work( 1, i ), 1 ), i ) )
367 IF( rnrm.GT.xnrm*cte )
379 DO 30 iiter = 1, itermax
384 CALL
zlag2c( n, nrhs, work, n, swork( ptsx ), n, info )
393 CALL
cpotrs( uplo, n, nrhs, swork( ptsa ), n, swork( ptsx ), n,
399 CALL
clag2z( n, nrhs, swork( ptsx ), n, work, n, info )
402 CALL
zaxpy( n, one, work( 1, i ), 1, x( 1, i ), 1 )
407 CALL
zlacpy(
'All', n, nrhs, b, ldb, work, n )
409 CALL
zhemm(
'L', uplo, n, nrhs, negone, a, lda, x, ldx, one,
416 xnrm = cabs1( x(
izamax( n, x( 1, i ), 1 ), i ) )
417 rnrm = cabs1( work(
izamax( n, work( 1, i ), 1 ), i ) )
418 IF( rnrm.GT.xnrm*cte )
445 CALL
zpotrf( uplo, n, a, lda, info )
450 CALL
zlacpy(
'All', n, nrhs, b, ldb, x, ldx )
451 CALL
zpotrs( uplo, n, nrhs, a, lda, x, ldx, info )