364 SUBROUTINE dgbsvx( FACT, TRANS, N, KL, KU, NRHS, AB, LDAB, AFB,
365 $ LDAFB, IPIV, EQUED, R, C, B, LDB, X, LDX,
366 $ RCOND, FERR, BERR, WORK, IWORK, INFO )
373 CHARACTER EQUED, FACT, TRANS
374 INTEGER INFO, KL, KU, LDAB, LDAFB, LDB, LDX, N, NRHS
375 DOUBLE PRECISION RCOND
378 INTEGER IPIV( * ), IWORK( * )
379 DOUBLE PRECISION AB( LDAB, * ), AFB( LDAFB, * ), B( LDB, * ),
380 $ berr( * ), c( * ), ferr( * ), r( * ),
381 $ work( * ), x( ldx, * )
387 DOUBLE PRECISION ZERO, ONE
388 PARAMETER ( ZERO = 0.0d+0, one = 1.0d+0 )
391 LOGICAL COLEQU, EQUIL, NOFACT, NOTRAN, ROWEQU
393 INTEGER I, INFEQU, J, J1, J2
394 DOUBLE PRECISION AMAX, ANORM, BIGNUM, COLCND, RCMAX, RCMIN,
395 $ rowcnd, rpvgrw, smlnum
399 DOUBLE PRECISION DLAMCH, DLANGB, DLANTB
400 EXTERNAL lsame, dlamch, dlangb, dlantb
408 INTRINSIC abs, max, min
413 nofact = lsame( fact,
'N' )
414 equil = lsame( fact,
'E' )
415 notran = lsame( trans,
'N' )
416 IF( nofact .OR. equil )
THEN
421 rowequ = lsame( equed,
'R' ) .OR. lsame( equed,
'B' )
422 colequ = lsame( equed,
'C' ) .OR. lsame( equed,
'B' )
423 smlnum = dlamch(
'Safe minimum' )
424 bignum = one / smlnum
429 IF( .NOT.nofact .AND.
431 $ .NOT.lsame( fact,
'F' ) )
434 ELSE IF( .NOT.notran .AND. .NOT.lsame( trans,
'T' ) .AND. .NOT.
435 $ lsame( trans,
'C' ) )
THEN
437 ELSE IF( n.LT.0 )
THEN
439 ELSE IF( kl.LT.0 )
THEN
441 ELSE IF( ku.LT.0 )
THEN
443 ELSE IF( nrhs.LT.0 )
THEN
445 ELSE IF( ldab.LT.kl+ku+1 )
THEN
447 ELSE IF( ldafb.LT.2*kl+ku+1 )
THEN
449 ELSE IF( lsame( fact,
'F' ) .AND. .NOT.
450 $ ( rowequ .OR. colequ .OR. lsame( equed,
'N' ) ) )
THEN
457 rcmin = min( rcmin, r( j ) )
458 rcmax = max( rcmax, r( j ) )
460 IF( rcmin.LE.zero )
THEN
462 ELSE IF( n.GT.0 )
THEN
463 rowcnd = max( rcmin, smlnum ) / min( rcmax, bignum )
468 IF( colequ .AND. info.EQ.0 )
THEN
472 rcmin = min( rcmin, c( j ) )
473 rcmax = max( rcmax, c( j ) )
475 IF( rcmin.LE.zero )
THEN
477 ELSE IF( n.GT.0 )
THEN
478 colcnd = max( rcmin, smlnum ) / min( rcmax, bignum )
484 IF( ldb.LT.max( 1, n ) )
THEN
486 ELSE IF( ldx.LT.max( 1, n ) )
THEN
493 CALL xerbla(
'DGBSVX', -info )
501 CALL dgbequ( n, n, kl, ku, ab, ldab, r, c, rowcnd, colcnd,
503 IF( infequ.EQ.0 )
THEN
507 CALL dlaqgb( n, n, kl, ku, ab, ldab, r, c, rowcnd,
510 rowequ = lsame( equed,
'R' ) .OR. lsame( equed,
'B' )
511 colequ = lsame( equed,
'C' ) .OR. lsame( equed,
'B' )
521 b( i, j ) = r( i )*b( i, j )
525 ELSE IF( colequ )
THEN
528 b( i, j ) = c( i )*b( i, j )
533 IF( nofact .OR. equil )
THEN
540 CALL dcopy( j2-j1+1, ab( ku+1-j+j1, j ), 1,
541 $ afb( kl+ku+1-j+j1, j ), 1 )
544 CALL dgbtrf( n, n, kl, ku, afb, ldafb, ipiv, info )
555 DO 80 i = max( ku+2-j, 1 ), min( n+ku+1-j, kl+ku+1 )
556 anorm = max( anorm, abs( ab( i, j ) ) )
559 rpvgrw = dlantb(
'M',
'U',
'N', info, min( info-1,
561 $ afb( max( 1, kl+ku+2-info ), 1 ), ldafb,
563 IF( rpvgrw.EQ.zero )
THEN
566 rpvgrw = anorm / rpvgrw
582 anorm = dlangb( norm, n, kl, ku, ab, ldab, work )
583 rpvgrw = dlantb(
'M',
'U',
'N', n, kl+ku, afb, ldafb, work )
584 IF( rpvgrw.EQ.zero )
THEN
587 rpvgrw = dlangb(
'M', n, kl, ku, ab, ldab, work ) / rpvgrw
592 CALL dgbcon( norm, n, kl, ku, afb, ldafb, ipiv, anorm, rcond,
593 $ work, iwork, info )
597 CALL dlacpy(
'Full', n, nrhs, b, ldb, x, ldx )
598 CALL dgbtrs( trans, n, kl, ku, nrhs, afb, ldafb, ipiv, x, ldx,
604 CALL dgbrfs( trans, n, kl, ku, nrhs, ab, ldab, afb, ldafb,
606 $ b, ldb, x, ldx, ferr, berr, work, iwork, info )
615 x( i, j ) = c( i )*x( i, j )
619 ferr( j ) = ferr( j ) / colcnd
622 ELSE IF( rowequ )
THEN
625 x( i, j ) = r( i )*x( i, j )
629 ferr( j ) = ferr( j ) / rowcnd
635 IF( rcond.LT.dlamch(
'Epsilon' ) )
subroutine dgbsvx(fact, trans, n, kl, ku, nrhs, ab, ldab, afb, ldafb, ipiv, equed, r, c, b, ldb, x, ldx, rcond, ferr, berr, work, iwork, info)
DGBSVX computes the solution to system of linear equations A * X = B for GB matrices