164 SUBROUTINE cdrvge( DOTYPE, NN, NVAL, NRHS, THRESH, TSTERR, NMAX,
165 $ A, AFAC, ASAV, B, BSAV, X, XACT, S, WORK,
166 $ RWORK, IWORK, NOUT )
174 INTEGER NMAX, NN, NOUT, NRHS
179 INTEGER IWORK( * ), NVAL( * )
180 REAL RWORK( * ), S( * )
181 COMPLEX A( * ), AFAC( * ), ASAV( * ), B( * ),
182 $ bsav( * ), work( * ), x( * ), xact( * )
189 PARAMETER ( ONE = 1.0e+0, zero = 0.0e+0 )
191 parameter( ntypes = 11 )
193 parameter( ntests = 7 )
195 parameter( ntran = 3 )
198 LOGICAL EQUIL, NOFACT, PREFAC, TRFCON, ZEROT
199 CHARACTER DIST, EQUED, FACT, TRANS,
TYPE, XTYPE
201 INTEGER I, IEQUED, IFACT, IMAT, IN, INFO, IOFF, ITRAN,
202 $ izero, k, k1, kl, ku, lda, lwork, mode, n, nb,
203 $ nbmin, nerrs, nfact, nfail, nimat, nrun, nt,
205 REAL AINVNM, AMAX, ANORM, ANORMI, ANORMO, CNDNUM,
206 $ COLCND, RCOND, RCONDC, RCONDI, RCONDO, ROLDC,
207 $ roldi, roldo, rowcnd, rpvgrw, rpvgrw_svxx
210 CHARACTER EQUEDS( 4 ), FACTS( 3 ), TRANSS( NTRAN )
211 INTEGER ISEED( 4 ), ISEEDY( 4 )
212 REAL RDUM( 1 ), RESULT( NTESTS ), BERR( NRHS ),
213 $ errbnds_n( nrhs, 3 ), errbnds_c( nrhs, 3 )
217 REAL CLANGE, CLANTR, SGET06, SLAMCH, CLA_GERPVGRW
218 EXTERNAL lsame, clange, clantr, sget06, slamch,
228 INTRINSIC abs, cmplx, max
236 COMMON / infoc / infot, nunit, ok, lerr
237 COMMON / srnamc / srnamt
240 DATA iseedy / 1988, 1989, 1990, 1991 /
241 DATA transs /
'N',
'T',
'C' /
242 DATA facts /
'F',
'N',
'E' /
243 DATA equeds /
'N',
'R',
'C',
'B' /
249 path( 1: 1 ) =
'Complex precision'
255 iseed( i ) = iseedy( i )
261 $
CALL cerrvx( path, nout )
281 DO 80 imat = 1, nimat
285 IF( .NOT.dotype( imat ) )
290 zerot = imat.GE.5 .AND. imat.LE.7
291 IF( zerot .AND. n.LT.imat-4 )
297 CALL clatb4( path, imat, n, n,
TYPE, kl, ku, anorm, mode,
299 rcondc = one / cndnum
302 CALL clatms( n, n, dist, iseed,
TYPE, rwork, mode, cndnum,
303 $ anorm, kl, ku,
'No packing', a, lda, work,
309 CALL alaerh( path,
'CLATMS', info, 0,
' ', n, n, -1, -1,
310 $ -1, imat, nfail, nerrs, nout )
320 ELSE IF( imat.EQ.6 )
THEN
325 ioff = ( izero-1 )*lda
331 CALL claset(
'Full', n, n-izero+1, cmplx( zero ),
332 $ cmplx( zero ), a( ioff+1 ), lda )
340 CALL clacpy(
'Full', n, n, a, lda, asav, lda )
343 equed = equeds( iequed )
344 IF( iequed.EQ.1 )
THEN
350 DO 60 ifact = 1, nfact
351 fact = facts( ifact )
352 prefac = lsame( fact,
'F' )
353 nofact = lsame( fact,
'N' )
354 equil = lsame( fact,
'E' )
362 ELSE IF( .NOT.nofact )
THEN
369 CALL clacpy(
'Full', n, n, asav, lda, afac, lda )
370 IF( equil .OR. iequed.GT.1 )
THEN
375 CALL cgeequ( n, n, afac, lda, s, s( n+1 ),
376 $ rowcnd, colcnd, amax, info )
377 IF( info.EQ.0 .AND. n.GT.0 )
THEN
378 IF( lsame( equed,
'R' ) )
THEN
381 ELSE IF( lsame( equed,
'C' ) )
THEN
384 ELSE IF( lsame( equed,
'B' ) )
THEN
391 CALL claqge( n, n, afac, lda, s, s( n+1 ),
392 $ rowcnd, colcnd, amax, equed )
406 anormo = clange(
'1', n, n, afac, lda, rwork )
407 anormi = clange(
'I', n, n, afac, lda, rwork )
411 CALL cgetrf( n, n, afac, lda, iwork, info )
415 CALL clacpy(
'Full', n, n, afac, lda, a, lda )
416 lwork = nmax*max( 3, nrhs )
417 CALL cgetri( n, a, lda, iwork, work, lwork, info )
421 ainvnm = clange(
'1', n, n, a, lda, rwork )
422 IF( anormo.LE.zero .OR. ainvnm.LE.zero )
THEN
425 rcondo = ( one / anormo ) / ainvnm
430 ainvnm = clange(
'I', n, n, a, lda, rwork )
431 IF( anormi.LE.zero .OR. ainvnm.LE.zero )
THEN
434 rcondi = ( one / anormi ) / ainvnm
438 DO 50 itran = 1, ntran
442 trans = transs( itran )
443 IF( itran.EQ.1 )
THEN
451 CALL clacpy(
'Full', n, n, asav, lda, a, lda )
456 CALL clarhs( path, xtype,
'Full', trans, n, n, kl,
457 $ ku, nrhs, a, lda, xact, lda, b, lda,
460 CALL clacpy(
'Full', n, nrhs, b, lda, bsav, lda )
462 IF( nofact .AND. itran.EQ.1 )
THEN
469 CALL clacpy(
'Full', n, n, a, lda, afac, lda )
470 CALL clacpy(
'Full', n, nrhs, b, lda, x, lda )
473 CALL cgesv( n, nrhs, afac, lda, iwork, x, lda,
479 $
CALL alaerh( path,
'CGESV ', info, izero,
480 $
' ', n, n, -1, -1, nrhs, imat,
481 $ nfail, nerrs, nout )
486 CALL cget01( n, n, a, lda, afac, lda, iwork,
487 $ rwork, result( 1 ) )
489 IF( izero.EQ.0 )
THEN
493 CALL clacpy(
'Full', n, nrhs, b, lda, work,
495 CALL cget02(
'No transpose', n, n, nrhs, a,
496 $ lda, x, lda, work, lda, rwork,
501 CALL cget04( n, nrhs, x, lda, xact, lda,
502 $ rcondc, result( 3 ) )
510 IF( result( k ).GE.thresh )
THEN
511 IF( nfail.EQ.0 .AND. nerrs.EQ.0 )
512 $
CALL aladhd( nout, path )
513 WRITE( nout, fmt = 9999 )
'CGESV ', n,
514 $ imat, k, result( k )
524 $
CALL claset(
'Full', n, n, cmplx( zero ),
525 $ cmplx( zero ), afac, lda )
526 CALL claset(
'Full', n, nrhs, cmplx( zero ),
527 $ cmplx( zero ), x, lda )
528 IF( iequed.GT.1 .AND. n.GT.0 )
THEN
533 CALL claqge( n, n, a, lda, s, s( n+1 ), rowcnd,
534 $ colcnd, amax, equed )
541 CALL cgesvx( fact, trans, n, nrhs, a, lda, afac,
542 $ lda, iwork, equed, s, s( n+1 ), b,
543 $ lda, x, lda, rcond, rwork,
544 $ rwork( nrhs+1 ), work,
545 $ rwork( 2*nrhs+1 ), info )
550 $
CALL alaerh( path,
'CGESVX', info, izero,
551 $ fact // trans, n, n, -1, -1, nrhs,
552 $ imat, nfail, nerrs, nout )
558 rpvgrw = clantr(
'M',
'U',
'N', info, info,
560 IF( rpvgrw.EQ.zero )
THEN
563 rpvgrw = clange(
'M', n, info, a, lda,
567 rpvgrw = clantr(
'M',
'U',
'N', n, n, afac, lda,
569 IF( rpvgrw.EQ.zero )
THEN
572 rpvgrw = clange(
'M', n, n, a, lda, rdum ) /
576 result( 7 ) = abs( rpvgrw-rwork( 2*nrhs+1 ) ) /
577 $ max( rwork( 2*nrhs+1 ), rpvgrw ) /
580 IF( .NOT.prefac )
THEN
585 CALL cget01( n, n, a, lda, afac, lda, iwork,
586 $ rwork( 2*nrhs+1 ), result( 1 ) )
597 CALL clacpy(
'Full', n, nrhs, bsav, lda, work,
599 CALL cget02( trans, n, n, nrhs, asav, lda, x,
600 $ lda, work, lda, rwork( 2*nrhs+1 ),
605 IF( nofact .OR. ( prefac .AND. lsame( equed,
607 CALL cget04( n, nrhs, x, lda, xact, lda,
608 $ rcondc, result( 3 ) )
610 IF( itran.EQ.1 )
THEN
615 CALL cget04( n, nrhs, x, lda, xact, lda,
616 $ roldc, result( 3 ) )
622 CALL cget07( trans, n, nrhs, asav, lda, b, lda,
623 $ x, lda, xact, lda, rwork, .true.,
624 $ rwork( nrhs+1 ), result( 4 ) )
632 result( 6 ) = sget06( rcond, rcondc )
637 IF( .NOT.trfcon )
THEN
639 IF( result( k ).GE.thresh )
THEN
640 IF( nfail.EQ.0 .AND. nerrs.EQ.0 )
641 $
CALL aladhd( nout, path )
643 WRITE( nout, fmt = 9997 )
'CGESVX',
644 $ fact, trans, n, equed, imat, k,
647 WRITE( nout, fmt = 9998 )
'CGESVX',
648 $ fact, trans, n, imat, k, result( k )
655 IF( result( 1 ).GE.thresh .AND. .NOT.prefac )
657 IF( nfail.EQ.0 .AND. nerrs.EQ.0 )
658 $
CALL aladhd( nout, path )
660 WRITE( nout, fmt = 9997 )
'CGESVX', fact,
661 $ trans, n, equed, imat, 1, result( 1 )
663 WRITE( nout, fmt = 9998 )
'CGESVX', fact,
664 $ trans, n, imat, 1, result( 1 )
669 IF( result( 6 ).GE.thresh )
THEN
670 IF( nfail.EQ.0 .AND. nerrs.EQ.0 )
671 $
CALL aladhd( nout, path )
673 WRITE( nout, fmt = 9997 )
'CGESVX', fact,
674 $ trans, n, equed, imat, 6, result( 6 )
676 WRITE( nout, fmt = 9998 )
'CGESVX', fact,
677 $ trans, n, imat, 6, result( 6 )
682 IF( result( 7 ).GE.thresh )
THEN
683 IF( nfail.EQ.0 .AND. nerrs.EQ.0 )
684 $
CALL aladhd( nout, path )
686 WRITE( nout, fmt = 9997 )
'CGESVX', fact,
687 $ trans, n, equed, imat, 7, result( 7 )
689 WRITE( nout, fmt = 9998 )
'CGESVX', fact,
690 $ trans, n, imat, 7, result( 7 )
703 CALL clacpy(
'Full', n, n, asav, lda, a, lda )
704 CALL clacpy(
'Full', n, nrhs, bsav, lda, b, lda )
707 $
CALL claset(
'Full', n, n, cmplx( zero ),
708 $ cmplx( zero ), afac, lda )
709 CALL claset(
'Full', n, nrhs, cmplx( zero ),
710 $ cmplx( zero ), x, lda )
711 IF( iequed.GT.1 .AND. n.GT.0 )
THEN
716 CALL claqge( n, n, a, lda, s, s( n+1 ), rowcnd,
717 $ colcnd, amax, equed )
725 CALL cgesvxx( fact, trans, n, nrhs, a, lda, afac,
726 $ lda, iwork, equed, s, s( n+1 ), b, lda, x,
727 $ lda, rcond, rpvgrw_svxx, berr, n_err_bnds,
728 $ errbnds_n, errbnds_c, 0, zero, work,
733 IF( info.EQ.n+1 )
GOTO 50
734 IF( info.NE.izero )
THEN
735 CALL alaerh( path,
'CGESVXX', info, izero,
736 $ fact // trans, n, n, -1, -1, nrhs,
737 $ imat, nfail, nerrs, nout )
745 IF ( info .GT. 0 .AND. info .LT. n+1 )
THEN
746 rpvgrw = cla_gerpvgrw
747 $ (n, info, a, lda, afac, lda)
749 rpvgrw = cla_gerpvgrw
750 $ (n, n, a, lda, afac, lda)
753 result( 7 ) = abs( rpvgrw-rpvgrw_svxx ) /
754 $ max( rpvgrw_svxx, rpvgrw ) /
757 IF( .NOT.prefac )
THEN
762 CALL cget01( n, n, a, lda, afac, lda, iwork,
763 $ rwork( 2*nrhs+1 ), result( 1 ) )
774 CALL clacpy(
'Full', n, nrhs, bsav, lda, work,
776 CALL cget02( trans, n, n, nrhs, asav, lda, x,
777 $ lda, work, lda, rwork( 2*nrhs+1 ),
782 IF( nofact .OR. ( prefac .AND. lsame( equed,
784 CALL cget04( n, nrhs, x, lda, xact, lda,
785 $ rcondc, result( 3 ) )
787 IF( itran.EQ.1 )
THEN
792 CALL cget04( n, nrhs, x, lda, xact, lda,
793 $ roldc, result( 3 ) )
802 result( 6 ) = sget06( rcond, rcondc )
807 IF( .NOT.trfcon )
THEN
809 IF( result( k ).GE.thresh )
THEN
810 IF( nfail.EQ.0 .AND. nerrs.EQ.0 )
811 $
CALL aladhd( nout, path )
813 WRITE( nout, fmt = 9997 )
'CGESVXX',
814 $ fact, trans, n, equed, imat, k,
817 WRITE( nout, fmt = 9998 )
'CGESVXX',
818 $ fact, trans, n, imat, k, result( k )
825 IF( result( 1 ).GE.thresh .AND. .NOT.prefac )
827 IF( nfail.EQ.0 .AND. nerrs.EQ.0 )
828 $
CALL aladhd( nout, path )
830 WRITE( nout, fmt = 9997 )
'CGESVXX', fact,
831 $ trans, n, equed, imat, 1, result( 1 )
833 WRITE( nout, fmt = 9998 )
'CGESVXX', fact,
834 $ trans, n, imat, 1, result( 1 )
839 IF( result( 6 ).GE.thresh )
THEN
840 IF( nfail.EQ.0 .AND. nerrs.EQ.0 )
841 $
CALL aladhd( nout, path )
843 WRITE( nout, fmt = 9997 )
'CGESVXX', fact,
844 $ trans, n, equed, imat, 6, result( 6 )
846 WRITE( nout, fmt = 9998 )
'CGESVXX', fact,
847 $ trans, n, imat, 6, result( 6 )
852 IF( result( 7 ).GE.thresh )
THEN
853 IF( nfail.EQ.0 .AND. nerrs.EQ.0 )
854 $
CALL aladhd( nout, path )
856 WRITE( nout, fmt = 9997 )
'CGESVXX', fact,
857 $ trans, n, equed, imat, 7, result( 7 )
859 WRITE( nout, fmt = 9998 )
'CGESVXX', fact,
860 $ trans, n, imat, 7, result( 7 )
876 CALL alasvm( path, nout, nfail, nrun, nerrs )
883 9999
FORMAT( 1x, a,
', N =', i5,
', type ', i2,
', test(', i2,
') =',
885 9998
FORMAT( 1x, a,
', FACT=''', a1,
''', TRANS=''', a1,
''', N=', i5,
886 $
', type ', i2,
', test(', i1,
')=', g12.5 )
887 9997
FORMAT( 1x, a,
', FACT=''', a1,
''', TRANS=''', a1,
''', N=', i5,
888 $
', EQUED=''', a1,
''', type ', i2,
', test(', i1,
')=',