LAPACK 3.11.0
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ cchkgl()

subroutine cchkgl ( integer  NIN,
integer  NOUT 
)

CCHKGL

Purpose:
 CCHKGL tests CGGBAL, a routine for balancing a matrix pair (A, B).
Parameters
[in]NIN
          NIN is INTEGER
          The logical unit number for input.  NIN > 0.
[in]NOUT
          NOUT is INTEGER
          The logical unit number for output.  NOUT > 0.
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.

Definition at line 52 of file cchkgl.f.

53*
54* -- LAPACK test routine --
55* -- LAPACK is a software package provided by Univ. of Tennessee, --
56* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
57*
58* .. Scalar Arguments ..
59 INTEGER NIN, NOUT
60* ..
61*
62* =====================================================================
63*
64* .. Parameters ..
65 INTEGER LDA, LDB, LWORK
66 parameter( lda = 20, ldb = 20, lwork = 6*lda )
67 REAL ZERO
68 parameter( zero = 0.0e+0 )
69* ..
70* .. Local Scalars ..
71 INTEGER I, IHI, IHIIN, ILO, ILOIN, INFO, J, KNT, N,
72 $ NINFO
73 REAL ANORM, BNORM, EPS, RMAX, VMAX
74* ..
75* .. Local Arrays ..
76 INTEGER LMAX( 3 )
77 REAL LSCALE( LDA ), LSCLIN( LDA ), RSCALE( LDA ),
78 $ RSCLIN( LDA ), WORK( LWORK )
79 COMPLEX A( LDA, LDA ), AIN( LDA, LDA ), B( LDB, LDB ),
80 $ BIN( LDB, LDB )
81* ..
82* .. External Functions ..
83 REAL CLANGE, SLAMCH
84 EXTERNAL clange, slamch
85* ..
86* .. External Subroutines ..
87 EXTERNAL cggbal
88* ..
89* .. Intrinsic Functions ..
90 INTRINSIC abs, max
91* ..
92* .. Executable Statements ..
93*
94 lmax( 1 ) = 0
95 lmax( 2 ) = 0
96 lmax( 3 ) = 0
97 ninfo = 0
98 knt = 0
99 rmax = zero
100*
101 eps = slamch( 'Precision' )
102*
103 10 CONTINUE
104*
105 READ( nin, fmt = * )n
106 IF( n.EQ.0 )
107 $ GO TO 90
108 DO 20 i = 1, n
109 READ( nin, fmt = * )( a( i, j ), j = 1, n )
110 20 CONTINUE
111*
112 DO 30 i = 1, n
113 READ( nin, fmt = * )( b( i, j ), j = 1, n )
114 30 CONTINUE
115*
116 READ( nin, fmt = * )iloin, ihiin
117 DO 40 i = 1, n
118 READ( nin, fmt = * )( ain( i, j ), j = 1, n )
119 40 CONTINUE
120 DO 50 i = 1, n
121 READ( nin, fmt = * )( bin( i, j ), j = 1, n )
122 50 CONTINUE
123*
124 READ( nin, fmt = * )( lsclin( i ), i = 1, n )
125 READ( nin, fmt = * )( rsclin( i ), i = 1, n )
126*
127 anorm = clange( 'M', n, n, a, lda, work )
128 bnorm = clange( 'M', n, n, b, ldb, work )
129*
130 knt = knt + 1
131*
132 CALL cggbal( 'B', n, a, lda, b, ldb, ilo, ihi, lscale, rscale,
133 $ work, info )
134*
135 IF( info.NE.0 ) THEN
136 ninfo = ninfo + 1
137 lmax( 1 ) = knt
138 END IF
139*
140 IF( ilo.NE.iloin .OR. ihi.NE.ihiin ) THEN
141 ninfo = ninfo + 1
142 lmax( 2 ) = knt
143 END IF
144*
145 vmax = zero
146 DO 70 i = 1, n
147 DO 60 j = 1, n
148 vmax = max( vmax, abs( a( i, j )-ain( i, j ) ) )
149 vmax = max( vmax, abs( b( i, j )-bin( i, j ) ) )
150 60 CONTINUE
151 70 CONTINUE
152*
153 DO 80 i = 1, n
154 vmax = max( vmax, abs( lscale( i )-lsclin( i ) ) )
155 vmax = max( vmax, abs( rscale( i )-rsclin( i ) ) )
156 80 CONTINUE
157*
158 vmax = vmax / ( eps*max( anorm, bnorm ) )
159*
160 IF( vmax.GT.rmax ) THEN
161 lmax( 3 ) = knt
162 rmax = vmax
163 END IF
164*
165 GO TO 10
166*
167 90 CONTINUE
168*
169 WRITE( nout, fmt = 9999 )
170 9999 FORMAT( ' .. test output of CGGBAL .. ' )
171*
172 WRITE( nout, fmt = 9998 )rmax
173 9998 FORMAT( ' ratio of largest test error = ', e12.3 )
174 WRITE( nout, fmt = 9997 )lmax( 1 )
175 9997 FORMAT( ' example number where info is not zero = ', i4 )
176 WRITE( nout, fmt = 9996 )lmax( 2 )
177 9996 FORMAT( ' example number where ILO or IHI is wrong = ', i4 )
178 WRITE( nout, fmt = 9995 )lmax( 3 )
179 9995 FORMAT( ' example number having largest error = ', i4 )
180 WRITE( nout, fmt = 9994 )ninfo
181 9994 FORMAT( ' number of examples where info is not 0 = ', i4 )
182 WRITE( nout, fmt = 9993 )knt
183 9993 FORMAT( ' total number of examples tested = ', i4 )
184*
185 RETURN
186*
187* End of CCHKGL
188*
subroutine cggbal(JOB, N, A, LDA, B, LDB, ILO, IHI, LSCALE, RSCALE, WORK, INFO)
CGGBAL
Definition: cggbal.f:177
real function clange(NORM, M, N, A, LDA, WORK)
CLANGE returns the value of the 1-norm, Frobenius norm, infinity-norm, or the largest absolute value ...
Definition: clange.f:115
real function slamch(CMACH)
SLAMCH
Definition: slamch.f:68
Here is the call graph for this function:
Here is the caller graph for this function: