174 SUBROUTINE sdrvgb( DOTYPE, NN, NVAL, NRHS, THRESH, TSTERR, A, LA,
175 $ afb, lafb, asav, b, bsav, x, xact, s, work,
176 $ rwork, iwork, nout )
185 INTEGER la, lafb, nn, nout, nrhs
190 INTEGER iwork( * ), nval( * )
191 REAL a( * ), afb( * ), asav( * ), b( * ), bsav( * ),
192 $ rwork( * ), s( * ), work( * ), x( * ),
200 parameter( one = 1.0e+0, zero = 0.0e+0 )
202 parameter( ntypes = 8 )
204 parameter( ntests = 7 )
206 parameter( ntran = 3 )
209 LOGICAL equil, nofact, prefac, trfcon, zerot
210 CHARACTER dist, equed, fact, trans, type, xtype
212 INTEGER i, i1, i2, iequed, ifact, ikl, iku, imat, in,
213 $ info, ioff, itran, izero, j, k, k1, kl, ku,
214 $ lda, ldafb, ldb, mode, n, nb, nbmin, nerrs,
215 $ nfact, nfail, nimat, nkl, nku, nrun, nt,
217 REAL ainvnm, amax, anorm, anormi, anormo, anrmpv,
218 $ cndnum, colcnd, rcond, rcondc, rcondi, rcondo,
219 $ roldc, roldi, roldo, rowcnd, rpvgrw,
223 CHARACTER equeds( 4 ), facts( 3 ), transs( ntran )
224 INTEGER iseed( 4 ), iseedy( 4 )
225 REAL result( ntests ), berr( nrhs ),
226 $ errbnds_n( nrhs, 3 ), errbnds_c( nrhs, 3 )
242 INTRINSIC abs, max, min
250 common / infoc / infot, nunit, ok, lerr
251 common / srnamc / srnamt
254 DATA iseedy / 1988, 1989, 1990, 1991 /
255 DATA transs /
'N',
'T',
'C' /
256 DATA facts /
'F',
'N',
'E' /
257 DATA equeds /
'N',
'R',
'C',
'B' /
263 path( 1: 1 ) =
'Single precision'
269 iseed( i ) = iseedy( i )
275 $ CALL
serrvx( path, nout )
294 nkl = max( 1, min( n, 4 ) )
309 ELSE IF( ikl.EQ.2 )
THEN
311 ELSE IF( ikl.EQ.3 )
THEN
313 ELSE IF( ikl.EQ.4 )
THEN
324 ELSE IF( iku.EQ.2 )
THEN
326 ELSE IF( iku.EQ.3 )
THEN
328 ELSE IF( iku.EQ.4 )
THEN
336 ldafb = 2*kl + ku + 1
337 IF( lda*n.GT.la .OR. ldafb*n.GT.lafb )
THEN
338 IF( nfail.EQ.0 .AND. nerrs.EQ.0 )
339 $ CALL
aladhd( nout, path )
340 IF( lda*n.GT.la )
THEN
341 WRITE( nout, fmt = 9999 )la, n, kl, ku,
345 IF( ldafb*n.GT.lafb )
THEN
346 WRITE( nout, fmt = 9998 )lafb, n, kl, ku,
353 DO 120 imat = 1, nimat
357 IF( .NOT.dotype( imat ) )
362 zerot = imat.GE.2 .AND. imat.LE.4
363 IF( zerot .AND. n.LT.imat-1 )
369 CALL
slatb4( path, imat, n, n, type, kl, ku, anorm,
370 $ mode, cndnum, dist )
371 rcondc = one / cndnum
374 CALL
slatms( n, n, dist, iseed, type, rwork, mode,
375 $ cndnum, anorm, kl, ku,
'Z', a, lda, work,
381 CALL
alaerh( path,
'SLATMS', info, 0,
' ', n, n,
382 $ kl, ku, -1, imat, nfail, nerrs, nout )
393 ELSE IF( imat.EQ.3 )
THEN
398 ioff = ( izero-1 )*lda
400 i1 = max( 1, ku+2-izero )
401 i2 = min( kl+ku+1, ku+1+( n-izero ) )
407 DO 30 i = max( 1, ku+2-j ),
408 $ min( kl+ku+1, ku+1+( n-j ) )
418 CALL
slacpy(
'Full', kl+ku+1, n, a, lda, asav, lda )
421 equed = equeds( iequed )
422 IF( iequed.EQ.1 )
THEN
428 DO 100 ifact = 1, nfact
429 fact = facts( ifact )
430 prefac =
lsame( fact,
'F' )
431 nofact =
lsame( fact,
'N' )
432 equil =
lsame( fact,
'E' )
440 ELSE IF( .NOT.nofact )
THEN
447 CALL
slacpy(
'Full', kl+ku+1, n, asav, lda,
448 $ afb( kl+1 ), ldafb )
449 IF( equil .OR. iequed.GT.1 )
THEN
454 CALL
sgbequ( n, n, kl, ku, afb( kl+1 ),
455 $ ldafb, s, s( n+1 ), rowcnd,
456 $ colcnd, amax, info )
457 IF( info.EQ.0 .AND. n.GT.0 )
THEN
458 IF(
lsame( equed,
'R' ) )
THEN
461 ELSE IF(
lsame( equed,
'C' ) )
THEN
464 ELSE IF(
lsame( equed,
'B' ) )
THEN
471 CALL
slaqgb( n, n, kl, ku, afb( kl+1 ),
472 $ ldafb, s, s( n+1 ),
473 $ rowcnd, colcnd, amax,
488 anormo =
slangb(
'1', n, kl, ku, afb( kl+1 ),
490 anormi =
slangb(
'I', n, kl, ku, afb( kl+1 ),
495 CALL
sgbtrf( n, n, kl, ku, afb, ldafb, iwork,
500 CALL
slaset(
'Full', n, n, zero, one, work,
503 CALL
sgbtrs(
'No transpose', n, kl, ku, n,
504 $ afb, ldafb, iwork, work, ldb,
509 ainvnm =
slange(
'1', n, n, work, ldb,
511 IF( anormo.LE.zero .OR. ainvnm.LE.zero )
THEN
514 rcondo = ( one / anormo ) / ainvnm
520 ainvnm =
slange(
'I', n, n, work, ldb,
522 IF( anormi.LE.zero .OR. ainvnm.LE.zero )
THEN
525 rcondi = ( one / anormi ) / ainvnm
529 DO 90 itran = 1, ntran
533 trans = transs( itran )
534 IF( itran.EQ.1 )
THEN
542 CALL
slacpy(
'Full', kl+ku+1, n, asav, lda,
549 CALL
slarhs( path, xtype,
'Full', trans, n,
550 $ n, kl, ku, nrhs, a, lda, xact,
551 $ ldb, b, ldb, iseed, info )
553 CALL
slacpy(
'Full', n, nrhs, b, ldb, bsav,
556 IF( nofact .AND. itran.EQ.1 )
THEN
563 CALL
slacpy(
'Full', kl+ku+1, n, a, lda,
564 $ afb( kl+1 ), ldafb )
565 CALL
slacpy(
'Full', n, nrhs, b, ldb, x,
569 CALL
sgbsv( n, kl, ku, nrhs, afb, ldafb,
570 $ iwork, x, ldb, info )
575 $ CALL
alaerh( path,
'SGBSV ', info,
576 $ izero,
' ', n, n, kl, ku,
577 $ nrhs, imat, nfail, nerrs,
583 CALL
sgbt01( n, n, kl, ku, a, lda, afb,
584 $ ldafb, iwork, work,
587 IF( izero.EQ.0 )
THEN
592 CALL
slacpy(
'Full', n, nrhs, b, ldb,
594 CALL
sgbt02(
'No transpose', n, n, kl,
595 $ ku, nrhs, a, lda, x, ldb,
596 $ work, ldb, result( 2 ) )
601 CALL
sget04( n, nrhs, x, ldb, xact,
602 $ ldb, rcondc, result( 3 ) )
610 IF( result( k ).GE.thresh )
THEN
611 IF( nfail.EQ.0 .AND. nerrs.EQ.0 )
612 $ CALL
aladhd( nout, path )
613 WRITE( nout, fmt = 9997 )
'SGBSV ',
614 $ n, kl, ku, imat, k, result( k )
624 $ CALL
slaset(
'Full', 2*kl+ku+1, n, zero,
626 CALL
slaset(
'Full', n, nrhs, zero, zero, x,
628 IF( iequed.GT.1 .AND. n.GT.0 )
THEN
633 CALL
slaqgb( n, n, kl, ku, a, lda, s,
634 $ s( n+1 ), rowcnd, colcnd,
642 CALL
sgbsvx( fact, trans, n, kl, ku, nrhs, a,
643 $ lda, afb, ldafb, iwork, equed,
644 $ s, s( n+1 ), b, ldb, x, ldb,
645 $ rcond, rwork, rwork( nrhs+1 ),
646 $ work, iwork( n+1 ), info )
651 $ CALL
alaerh( path,
'SGBSVX', info, izero,
652 $ fact // trans, n, n, kl, ku,
653 $ nrhs, imat, nfail, nerrs,
662 DO 60 i = max( ku+2-j, 1 ),
663 $ min( n+ku+1-j, kl+ku+1 )
664 anrmpv = max( anrmpv,
665 $ abs( a( i+( j-1 )*lda ) ) )
668 rpvgrw =
slantb(
'M',
'U',
'N', info,
669 $ min( info-1, kl+ku ),
670 $ afb( max( 1, kl+ku+2-info ) ),
672 IF( rpvgrw.EQ.zero )
THEN
675 rpvgrw = anrmpv / rpvgrw
678 rpvgrw =
slantb(
'M',
'U',
'N', n, kl+ku,
680 IF( rpvgrw.EQ.zero )
THEN
683 rpvgrw =
slangb(
'M', n, kl, ku, a,
684 $ lda, work ) / rpvgrw
687 result( 7 ) = abs( rpvgrw-work( 1 ) ) /
688 $ max( work( 1 ), rpvgrw ) /
691 IF( .NOT.prefac )
THEN
696 CALL
sgbt01( n, n, kl, ku, a, lda, afb,
697 $ ldafb, iwork, work,
709 CALL
slacpy(
'Full', n, nrhs, bsav, ldb,
711 CALL
sgbt02( trans, n, n, kl, ku, nrhs,
712 $ asav, lda, x, ldb, work, ldb,
718 IF( nofact .OR. ( prefac .AND.
719 $
lsame( equed,
'N' ) ) )
THEN
720 CALL
sget04( n, nrhs, x, ldb, xact,
721 $ ldb, rcondc, result( 3 ) )
723 IF( itran.EQ.1 )
THEN
728 CALL
sget04( n, nrhs, x, ldb, xact,
729 $ ldb, roldc, result( 3 ) )
735 CALL
sgbt05( trans, n, kl, ku, nrhs, asav,
736 $ lda, b, ldb, x, ldb, xact,
737 $ ldb, rwork, rwork( nrhs+1 ),
746 result( 6 ) =
sget06( rcond, rcondc )
751 IF( .NOT.trfcon )
THEN
753 IF( result( k ).GE.thresh )
THEN
754 IF( nfail.EQ.0 .AND. nerrs.EQ.0 )
755 $ CALL
aladhd( nout, path )
757 WRITE( nout, fmt = 9995 )
758 $
'SGBSVX', fact, trans, n, kl,
759 $ ku, equed, imat, k,
762 WRITE( nout, fmt = 9996 )
763 $
'SGBSVX', fact, trans, n, kl,
764 $ ku, imat, k, result( k )
771 IF( result( 1 ).GE.thresh .AND. .NOT.
773 IF( nfail.EQ.0 .AND. nerrs.EQ.0 )
774 $ CALL
aladhd( nout, path )
776 WRITE( nout, fmt = 9995 )
'SGBSVX',
777 $ fact, trans, n, kl, ku, equed,
778 $ imat, 1, result( 1 )
780 WRITE( nout, fmt = 9996 )
'SGBSVX',
781 $ fact, trans, n, kl, ku, imat, 1,
787 IF( result( 6 ).GE.thresh )
THEN
788 IF( nfail.EQ.0 .AND. nerrs.EQ.0 )
789 $ CALL
aladhd( nout, path )
791 WRITE( nout, fmt = 9995 )
'SGBSVX',
792 $ fact, trans, n, kl, ku, equed,
793 $ imat, 6, result( 6 )
795 WRITE( nout, fmt = 9996 )
'SGBSVX',
796 $ fact, trans, n, kl, ku, imat, 6,
802 IF( result( 7 ).GE.thresh )
THEN
803 IF( nfail.EQ.0 .AND. nerrs.EQ.0 )
804 $ CALL
aladhd( nout, path )
806 WRITE( nout, fmt = 9995 )
'SGBSVX',
807 $ fact, trans, n, kl, ku, equed,
808 $ imat, 7, result( 7 )
810 WRITE( nout, fmt = 9996 )
'SGBSVX',
811 $ fact, trans, n, kl, ku, imat, 7,
824 CALL
slacpy(
'Full', kl+ku+1, n, asav, lda, a,
826 CALL
slacpy(
'Full', n, nrhs, bsav, ldb, b, ldb )
829 $ CALL
slaset(
'Full', 2*kl+ku+1, n, zero, zero,
831 CALL
slaset(
'Full', n, nrhs, zero, zero, x, ldb )
832 IF( iequed.GT.1 .AND. n.GT.0 )
THEN
837 CALL
slaqgb( n, n, kl, ku, a, lda, s,
838 $ s( n+1 ), rowcnd, colcnd, amax, equed )
846 CALL
sgbsvxx( fact, trans, n, kl, ku, nrhs, a, lda,
847 $ afb, ldafb, iwork, equed, s, s( n+1 ), b, ldb,
848 $ x, ldb, rcond, rpvgrw_svxx, berr, n_err_bnds,
849 $ errbnds_n, errbnds_c, 0, zero, work,
850 $ iwork( n+1 ), info )
854 IF( info.EQ.n+1 ) goto 90
855 IF( info.NE.izero )
THEN
856 CALL
alaerh( path,
'SGBSVXX', info, izero,
857 $ fact // trans, n, n, -1, -1, nrhs,
858 $ imat, nfail, nerrs, nout )
866 IF ( info .GT. 0 .AND. info .LT. n+1 )
THEN
874 result( 7 ) = abs( rpvgrw-rpvgrw_svxx ) /
875 $ max( rpvgrw_svxx, rpvgrw ) /
878 IF( .NOT.prefac )
THEN
883 CALL
sgbt01( n, n, kl, ku, a, lda, afb, ldafb,
896 CALL
slacpy(
'Full', n, nrhs, bsav, ldb, work,
898 CALL
sgbt02( trans, n, n, kl, ku, nrhs, asav,
899 $ lda, x, ldb, work, ldb,
904 IF( nofact .OR. ( prefac .AND.
lsame( equed,
906 CALL
sget04( n, nrhs, x, ldb, xact, ldb,
907 $ rcondc, result( 3 ) )
909 IF( itran.EQ.1 )
THEN
914 CALL
sget04( n, nrhs, x, ldb, xact, ldb,
915 $ roldc, result( 3 ) )
924 result( 6 ) =
sget06( rcond, rcondc )
929 IF( .NOT.trfcon )
THEN
931 IF( result( k ).GE.thresh )
THEN
932 IF( nfail.EQ.0 .AND. nerrs.EQ.0 )
933 $ CALL
aladhd( nout, path )
935 WRITE( nout, fmt = 9995 )
'SGBSVXX',
936 $ fact, trans, n, kl, ku, equed,
937 $ imat, k, result( k )
939 WRITE( nout, fmt = 9996 )
'SGBSVXX',
940 $ fact, trans, n, kl, ku, imat, k,
948 IF( result( 1 ).GE.thresh .AND. .NOT.prefac )
950 IF( nfail.EQ.0 .AND. nerrs.EQ.0 )
951 $ CALL
aladhd( nout, path )
953 WRITE( nout, fmt = 9995 )
'SGBSVXX', fact,
954 $ trans, n, kl, ku, equed, imat, 1,
957 WRITE( nout, fmt = 9996 )
'SGBSVXX', fact,
958 $ trans, n, kl, ku, imat, 1,
964 IF( result( 6 ).GE.thresh )
THEN
965 IF( nfail.EQ.0 .AND. nerrs.EQ.0 )
966 $ CALL
aladhd( nout, path )
968 WRITE( nout, fmt = 9995 )
'SGBSVXX', fact,
969 $ trans, n, kl, ku, equed, imat, 6,
972 WRITE( nout, fmt = 9996 )
'SGBSVXX', fact,
973 $ trans, n, kl, ku, imat, 6,
979 IF( result( 7 ).GE.thresh )
THEN
980 IF( nfail.EQ.0 .AND. nerrs.EQ.0 )
981 $ CALL
aladhd( nout, path )
983 WRITE( nout, fmt = 9995 )
'SGBSVXX', fact,
984 $ trans, n, kl, ku, equed, imat, 7,
987 WRITE( nout, fmt = 9996 )
'SGBSVXX', fact,
988 $ trans, n, kl, ku, imat, 7,
1007 CALL
alasvm( path, nout, nfail, nrun, nerrs )
1014 9999 format(
' *** In SDRVGB, LA=', i5,
' is too small for N=', i5,
1015 $
', KU=', i5,
', KL=', i5, /
' ==> Increase LA to at least ',
1017 9998 format(
' *** In SDRVGB, LAFB=', i5,
' is too small for N=', i5,
1018 $
', KU=', i5,
', KL=', i5, /
1019 $
' ==> Increase LAFB to at least ', i5 )
1020 9997 format( 1x, a,
', N=', i5,
', KL=', i5,
', KU=', i5,
', type ',
1021 $ i1,
', test(', i1,
')=', g12.5 )
1022 9996 format( 1x, a,
'( ''', a1,
''',''', a1,
''',', i5,
',', i5,
',',
1023 $ i5,
',...), type ', i1,
', test(', i1,
')=', g12.5 )
1024 9995 format( 1x, a,
'( ''', a1,
''',''', a1,
''',', i5,
',', i5,
',',
1025 $ i5,
',...), EQUED=''', a1,
''', type ', i1,
', test(', i1,