195 SUBROUTINE dsposv( UPLO, N, NRHS, A, LDA, B, LDB, X, LDX, WORK,
196 $ SWORK, ITER, INFO )
204 INTEGER INFO, ITER, LDA, LDB, LDX, N, NRHS
208 DOUBLE PRECISION A( LDA, * ), B( LDB, * ), WORK( N, * ),
216 parameter( doitref = .true. )
219 parameter( itermax = 30 )
221 DOUBLE PRECISION BWDMAX
222 parameter( bwdmax = 1.0e+00 )
224 DOUBLE PRECISION NEGONE, ONE
225 parameter( negone = -1.0d+0, one = 1.0d+0 )
228 INTEGER I, IITER, PTSA, PTSX
229 DOUBLE PRECISION ANRM, CTE, EPS, RNRM, XNRM
238 DOUBLE PRECISION DLAMCH, DLANSY
240 EXTERNAL idamax, dlamch, dlansy, lsame
243 INTRINSIC abs, dble, max, sqrt
252 IF( .NOT.lsame( uplo,
'U' ) .AND.
253 $ .NOT.lsame( uplo,
'L' ) )
THEN
255 ELSE IF( n.LT.0 )
THEN
257 ELSE IF( nrhs.LT.0 )
THEN
259 ELSE IF( lda.LT.max( 1, n ) )
THEN
261 ELSE IF( ldb.LT.max( 1, n ) )
THEN
263 ELSE IF( ldx.LT.max( 1, n ) )
THEN
267 CALL xerbla(
'DSPOSV', -info )
279 IF( .NOT.doitref )
THEN
286 anrm = dlansy(
'I', uplo, n, a, lda, work )
287 eps = dlamch(
'Epsilon' )
288 cte = anrm*eps*sqrt( dble( n ) )*bwdmax
298 CALL dlag2s( n, nrhs, b, ldb, swork( ptsx ), n, info )
308 CALL dlat2s( uplo, n, a, lda, swork( ptsa ), n, info )
317 CALL spotrf( uplo, n, swork( ptsa ), n, info )
326 CALL spotrs( uplo, n, nrhs, swork( ptsa ), n, swork( ptsx ), n,
331 CALL slag2d( n, nrhs, swork( ptsx ), n, x, ldx, info )
335 CALL dlacpy(
'All', n, nrhs, b, ldb, work, n )
337 CALL dsymm(
'Left', uplo, n, nrhs, negone, a, lda, x, ldx, one,
344 xnrm = abs( x( idamax( n, x( 1, i ), 1 ), i ) )
345 rnrm = abs( work( idamax( n, work( 1, i ), 1 ), i ) )
346 IF( rnrm.GT.xnrm*cte )
358 DO 30 iiter = 1, itermax
363 CALL dlag2s( n, nrhs, work, n, swork( ptsx ), n, info )
372 CALL spotrs( uplo, n, nrhs, swork( ptsa ), n, swork( ptsx ),
379 CALL slag2d( n, nrhs, swork( ptsx ), n, work, n, info )
382 CALL daxpy( n, one, work( 1, i ), 1, x( 1, i ), 1 )
387 CALL dlacpy(
'All', n, nrhs, b, ldb, work, n )
389 CALL dsymm(
'L', uplo, n, nrhs, negone, a, lda, x, ldx, one,
396 xnrm = abs( x( idamax( n, x( 1, i ), 1 ), i ) )
397 rnrm = abs( work( idamax( n, work( 1, i ), 1 ), i ) )
398 IF( rnrm.GT.xnrm*cte )
425 CALL dpotrf( uplo, n, a, lda, info )
430 CALL dlacpy(
'All', n, nrhs, b, ldb, x, ldx )
431 CALL dpotrs( uplo, n, nrhs, a, lda, x, ldx, info )