185 SUBROUTINE sgerfs( TRANS, N, NRHS, A, LDA, AF, LDAF, IPIV, B, LDB,
186 $ x, ldx, ferr, berr, work, iwork, info )
195 INTEGER INFO, LDA, LDAF, LDB, LDX, N, NRHS
198 INTEGER IPIV( * ), IWORK( * )
199 REAL A( lda, * ), AF( ldaf, * ), B( ldb, * ),
200 $ berr( * ), ferr( * ), work( * ), x( ldx, * )
207 parameter ( itmax = 5 )
209 parameter ( zero = 0.0e+0 )
211 parameter ( one = 1.0e+0 )
213 parameter ( two = 2.0e+0 )
215 parameter ( three = 3.0e+0 )
220 INTEGER COUNT, I, J, K, KASE, NZ
221 REAL EPS, LSTRES, S, SAFE1, SAFE2, SAFMIN, XK
235 EXTERNAL lsame, slamch
242 notran = lsame( trans,
'N' )
243 IF( .NOT.notran .AND. .NOT.lsame( trans,
'T' ) .AND. .NOT.
244 $ lsame( trans,
'C' ) )
THEN
246 ELSE IF( n.LT.0 )
THEN
248 ELSE IF( nrhs.LT.0 )
THEN
250 ELSE IF( lda.LT.max( 1, n ) )
THEN
252 ELSE IF( ldaf.LT.max( 1, n ) )
THEN
254 ELSE IF( ldb.LT.max( 1, n ) )
THEN
256 ELSE IF( ldx.LT.max( 1, n ) )
THEN
260 CALL xerbla(
'SGERFS', -info )
266 IF( n.EQ.0 .OR. nrhs.EQ.0 )
THEN
283 eps = slamch(
'Epsilon' )
284 safmin = slamch(
'Safe minimum' )
301 CALL scopy( n, b( 1, j ), 1, work( n+1 ), 1 )
302 CALL sgemv( trans, n, n, -one, a, lda, x( 1, j ), 1, one,
315 work( i ) = abs( b( i, j ) )
322 xk = abs( x( k, j ) )
324 work( i ) = work( i ) + abs( a( i, k ) )*xk
331 s = s + abs( a( i, k ) )*abs( x( i, j ) )
333 work( k ) = work( k ) + s
338 IF( work( i ).GT.safe2 )
THEN
339 s = max( s, abs( work( n+i ) ) / work( i ) )
341 s = max( s, ( abs( work( n+i ) )+safe1 ) /
342 $ ( work( i )+safe1 ) )
353 IF( berr( j ).GT.eps .AND. two*berr( j ).LE.lstres .AND.
354 $ count.LE.itmax )
THEN
358 CALL sgetrs( trans, n, 1, af, ldaf, ipiv, work( n+1 ), n,
360 CALL saxpy( n, one, work( n+1 ), 1, x( 1, j ), 1 )
389 IF( work( i ).GT.safe2 )
THEN
390 work( i ) = abs( work( n+i ) ) + nz*eps*work( i )
392 work( i ) = abs( work( n+i ) ) + nz*eps*work( i ) + safe1
398 CALL slacn2( n, work( 2*n+1 ), work( n+1 ), iwork, ferr( j ),
405 CALL sgetrs( transt, n, 1, af, ldaf, ipiv, work( n+1 ),
408 work( n+i ) = work( i )*work( n+i )
415 work( n+i ) = work( i )*work( n+i )
417 CALL sgetrs( trans, n, 1, af, ldaf, ipiv, work( n+1 ), n,
427 lstres = max( lstres, abs( x( i, j ) ) )
430 $ ferr( j ) = ferr( j ) / lstres
subroutine sgetrs(TRANS, N, NRHS, A, LDA, IPIV, B, LDB, INFO)
SGETRS
subroutine xerbla(SRNAME, INFO)
XERBLA
subroutine sgemv(TRANS, M, N, ALPHA, A, LDA, X, INCX, BETA, Y, INCY)
SGEMV
subroutine slacn2(N, V, X, ISGN, EST, KASE, ISAVE)
SLACN2 estimates the 1-norm of a square matrix, using reverse communication for evaluating matrix-vec...
subroutine saxpy(N, SA, SX, INCX, SY, INCY)
SAXPY
subroutine sgerfs(TRANS, N, NRHS, A, LDA, AF, LDAF, IPIV, B, LDB, X, LDX, FERR, BERR, WORK, IWORK, INFO)
SGERFS
subroutine scopy(N, SX, INCX, SY, INCY)
SCOPY