LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
subroutine cchkgk ( integer  NIN,
integer  NOUT 
)

CCHKGK

Purpose:
 CCHKGK tests CGGBAK, a routine for backward balancing  of
 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.
Date
November 2011

Definition at line 56 of file cchkgk.f.

56 *
57 * -- LAPACK test routine (version 3.4.0) --
58 * -- LAPACK is a software package provided by Univ. of Tennessee, --
59 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
60 * November 2011
61 *
62 * .. Scalar Arguments ..
63  INTEGER nin, nout
64 * ..
65 *
66 * =====================================================================
67 *
68 * .. Parameters ..
69  INTEGER lda, ldb, ldvl, ldvr
70  parameter ( lda = 50, ldb = 50, ldvl = 50, ldvr = 50 )
71  INTEGER lde, ldf, ldwork, lrwork
72  parameter ( lde = 50, ldf = 50, ldwork = 50,
73  $ lrwork = 6*50 )
74  REAL zero
75  parameter ( zero = 0.0e+0 )
76  COMPLEX czero, cone
77  parameter ( czero = ( 0.0e+0, 0.0e+0 ),
78  $ cone = ( 1.0e+0, 0.0e+0 ) )
79 * ..
80 * .. Local Scalars ..
81  INTEGER i, ihi, ilo, info, j, knt, m, n, ninfo
82  REAL anorm, bnorm, eps, rmax, vmax
83  COMPLEX cdum
84 * ..
85 * .. Local Arrays ..
86  INTEGER lmax( 4 )
87  REAL lscale( lda ), rscale( lda ), rwork( lrwork )
88  COMPLEX a( lda, lda ), af( lda, lda ), b( ldb, ldb ),
89  $ bf( ldb, ldb ), e( lde, lde ), f( ldf, ldf ),
90  $ vl( ldvl, ldvl ), vlf( ldvl, ldvl ),
91  $ vr( ldvr, ldvr ), vrf( ldvr, ldvr ),
92  $ work( ldwork, ldwork )
93 * ..
94 * .. External Functions ..
95  REAL clange, slamch
96  EXTERNAL clange, slamch
97 * ..
98 * .. External Subroutines ..
99  EXTERNAL cgemm, cggbak, cggbal, clacpy
100 * ..
101 * .. Intrinsic Functions ..
102  INTRINSIC abs, aimag, max, real
103 * ..
104 * .. Statement Functions ..
105  REAL cabs1
106 * ..
107 * .. Statement Function definitions ..
108  cabs1( cdum ) = abs( REAL( CDUM ) ) + abs( aimag( cdum ) )
109 * ..
110 * .. Executable Statements ..
111 *
112  lmax( 1 ) = 0
113  lmax( 2 ) = 0
114  lmax( 3 ) = 0
115  lmax( 4 ) = 0
116  ninfo = 0
117  knt = 0
118  rmax = zero
119 *
120  eps = slamch( 'Precision' )
121 *
122  10 CONTINUE
123  READ( nin, fmt = * )n, m
124  IF( n.EQ.0 )
125  $ GO TO 100
126 *
127  DO 20 i = 1, n
128  READ( nin, fmt = * )( a( i, j ), j = 1, n )
129  20 CONTINUE
130 *
131  DO 30 i = 1, n
132  READ( nin, fmt = * )( b( i, j ), j = 1, n )
133  30 CONTINUE
134 *
135  DO 40 i = 1, n
136  READ( nin, fmt = * )( vl( i, j ), j = 1, m )
137  40 CONTINUE
138 *
139  DO 50 i = 1, n
140  READ( nin, fmt = * )( vr( i, j ), j = 1, m )
141  50 CONTINUE
142 *
143  knt = knt + 1
144 *
145  anorm = clange( 'M', n, n, a, lda, rwork )
146  bnorm = clange( 'M', n, n, b, ldb, rwork )
147 *
148  CALL clacpy( 'FULL', n, n, a, lda, af, lda )
149  CALL clacpy( 'FULL', n, n, b, ldb, bf, ldb )
150 *
151  CALL cggbal( 'B', n, a, lda, b, ldb, ilo, ihi, lscale, rscale,
152  $ rwork, info )
153  IF( info.NE.0 ) THEN
154  ninfo = ninfo + 1
155  lmax( 1 ) = knt
156  END IF
157 *
158  CALL clacpy( 'FULL', n, m, vl, ldvl, vlf, ldvl )
159  CALL clacpy( 'FULL', n, m, vr, ldvr, vrf, ldvr )
160 *
161  CALL cggbak( 'B', 'L', n, ilo, ihi, lscale, rscale, m, vl, ldvl,
162  $ info )
163  IF( info.NE.0 ) THEN
164  ninfo = ninfo + 1
165  lmax( 2 ) = knt
166  END IF
167 *
168  CALL cggbak( 'B', 'R', n, ilo, ihi, lscale, rscale, m, vr, ldvr,
169  $ info )
170  IF( info.NE.0 ) THEN
171  ninfo = ninfo + 1
172  lmax( 3 ) = knt
173  END IF
174 *
175 * Test of CGGBAK
176 *
177 * Check tilde(VL)'*A*tilde(VR) - VL'*tilde(A)*VR
178 * where tilde(A) denotes the transformed matrix.
179 *
180  CALL cgemm( 'N', 'N', n, m, n, cone, af, lda, vr, ldvr, czero,
181  $ work, ldwork )
182  CALL cgemm( 'C', 'N', m, m, n, cone, vl, ldvl, work, ldwork,
183  $ czero, e, lde )
184 *
185  CALL cgemm( 'N', 'N', n, m, n, cone, a, lda, vrf, ldvr, czero,
186  $ work, ldwork )
187  CALL cgemm( 'C', 'N', m, m, n, cone, vlf, ldvl, work, ldwork,
188  $ czero, f, ldf )
189 *
190  vmax = zero
191  DO 70 j = 1, m
192  DO 60 i = 1, m
193  vmax = max( vmax, cabs1( e( i, j )-f( i, j ) ) )
194  60 CONTINUE
195  70 CONTINUE
196  vmax = vmax / ( eps*max( anorm, bnorm ) )
197  IF( vmax.GT.rmax ) THEN
198  lmax( 4 ) = knt
199  rmax = vmax
200  END IF
201 *
202 * Check tilde(VL)'*B*tilde(VR) - VL'*tilde(B)*VR
203 *
204  CALL cgemm( 'N', 'N', n, m, n, cone, bf, ldb, vr, ldvr, czero,
205  $ work, ldwork )
206  CALL cgemm( 'C', 'N', m, m, n, cone, vl, ldvl, work, ldwork,
207  $ czero, e, lde )
208 *
209  CALL cgemm( 'n', 'n', n, m, n, cone, b, ldb, vrf, ldvr, czero,
210  $ work, ldwork )
211  CALL cgemm( 'C', 'N', m, m, n, cone, vlf, ldvl, work, ldwork,
212  $ czero, f, ldf )
213 *
214  vmax = zero
215  DO 90 j = 1, m
216  DO 80 i = 1, m
217  vmax = max( vmax, cabs1( e( i, j )-f( i, j ) ) )
218  80 CONTINUE
219  90 CONTINUE
220  vmax = vmax / ( eps*max( anorm, bnorm ) )
221  IF( vmax.GT.rmax ) THEN
222  lmax( 4 ) = knt
223  rmax = vmax
224  END IF
225 *
226  GO TO 10
227 *
228  100 CONTINUE
229 *
230  WRITE( nout, fmt = 9999 )
231  9999 FORMAT( 1x, '.. test output of CGGBAK .. ' )
232 *
233  WRITE( nout, fmt = 9998 )rmax
234  9998 FORMAT( ' value of largest test error =', e12.3 )
235  WRITE( nout, fmt = 9997 )lmax( 1 )
236  9997 FORMAT( ' example number where CGGBAL info is not 0 =', i4 )
237  WRITE( nout, fmt = 9996 )lmax( 2 )
238  9996 FORMAT( ' example number where CGGBAK(L) info is not 0 =', i4 )
239  WRITE( nout, fmt = 9995 )lmax( 3 )
240  9995 FORMAT( ' example number where CGGBAK(R) info is not 0 =', i4 )
241  WRITE( nout, fmt = 9994 )lmax( 4 )
242  9994 FORMAT( ' example number having largest error =', i4 )
243  WRITE( nout, fmt = 9992 )ninfo
244  9992 FORMAT( ' number of examples where info is not 0 =', i4 )
245  WRITE( nout, fmt = 9991 )knt
246  9991 FORMAT( ' total number of examples tested =', i4 )
247 *
248  RETURN
249 *
250 * End of CCHKGK
251 *
subroutine cggbal(JOB, N, A, LDA, B, LDB, ILO, IHI, LSCALE, RSCALE, WORK, INFO)
CGGBAL
Definition: cggbal.f:179
logical function lde(RI, RJ, LR)
Definition: dblat2.f:2945
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:117
subroutine cggbak(JOB, SIDE, N, ILO, IHI, LSCALE, RSCALE, M, V, LDV, INFO)
CGGBAK
Definition: cggbak.f:150
subroutine clacpy(UPLO, M, N, A, LDA, B, LDB)
CLACPY copies all or part of one two-dimensional array to another.
Definition: clacpy.f:105
real function slamch(CMACH)
SLAMCH
Definition: slamch.f:69
subroutine cgemm(TRANSA, TRANSB, M, N, K, ALPHA, A, LDA, B, LDB, BETA, C, LDC)
CGEMM
Definition: cgemm.f:189

Here is the call graph for this function:

Here is the caller graph for this function: