195 SUBROUTINE dsgesv( N, NRHS, A, LDA, IPIV, B, LDB, X, LDX, WORK,
196 $ swork, iter, info )
204 INTEGER info, iter, lda, ldb, ldx, n, nrhs
209 DOUBLE PRECISION a( lda, * ), b( ldb, * ), work( n, * ),
217 parameter( doitref = .true. )
220 parameter( itermax = 30 )
222 DOUBLE PRECISION bwdmax
223 parameter( bwdmax = 1.0e+00 )
225 DOUBLE PRECISION negone, one
226 parameter( negone = -1.0d+0, one = 1.0d+0 )
229 INTEGER i, iiter, ptsa, ptsx
230 DOUBLE PRECISION anrm, cte, eps, rnrm, xnrm
242 INTRINSIC abs, dble, max, sqrt
253 ELSE IF( nrhs.LT.0 )
THEN
255 ELSE IF( lda.LT.max( 1, n ) )
THEN
257 ELSE IF( ldb.LT.max( 1, n ) )
THEN
259 ELSE IF( ldx.LT.max( 1, n ) )
THEN
263 CALL
xerbla(
'DSGESV', -info )
275 IF( .NOT.doitref )
THEN
282 anrm =
dlange(
'I', n, n, a, lda, work )
284 cte = anrm*eps*sqrt( dble( n ) )*bwdmax
294 CALL
dlag2s( n, nrhs, b, ldb, swork( ptsx ), n, info )
304 CALL
dlag2s( n, n, a, lda, swork( ptsa ), n, info )
313 CALL
sgetrf( n, n, swork( ptsa ), n, ipiv, info )
322 CALL
sgetrs(
'No transpose', n, nrhs, swork( ptsa ), n, ipiv,
323 $ swork( ptsx ), n, info )
327 CALL
slag2d( n, nrhs, swork( ptsx ), n, x, ldx, info )
331 CALL
dlacpy(
'All', n, nrhs, b, ldb, work, n )
333 CALL
dgemm(
'No Transpose',
'No Transpose', n, nrhs, n, negone, a,
334 $ lda, x, ldx, one, work, n )
340 xnrm = abs( x(
idamax( n, x( 1, i ), 1 ), i ) )
341 rnrm = abs( work(
idamax( n, work( 1, i ), 1 ), i ) )
342 IF( rnrm.GT.xnrm*cte )
354 DO 30 iiter = 1, itermax
359 CALL
dlag2s( n, nrhs, work, n, swork( ptsx ), n, info )
368 CALL
sgetrs(
'No transpose', n, nrhs, swork( ptsa ), n, ipiv,
369 $ swork( ptsx ), n, info )
374 CALL
slag2d( n, nrhs, swork( ptsx ), n, work, n, info )
377 CALL
daxpy( n, one, work( 1, i ), 1, x( 1, i ), 1 )
382 CALL
dlacpy(
'All', n, nrhs, b, ldb, work, n )
384 CALL
dgemm(
'No Transpose',
'No Transpose', n, nrhs, n, negone,
385 $ a, lda, x, ldx, one, work, n )
391 xnrm = abs( x(
idamax( n, x( 1, i ), 1 ), i ) )
392 rnrm = abs( work(
idamax( n, work( 1, i ), 1 ), i ) )
393 IF( rnrm.GT.xnrm*cte )
420 CALL
dgetrf( n, n, a, lda, ipiv, info )
425 CALL
dlacpy(
'All', n, nrhs, b, ldb, x, ldx )
426 CALL
dgetrs(
'No transpose', n, nrhs, a, lda, ipiv, x, ldx,