172 SUBROUTINE zdrvgb( DOTYPE, NN, NVAL, NRHS, THRESH, TSTERR, A, LA,
173 $ AFB, LAFB, ASAV, B, BSAV, X, XACT, S, WORK,
174 $ RWORK, IWORK, NOUT )
182 INTEGER LA, LAFB, NN, NOUT, NRHS
183 DOUBLE PRECISION THRESH
187 INTEGER IWORK( * ), NVAL( * )
188 DOUBLE PRECISION RWORK( * ), S( * )
189 COMPLEX*16 A( * ), AFB( * ), ASAV( * ), B( * ), BSAV( * ),
190 $ work( * ), x( * ), xact( * )
196 DOUBLE PRECISION ONE, ZERO
197 PARAMETER ( ONE = 1.0d+0, zero = 0.0d+0 )
199 parameter( ntypes = 8 )
201 parameter( ntests = 7 )
203 parameter( ntran = 3 )
206 LOGICAL EQUIL, NOFACT, PREFAC, TRFCON, ZEROT
207 CHARACTER DIST, EQUED, FACT, TRANS,
TYPE, XTYPE
209 INTEGER I, I1, I2, IEQUED, IFACT, IKL, IKU, IMAT, IN,
210 $ info, ioff, itran, izero, j, k, k1, kl, ku,
211 $ lda, ldafb, ldb, mode, n, nb, nbmin, nerrs,
212 $ nfact, nfail, nimat, nkl, nku, nrun, nt,
214 DOUBLE PRECISION AINVNM, AMAX, ANORM, ANORMI, ANORMO, ANRMPV,
215 $ CNDNUM, COLCND, RCOND, RCONDC, RCONDI, RCONDO,
216 $ roldc, roldi, roldo, rowcnd, rpvgrw,
220 CHARACTER EQUEDS( 4 ), FACTS( 3 ), TRANSS( NTRAN )
221 INTEGER ISEED( 4 ), ISEEDY( 4 )
222 DOUBLE PRECISION RDUM( 1 ), RESULT( NTESTS ), BERR( NRHS ),
223 $ errbnds_n( nrhs, 3 ), errbnds_c( nrhs, 3 )
227 DOUBLE PRECISION DGET06, DLAMCH, ZLANGB, ZLANGE, ZLANTB,
229 EXTERNAL lsame, dget06, dlamch, zlangb, zlange, zlantb,
239 INTRINSIC abs, dcmplx, max, min
247 COMMON / infoc / infot, nunit, ok, lerr
248 COMMON / srnamc / srnamt
251 DATA iseedy / 1988, 1989, 1990, 1991 /
252 DATA transs /
'N',
'T',
'C' /
253 DATA facts /
'F',
'N',
'E' /
254 DATA equeds /
'N',
'R',
'C',
'B' /
260 path( 1: 1 ) =
'Zomplex precision'
266 iseed( i ) = iseedy( i )
272 $
CALL zerrvx( path, nout )
291 nkl = max( 1, min( n, 4 ) )
306 ELSE IF( ikl.EQ.2 )
THEN
308 ELSE IF( ikl.EQ.3 )
THEN
310 ELSE IF( ikl.EQ.4 )
THEN
321 ELSE IF( iku.EQ.2 )
THEN
323 ELSE IF( iku.EQ.3 )
THEN
325 ELSE IF( iku.EQ.4 )
THEN
333 ldafb = 2*kl + ku + 1
334 IF( lda*n.GT.la .OR. ldafb*n.GT.lafb )
THEN
335 IF( nfail.EQ.0 .AND. nerrs.EQ.0 )
336 $
CALL aladhd( nout, path )
337 IF( lda*n.GT.la )
THEN
338 WRITE( nout, fmt = 9999 )la, n, kl, ku,
342 IF( ldafb*n.GT.lafb )
THEN
343 WRITE( nout, fmt = 9998 )lafb, n, kl, ku,
350 DO 120 imat = 1, nimat
354 IF( .NOT.dotype( imat ) )
359 zerot = imat.GE.2 .AND. imat.LE.4
360 IF( zerot .AND. n.LT.imat-1 )
366 CALL zlatb4( path, imat, n, n,
TYPE, kl, ku, anorm,
367 $ mode, cndnum, dist )
368 rcondc = one / cndnum
371 CALL zlatms( n, n, dist, iseed,
TYPE, rwork, mode,
372 $ cndnum, anorm, kl, ku,
'Z', a, lda, work,
378 CALL alaerh( path,
'ZLATMS', info, 0,
' ', n, n,
379 $ kl, ku, -1, imat, nfail, nerrs, nout )
390 ELSE IF( imat.EQ.3 )
THEN
395 ioff = ( izero-1 )*lda
397 i1 = max( 1, ku+2-izero )
398 i2 = min( kl+ku+1, ku+1+( n-izero ) )
404 DO 30 i = max( 1, ku+2-j ),
405 $ min( kl+ku+1, ku+1+( n-j ) )
415 CALL zlacpy(
'Full', kl+ku+1, n, a, lda, asav, lda )
418 equed = equeds( iequed )
419 IF( iequed.EQ.1 )
THEN
425 DO 100 ifact = 1, nfact
426 fact = facts( ifact )
427 prefac = lsame( fact,
'F' )
428 nofact = lsame( fact,
'N' )
429 equil = lsame( fact,
'E' )
437 ELSE IF( .NOT.nofact )
THEN
444 CALL zlacpy(
'Full', kl+ku+1, n, asav, lda,
445 $ afb( kl+1 ), ldafb )
446 IF( equil .OR. iequed.GT.1 )
THEN
451 CALL zgbequ( n, n, kl, ku, afb( kl+1 ),
452 $ ldafb, s, s( n+1 ), rowcnd,
453 $ colcnd, amax, info )
454 IF( info.EQ.0 .AND. n.GT.0 )
THEN
455 IF( lsame( equed,
'R' ) )
THEN
458 ELSE IF( lsame( equed,
'C' ) )
THEN
461 ELSE IF( lsame( equed,
'B' ) )
THEN
468 CALL zlaqgb( n, n, kl, ku, afb( kl+1 ),
469 $ ldafb, s, s( n+1 ),
470 $ rowcnd, colcnd, amax,
485 anormo = zlangb(
'1', n, kl, ku, afb( kl+1 ),
487 anormi = zlangb(
'I', n, kl, ku, afb( kl+1 ),
492 CALL zgbtrf( n, n, kl, ku, afb, ldafb, iwork,
497 CALL zlaset(
'Full', n, n, dcmplx( zero ),
498 $ dcmplx( one ), work, ldb )
500 CALL zgbtrs(
'No transpose', n, kl, ku, n,
501 $ afb, ldafb, iwork, work, ldb,
506 ainvnm = zlange(
'1', n, n, work, ldb,
508 IF( anormo.LE.zero .OR. ainvnm.LE.zero )
THEN
511 rcondo = ( one / anormo ) / ainvnm
517 ainvnm = zlange(
'I', n, n, work, ldb,
519 IF( anormi.LE.zero .OR. ainvnm.LE.zero )
THEN
522 rcondi = ( one / anormi ) / ainvnm
526 DO 90 itran = 1, ntran
530 trans = transs( itran )
531 IF( itran.EQ.1 )
THEN
539 CALL zlacpy(
'Full', kl+ku+1, n, asav, lda,
546 CALL zlarhs( path, xtype,
'Full', trans, n,
547 $ n, kl, ku, nrhs, a, lda, xact,
548 $ ldb, b, ldb, iseed, info )
550 CALL zlacpy(
'Full', n, nrhs, b, ldb, bsav,
553 IF( nofact .AND. itran.EQ.1 )
THEN
560 CALL zlacpy(
'Full', kl+ku+1, n, a, lda,
561 $ afb( kl+1 ), ldafb )
562 CALL zlacpy(
'Full', n, nrhs, b, ldb, x,
566 CALL zgbsv( n, kl, ku, nrhs, afb, ldafb,
567 $ iwork, x, ldb, info )
572 $
CALL alaerh( path,
'ZGBSV ', info,
573 $ izero,
' ', n, n, kl, ku,
574 $ nrhs, imat, nfail, nerrs,
580 CALL zgbt01( n, n, kl, ku, a, lda, afb,
581 $ ldafb, iwork, work,
584 IF( izero.EQ.0 )
THEN
589 CALL zlacpy(
'Full', n, nrhs, b, ldb,
591 CALL zgbt02(
'No transpose', n, n, kl,
592 $ ku, nrhs, a, lda, x, ldb,
599 CALL zget04( n, nrhs, x, ldb, xact,
600 $ ldb, rcondc, result( 3 ) )
608 IF( result( k ).GE.thresh )
THEN
609 IF( nfail.EQ.0 .AND. nerrs.EQ.0 )
610 $
CALL aladhd( nout, path )
611 WRITE( nout, fmt = 9997 )
'ZGBSV ',
612 $ n, kl, ku, imat, k, result( k )
622 $
CALL zlaset(
'Full', 2*kl+ku+1, n,
624 $ dcmplx( zero ), afb, ldafb )
625 CALL zlaset(
'Full', n, nrhs, dcmplx( zero ),
626 $ dcmplx( zero ), x, ldb )
627 IF( iequed.GT.1 .AND. n.GT.0 )
THEN
632 CALL zlaqgb( n, n, kl, ku, a, lda, s,
633 $ s( n+1 ), rowcnd, colcnd,
641 CALL zgbsvx( fact, trans, n, kl, ku, nrhs, a,
642 $ lda, afb, ldafb, iwork, equed,
643 $ s, s( ldb+1 ), b, ldb, x, ldb,
644 $ rcond, rwork, rwork( nrhs+1 ),
645 $ work, rwork( 2*nrhs+1 ), info )
650 $
CALL alaerh( path,
'ZGBSVX', info, izero,
651 $ fact // trans, n, n, kl, ku,
652 $ nrhs, imat, nfail, nerrs,
661 DO 60 i = max( ku+2-j, 1 ),
662 $ min( n+ku+1-j, kl+ku+1 )
663 anrmpv = max( anrmpv,
664 $ abs( a( i+( j-1 )*lda ) ) )
667 rpvgrw = zlantb(
'M',
'U',
'N', info,
668 $ min( info-1, kl+ku ),
669 $ afb( max( 1, kl+ku+2-info ) ),
671 IF( rpvgrw.EQ.zero )
THEN
674 rpvgrw = anrmpv / rpvgrw
677 rpvgrw = zlantb(
'M',
'U',
'N', n, kl+ku,
679 IF( rpvgrw.EQ.zero )
THEN
682 rpvgrw = zlangb(
'M', n, kl, ku, a,
683 $ lda, rdum ) / rpvgrw
686 result( 7 ) = abs( rpvgrw-rwork( 2*nrhs+1 ) )
687 $ / max( rwork( 2*nrhs+1 ),
688 $ rpvgrw ) / dlamch(
'E' )
690 IF( .NOT.prefac )
THEN
695 CALL zgbt01( n, n, kl, ku, a, lda, afb,
696 $ ldafb, iwork, work,
708 CALL zlacpy(
'Full', n, nrhs, bsav, ldb,
710 CALL zgbt02( trans, n, n, kl, ku, nrhs,
711 $ asav, lda, x, ldb, work, ldb,
718 IF( nofact .OR. ( prefac .AND.
719 $ lsame( equed,
'N' ) ) )
THEN
720 CALL zget04( n, nrhs, x, ldb, xact,
721 $ ldb, rcondc, result( 3 ) )
723 IF( itran.EQ.1 )
THEN
728 CALL zget04( n, nrhs, x, ldb, xact,
729 $ ldb, roldc, result( 3 ) )
735 CALL zgbt05( trans, n, kl, ku, nrhs, asav,
736 $ lda, bsav, ldb, x, ldb, xact,
737 $ ldb, rwork, rwork( nrhs+1 ),
746 result( 6 ) = dget06( 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 $
'ZGBSVX', fact, trans, n, kl,
759 $ ku, equed, imat, k,
762 WRITE( nout, fmt = 9996 )
763 $
'ZGBSVX', 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 )
'ZGBSVX',
777 $ fact, trans, n, kl, ku, equed,
778 $ imat, 1, result( 1 )
780 WRITE( nout, fmt = 9996 )
'ZGBSVX',
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 )
'ZGBSVX',
792 $ fact, trans, n, kl, ku, equed,
793 $ imat, 6, result( 6 )
795 WRITE( nout, fmt = 9996 )
'ZGBSVX',
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 )
'ZGBSVX',
807 $ fact, trans, n, kl, ku, equed,
808 $ imat, 7, result( 7 )
810 WRITE( nout, fmt = 9996 )
'ZGBSVX',
811 $ fact, trans, n, kl, ku, imat, 7,
825 CALL zlacpy(
'Full', kl+ku+1, n, asav, lda, a,
827 CALL zlacpy(
'Full', n, nrhs, bsav, ldb, b, ldb )
830 $
CALL zlaset(
'Full', 2*kl+ku+1, n,
831 $ dcmplx( zero ), dcmplx( zero ),
833 CALL zlaset(
'Full', n, nrhs,
834 $ dcmplx( zero ), dcmplx( zero ),
836 IF( iequed.GT.1 .AND. n.GT.0 )
THEN
841 CALL zlaqgb( n, n, kl, ku, a, lda, s,
842 $ s( n+1 ), rowcnd, colcnd, amax, equed )
850 CALL zgbsvxx( fact, trans, n, kl, ku, nrhs, a, lda,
851 $ afb, ldafb, iwork, equed, s, s( n+1 ), b, ldb,
852 $ x, ldb, rcond, rpvgrw_svxx, berr, n_err_bnds,
853 $ errbnds_n, errbnds_c, 0, zero, work,
858 IF( info.EQ.n+1 )
GOTO 90
859 IF( info.NE.izero )
THEN
860 CALL alaerh( path,
'ZGBSVXX', info, izero,
861 $ fact // trans, n, n, -1, -1, nrhs,
862 $ imat, nfail, nerrs, nout )
870 IF ( info .GT. 0 .AND. info .LT. n+1 )
THEN
878 result( 7 ) = abs( rpvgrw-rpvgrw_svxx ) /
879 $ max( rpvgrw_svxx, rpvgrw ) /
882 IF( .NOT.prefac )
THEN
887 CALL zgbt01( n, n, kl, ku, a, lda, afb, ldafb,
888 $ iwork, work( 2*nrhs+1 ), result( 1 ) )
899 CALL zlacpy(
'Full', n, nrhs, bsav, ldb, work,
901 CALL zgbt02( trans, n, n, kl, ku, nrhs, asav,
902 $ lda, x, ldb, work, ldb, rwork,
907 IF( nofact .OR. ( prefac .AND. lsame( equed,
909 CALL zget04( n, nrhs, x, ldb, xact, ldb,
910 $ rcondc, result( 3 ) )
912 IF( itran.EQ.1 )
THEN
917 CALL zget04( n, nrhs, x, ldb, xact, ldb,
918 $ roldc, result( 3 ) )
927 result( 6 ) = dget06( rcond, rcondc )
932 IF( .NOT.trfcon )
THEN
934 IF( result( k ).GE.thresh )
THEN
935 IF( nfail.EQ.0 .AND. nerrs.EQ.0 )
936 $
CALL aladhd( nout, path )
938 WRITE( nout, fmt = 9995 )
'ZGBSVXX',
939 $ fact, trans, n, kl, ku, equed,
940 $ imat, k, result( k )
942 WRITE( nout, fmt = 9996 )
'ZGBSVXX',
943 $ fact, trans, n, kl, ku, imat, k,
951 IF( result( 1 ).GE.thresh .AND. .NOT.prefac )
953 IF( nfail.EQ.0 .AND. nerrs.EQ.0 )
954 $
CALL aladhd( nout, path )
956 WRITE( nout, fmt = 9995 )
'ZGBSVXX', fact,
957 $ trans, n, kl, ku, equed, imat, 1,
960 WRITE( nout, fmt = 9996 )
'ZGBSVXX', fact,
961 $ trans, n, kl, ku, imat, 1,
967 IF( result( 6 ).GE.thresh )
THEN
968 IF( nfail.EQ.0 .AND. nerrs.EQ.0 )
969 $
CALL aladhd( nout, path )
971 WRITE( nout, fmt = 9995 )
'ZGBSVXX', fact,
972 $ trans, n, kl, ku, equed, imat, 6,
975 WRITE( nout, fmt = 9996 )
'ZGBSVXX', fact,
976 $ trans, n, kl, ku, imat, 6,
982 IF( result( 7 ).GE.thresh )
THEN
983 IF( nfail.EQ.0 .AND. nerrs.EQ.0 )
984 $
CALL aladhd( nout, path )
986 WRITE( nout, fmt = 9995 )
'ZGBSVXX', fact,
987 $ trans, n, kl, ku, equed, imat, 7,
990 WRITE( nout, fmt = 9996 )
'ZGBSVXX', fact,
991 $ trans, n, kl, ku, imat, 7,
1010 CALL alasvm( path, nout, nfail, nrun, nerrs )
1017 9999
FORMAT(
' *** In ZDRVGB, LA=', i5,
' is too small for N=', i5,
1018 $
', KU=', i5,
', KL=', i5, /
' ==> Increase LA to at least ',
1020 9998
FORMAT(
' *** In ZDRVGB, LAFB=', i5,
' is too small for N=', i5,
1021 $
', KU=', i5,
', KL=', i5, /
1022 $
' ==> Increase LAFB to at least ', i5 )
1023 9997
FORMAT( 1x, a,
', N=', i5,
', KL=', i5,
', KU=', i5,
', type ',
1024 $ i1,
', test(', i1,
')=', g12.5 )
1025 9996
FORMAT( 1x, a,
'( ''', a1,
''',''', a1,
''',', i5,
',', i5,
',',
1026 $ i5,
',...), type ', i1,
', test(', i1,
')=', g12.5 )
1027 9995
FORMAT( 1x, a,
'( ''', a1,
''',''', a1,
''',', i5,
',', i5,
',',
1028 $ i5,
',...), EQUED=''', a1,
''', type ', i1,
', test(', i1,