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

ZCHKGK

Purpose:
``` ZCHKGK tests ZGGBAK, 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.```
Date
November 2011

Definition at line 56 of file zchkgk.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  DOUBLE PRECISION zero
75  parameter ( zero = 0.0d+0 )
76  COMPLEX*16 czero, cone
77  parameter ( czero = ( 0.0d+0, 0.0d+0 ),
78  \$ cone = ( 1.0d+0, 0.0d+0 ) )
79 * ..
80 * .. Local Scalars ..
81  INTEGER i, ihi, ilo, info, j, knt, m, n, ninfo
82  DOUBLE PRECISION anorm, bnorm, eps, rmax, vmax
83  COMPLEX*16 cdum
84 * ..
85 * .. Local Arrays ..
86  INTEGER lmax( 4 )
87  DOUBLE PRECISION lscale( lda ), rscale( lda ), rwork( lrwork )
88  COMPLEX*16 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  DOUBLE PRECISION dlamch, zlange
96  EXTERNAL dlamch, zlange
97 * ..
98 * .. External Subroutines ..
99  EXTERNAL zgemm, zggbak, zggbal, zlacpy
100 * ..
101 * .. Intrinsic Functions ..
102  INTRINSIC abs, dble, dimag, max
103 * ..
104 * .. Statement Functions ..
105  DOUBLE PRECISION cabs1
106 * ..
107 * .. Statement Function definitions ..
108  cabs1( cdum ) = abs( dble( cdum ) ) + abs( dimag( 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 = dlamch( '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 = zlange( 'M', n, n, a, lda, rwork )
146  bnorm = zlange( 'M', n, n, b, ldb, rwork )
147 *
148  CALL zlacpy( 'FULL', n, n, a, lda, af, lda )
149  CALL zlacpy( 'FULL', n, n, b, ldb, bf, ldb )
150 *
151  CALL zggbal( '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 zlacpy( 'FULL', n, m, vl, ldvl, vlf, ldvl )
159  CALL zlacpy( 'FULL', n, m, vr, ldvr, vrf, ldvr )
160 *
161  CALL zggbak( '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 zggbak( '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 ZGGBAK
176 *
177 * Check tilde(VL)'*A*tilde(VR) - VL'*tilde(A)*VR
178 * where tilde(A) denotes the transformed matrix.
179 *
180  CALL zgemm( 'N', 'N', n, m, n, cone, af, lda, vr, ldvr, czero,
181  \$ work, ldwork )
182  CALL zgemm( 'C', 'N', m, m, n, cone, vl, ldvl, work, ldwork,
183  \$ czero, e, lde )
184 *
185  CALL zgemm( 'N', 'N', n, m, n, cone, a, lda, vrf, ldvr, czero,
186  \$ work, ldwork )
187  CALL zgemm( '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 zgemm( 'N', 'N', n, m, n, cone, bf, ldb, vr, ldvr, czero,
205  \$ work, ldwork )
206  CALL zgemm( 'C', 'N', m, m, n, cone, vl, ldvl, work, ldwork,
207  \$ czero, e, lde )
208 *
209  CALL zgemm( 'n', 'n', n, m, n, cone, b, ldb, vrf, ldvr, czero,
210  \$ work, ldwork )
211  CALL zgemm( '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 ZGGBAK .. ' )
232 *
233  WRITE( nout, fmt = 9998 )rmax
234  9998 FORMAT( ' value of largest test error =', d12.3 )
235  WRITE( nout, fmt = 9997 )lmax( 1 )
236  9997 FORMAT( ' example number where ZGGBAL info is not 0 =', i4 )
237  WRITE( nout, fmt = 9996 )lmax( 2 )
238  9996 FORMAT( ' example number where ZGGBAK(L) info is not 0 =', i4 )
239  WRITE( nout, fmt = 9995 )lmax( 3 )
240  9995 FORMAT( ' example number where ZGGBAK(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 ZCHKGK
251 *
subroutine zlacpy(UPLO, M, N, A, LDA, B, LDB)
ZLACPY copies all or part of one two-dimensional array to another.
Definition: zlacpy.f:105
double precision function dlamch(CMACH)
DLAMCH
Definition: dlamch.f:65
logical function lde(RI, RJ, LR)
Definition: dblat2.f:2945
subroutine zgemm(TRANSA, TRANSB, M, N, K, ALPHA, A, LDA, B, LDB, BETA, C, LDC)
ZGEMM
Definition: zgemm.f:189
subroutine zggbak(JOB, SIDE, N, ILO, IHI, LSCALE, RSCALE, M, V, LDV, INFO)
ZGGBAK
Definition: zggbak.f:150
subroutine zggbal(JOB, N, A, LDA, B, LDB, ILO, IHI, LSCALE, RSCALE, WORK, INFO)
ZGGBAL
Definition: zggbal.f:179
double precision function zlange(NORM, M, N, A, LDA, WORK)
ZLANGE returns the value of the 1-norm, Frobenius norm, infinity-norm, or the largest absolute value ...
Definition: zlange.f:117

Here is the call graph for this function:

Here is the caller graph for this function: