00001 SUBROUTINE CCHKGL( NIN, NOUT )
00002
00003
00004
00005
00006
00007
00008 INTEGER NIN, NOUT
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 INTEGER LDA, LDB, LWORK
00029 PARAMETER ( LDA = 20, LDB = 20, LWORK = 6*LDA )
00030 REAL ZERO
00031 PARAMETER ( ZERO = 0.0E+0 )
00032
00033
00034 INTEGER I, IHI, IHIIN, ILO, ILOIN, INFO, J, KNT, N,
00035 $ NINFO
00036 REAL ANORM, BNORM, EPS, RMAX, VMAX
00037
00038
00039 INTEGER LMAX( 3 )
00040 REAL LSCALE( LDA ), LSCLIN( LDA ), RSCALE( LDA ),
00041 $ RSCLIN( LDA ), WORK( LWORK )
00042 COMPLEX A( LDA, LDA ), AIN( LDA, LDA ), B( LDB, LDB ),
00043 $ BIN( LDB, LDB )
00044
00045
00046 REAL CLANGE, SLAMCH
00047 EXTERNAL CLANGE, SLAMCH
00048
00049
00050 EXTERNAL CGGBAL
00051
00052
00053 INTRINSIC ABS, MAX
00054
00055
00056
00057 LMAX( 1 ) = 0
00058 LMAX( 2 ) = 0
00059 LMAX( 3 ) = 0
00060 NINFO = 0
00061 KNT = 0
00062 RMAX = ZERO
00063
00064 EPS = SLAMCH( 'Precision' )
00065
00066 10 CONTINUE
00067
00068 READ( NIN, FMT = * )N
00069 IF( N.EQ.0 )
00070 $ GO TO 90
00071 DO 20 I = 1, N
00072 READ( NIN, FMT = * )( A( I, J ), J = 1, N )
00073 20 CONTINUE
00074
00075 DO 30 I = 1, N
00076 READ( NIN, FMT = * )( B( I, J ), J = 1, N )
00077 30 CONTINUE
00078
00079 READ( NIN, FMT = * )ILOIN, IHIIN
00080 DO 40 I = 1, N
00081 READ( NIN, FMT = * )( AIN( I, J ), J = 1, N )
00082 40 CONTINUE
00083 DO 50 I = 1, N
00084 READ( NIN, FMT = * )( BIN( I, J ), J = 1, N )
00085 50 CONTINUE
00086
00087 READ( NIN, FMT = * )( LSCLIN( I ), I = 1, N )
00088 READ( NIN, FMT = * )( RSCLIN( I ), I = 1, N )
00089
00090 ANORM = CLANGE( 'M', N, N, A, LDA, WORK )
00091 BNORM = CLANGE( 'M', N, N, B, LDB, WORK )
00092
00093 KNT = KNT + 1
00094
00095 CALL CGGBAL( 'B', N, A, LDA, B, LDB, ILO, IHI, LSCALE, RSCALE,
00096 $ WORK, INFO )
00097
00098 IF( INFO.NE.0 ) THEN
00099 NINFO = NINFO + 1
00100 LMAX( 1 ) = KNT
00101 END IF
00102
00103 IF( ILO.NE.ILOIN .OR. IHI.NE.IHIIN ) THEN
00104 NINFO = NINFO + 1
00105 LMAX( 2 ) = KNT
00106 END IF
00107
00108 VMAX = ZERO
00109 DO 70 I = 1, N
00110 DO 60 J = 1, N
00111 VMAX = MAX( VMAX, ABS( A( I, J )-AIN( I, J ) ) )
00112 VMAX = MAX( VMAX, ABS( B( I, J )-BIN( I, J ) ) )
00113 60 CONTINUE
00114 70 CONTINUE
00115
00116 DO 80 I = 1, N
00117 VMAX = MAX( VMAX, ABS( LSCALE( I )-LSCLIN( I ) ) )
00118 VMAX = MAX( VMAX, ABS( RSCALE( I )-RSCLIN( I ) ) )
00119 80 CONTINUE
00120
00121 VMAX = VMAX / ( EPS*MAX( ANORM, BNORM ) )
00122
00123 IF( VMAX.GT.RMAX ) THEN
00124 LMAX( 3 ) = KNT
00125 RMAX = VMAX
00126 END IF
00127
00128 GO TO 10
00129
00130 90 CONTINUE
00131
00132 WRITE( NOUT, FMT = 9999 )
00133 9999 FORMAT( ' .. test output of CGGBAL .. ' )
00134
00135 WRITE( NOUT, FMT = 9998 )RMAX
00136 9998 FORMAT( ' ratio of largest test error = ', E12.3 )
00137 WRITE( NOUT, FMT = 9997 )LMAX( 1 )
00138 9997 FORMAT( ' example number where info is not zero = ', I4 )
00139 WRITE( NOUT, FMT = 9996 )LMAX( 2 )
00140 9996 FORMAT( ' example number where ILO or IHI is wrong = ', I4 )
00141 WRITE( NOUT, FMT = 9995 )LMAX( 3 )
00142 9995 FORMAT( ' example number having largest error = ', I4 )
00143 WRITE( NOUT, FMT = 9994 )NINFO
00144 9994 FORMAT( ' number of examples where info is not 0 = ', I4 )
00145 WRITE( NOUT, FMT = 9993 )KNT
00146 9993 FORMAT( ' total number of examples tested = ', I4 )
00147
00148 RETURN
00149
00150
00151
00152 END