LAPACK 3.3.1
Linear Algebra PACKage
|
00001 SUBROUTINE CCHKBL( NIN, NOUT ) 00002 * 00003 * -- LAPACK test routine (version 3.1) -- 00004 * Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. 00005 * November 2006 00006 * 00007 * .. Scalar Arguments .. 00008 INTEGER NIN, NOUT 00009 * .. 00010 * 00011 * Purpose 00012 * ======= 00013 * 00014 * CCHKBL tests CGEBAL, a routine for balancing a general complex 00015 * matrix and isolating some of its eigenvalues. 00016 * 00017 * Arguments 00018 * ========= 00019 * 00020 * NIN (input) INTEGER 00021 * The logical unit number for input. NIN > 0. 00022 * 00023 * NOUT (input) INTEGER 00024 * The logical unit number for output. NOUT > 0. 00025 * 00026 * ====================================================================== 00027 * 00028 * .. Parameters .. 00029 INTEGER LDA 00030 PARAMETER ( LDA = 20 ) 00031 REAL ZERO 00032 PARAMETER ( ZERO = 0.0E+0 ) 00033 * .. 00034 * .. Local Scalars .. 00035 INTEGER I, IHI, IHIIN, ILO, ILOIN, INFO, J, KNT, N, 00036 $ NINFO 00037 REAL ANORM, MEPS, RMAX, SFMIN, TEMP, VMAX 00038 COMPLEX CDUM 00039 * .. 00040 * .. Local Arrays .. 00041 INTEGER LMAX( 3 ) 00042 REAL DUMMY( 1 ), SCALE( LDA ), SCALIN( LDA ) 00043 COMPLEX A( LDA, LDA ), AIN( LDA, LDA ) 00044 * .. 00045 * .. External Functions .. 00046 REAL CLANGE, SLAMCH 00047 EXTERNAL CLANGE, SLAMCH 00048 * .. 00049 * .. External Subroutines .. 00050 EXTERNAL CGEBAL 00051 * .. 00052 * .. Intrinsic Functions .. 00053 INTRINSIC ABS, AIMAG, MAX, REAL 00054 * .. 00055 * .. Statement Functions .. 00056 REAL CABS1 00057 * .. 00058 * .. Statement Function definitions .. 00059 CABS1( CDUM ) = ABS( REAL( CDUM ) ) + ABS( AIMAG( CDUM ) ) 00060 * .. 00061 * .. Executable Statements .. 00062 * 00063 LMAX( 1 ) = 0 00064 LMAX( 2 ) = 0 00065 LMAX( 3 ) = 0 00066 NINFO = 0 00067 KNT = 0 00068 RMAX = ZERO 00069 VMAX = ZERO 00070 SFMIN = SLAMCH( 'S' ) 00071 MEPS = SLAMCH( 'E' ) 00072 * 00073 10 CONTINUE 00074 * 00075 READ( NIN, FMT = * )N 00076 IF( N.EQ.0 ) 00077 $ GO TO 70 00078 DO 20 I = 1, N 00079 READ( NIN, FMT = * )( A( I, J ), J = 1, N ) 00080 20 CONTINUE 00081 * 00082 READ( NIN, FMT = * )ILOIN, IHIIN 00083 DO 30 I = 1, N 00084 READ( NIN, FMT = * )( AIN( I, J ), J = 1, N ) 00085 30 CONTINUE 00086 READ( NIN, FMT = * )( SCALIN( I ), I = 1, N ) 00087 * 00088 ANORM = CLANGE( 'M', N, N, A, LDA, DUMMY ) 00089 KNT = KNT + 1 00090 CALL CGEBAL( 'B', N, A, LDA, ILO, IHI, SCALE, INFO ) 00091 * 00092 IF( INFO.NE.0 ) THEN 00093 NINFO = NINFO + 1 00094 LMAX( 1 ) = KNT 00095 END IF 00096 * 00097 IF( ILO.NE.ILOIN .OR. IHI.NE.IHIIN ) THEN 00098 NINFO = NINFO + 1 00099 LMAX( 2 ) = KNT 00100 END IF 00101 * 00102 DO 50 I = 1, N 00103 DO 40 J = 1, N 00104 TEMP = MAX( CABS1( A( I, J ) ), CABS1( AIN( I, J ) ) ) 00105 TEMP = MAX( TEMP, SFMIN ) 00106 VMAX = MAX( VMAX, CABS1( A( I, J )-AIN( I, J ) ) / TEMP ) 00107 40 CONTINUE 00108 50 CONTINUE 00109 * 00110 DO 60 I = 1, N 00111 TEMP = MAX( SCALE( I ), SCALIN( I ) ) 00112 TEMP = MAX( TEMP, SFMIN ) 00113 VMAX = MAX( VMAX, ABS( SCALE( I )-SCALIN( I ) ) / TEMP ) 00114 60 CONTINUE 00115 * 00116 IF( VMAX.GT.RMAX ) THEN 00117 LMAX( 3 ) = KNT 00118 RMAX = VMAX 00119 END IF 00120 * 00121 GO TO 10 00122 * 00123 70 CONTINUE 00124 * 00125 WRITE( NOUT, FMT = 9999 ) 00126 9999 FORMAT( 1X, '.. test output of CGEBAL .. ' ) 00127 * 00128 WRITE( NOUT, FMT = 9998 )RMAX 00129 9998 FORMAT( 1X, 'value of largest test error = ', E12.3 ) 00130 WRITE( NOUT, FMT = 9997 )LMAX( 1 ) 00131 9997 FORMAT( 1X, 'example number where info is not zero = ', I4 ) 00132 WRITE( NOUT, FMT = 9996 )LMAX( 2 ) 00133 9996 FORMAT( 1X, 'example number where ILO or IHI wrong = ', I4 ) 00134 WRITE( NOUT, FMT = 9995 )LMAX( 3 ) 00135 9995 FORMAT( 1X, 'example number having largest error = ', I4 ) 00136 WRITE( NOUT, FMT = 9994 )NINFO 00137 9994 FORMAT( 1X, 'number of examples where info is not 0 = ', I4 ) 00138 WRITE( NOUT, FMT = 9993 )KNT 00139 9993 FORMAT( 1X, 'total number of examples tested = ', I4 ) 00140 * 00141 RETURN 00142 * 00143 * End of CCHKBL 00144 * 00145 END