66 INTEGER LDA, LDB, LDVL, LDVR
67 parameter( lda = 50, ldb = 50, ldvl = 50, ldvr = 50 )
68 INTEGER LDE, LDF, LDWORK, LRWORK
69 parameter( lde = 50, ldf = 50, ldwork = 50,
72 parameter( zero = 0.0e+0 )
74 parameter( czero = ( 0.0e+0, 0.0e+0 ),
75 $ cone = ( 1.0e+0, 0.0e+0 ) )
78 INTEGER I, IHI, ILO, INFO, J, KNT, M, N, NINFO
79 REAL ANORM, BNORM, EPS, RMAX, VMAX
84 REAL LSCALE( LDA ), RSCALE( LDA ), RWORK( LRWORK )
85 COMPLEX A( LDA, LDA ), AF( LDA, LDA ), B( LDB, LDB ),
86 $ BF( LDB, LDB ), E( LDE, LDE ), F( LDF, LDF ),
87 $ VL( LDVL, LDVL ), VLF( LDVL, LDVL ),
88 $ VR( LDVR, LDVR ), VRF( LDVR, LDVR ),
89 $ WORK( LDWORK, LDWORK )
93 EXTERNAL clange, slamch
99 INTRINSIC abs, aimag, max, real
105 cabs1( cdum ) = abs( real( cdum ) ) + abs( aimag( cdum ) )
117 eps = slamch(
'Precision' )
120 READ( nin, fmt = * )n, m
125 READ( nin, fmt = * )( a( i, j ), j = 1, n )
129 READ( nin, fmt = * )( b( i, j ), j = 1, n )
133 READ( nin, fmt = * )( vl( i, j ), j = 1, m )
137 READ( nin, fmt = * )( vr( i, j ), j = 1, m )
142 anorm = clange(
'M', n, n, a, lda, rwork )
143 bnorm = clange(
'M', n, n, b, ldb, rwork )
145 CALL clacpy(
'FULL', n, n, a, lda, af, lda )
146 CALL clacpy(
'FULL', n, n, b, ldb, bf, ldb )
148 CALL cggbal(
'B', n, a, lda, b, ldb, ilo, ihi, lscale, rscale,
155 CALL clacpy(
'FULL', n, m, vl, ldvl, vlf, ldvl )
156 CALL clacpy(
'FULL', n, m, vr, ldvr, vrf, ldvr )
158 CALL cggbak(
'B',
'L', n, ilo, ihi, lscale, rscale, m, vl, ldvl,
165 CALL cggbak(
'B',
'R', n, ilo, ihi, lscale, rscale, m, vr, ldvr,
177 CALL cgemm(
'N',
'N', n, m, n, cone, af, lda, vr, ldvr, czero,
179 CALL cgemm(
'C',
'N', m, m, n, cone, vl, ldvl, work, ldwork,
182 CALL cgemm(
'N',
'N', n, m, n, cone, a, lda, vrf, ldvr, czero,
184 CALL cgemm(
'C',
'N', m, m, n, cone, vlf, ldvl, work, ldwork,
190 vmax = max( vmax, cabs1( e( i, j )-f( i, j ) ) )
193 vmax = vmax / ( eps*max( anorm, bnorm ) )
194 IF( vmax.GT.rmax )
THEN
201 CALL cgemm(
'N',
'N', n, m, n, cone, bf, ldb, vr, ldvr, czero,
203 CALL cgemm(
'C',
'N', m, m, n, cone, vl, ldvl, work, ldwork,
206 CALL cgemm(
'n',
'n', n, m, n, cone, b, ldb, vrf, ldvr, czero,
208 CALL cgemm(
'C',
'N', m, m, n, cone, vlf, ldvl, work, ldwork,
214 vmax = max( vmax, cabs1( e( i, j )-f( i, j ) ) )
217 vmax = vmax / ( eps*max( anorm, bnorm ) )
218 IF( vmax.GT.rmax )
THEN
227 WRITE( nout, fmt = 9999 )
228 9999
FORMAT( 1x,
'.. test output of CGGBAK .. ' )
230 WRITE( nout, fmt = 9998 )rmax
231 9998
FORMAT(
' value of largest test error =', e12.3 )
232 WRITE( nout, fmt = 9997 )lmax( 1 )
233 9997
FORMAT(
' example number where CGGBAL info is not 0 =', i4 )
234 WRITE( nout, fmt = 9996 )lmax( 2 )
235 9996
FORMAT(
' example number where CGGBAK(L) info is not 0 =', i4 )
236 WRITE( nout, fmt = 9995 )lmax( 3 )
237 9995
FORMAT(
' example number where CGGBAK(R) info is not 0 =', i4 )
238 WRITE( nout, fmt = 9994 )lmax( 4 )
239 9994
FORMAT(
' example number having largest error =', i4 )
240 WRITE( nout, fmt = 9992 )ninfo
241 9992
FORMAT(
' number of examples where info is not 0 =', i4 )
242 WRITE( nout, fmt = 9991 )knt
243 9991
FORMAT(
' total number of examples tested =', i4 )
subroutine cchkgk(nin, nout)
CCHKGK
subroutine cgemm(transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc)
CGEMM
subroutine cggbak(job, side, n, ilo, ihi, lscale, rscale, m, v, ldv, info)
CGGBAK
subroutine cggbal(job, n, a, lda, b, ldb, ilo, ihi, lscale, rscale, work, info)
CGGBAL
subroutine clacpy(uplo, m, n, a, lda, b, ldb)
CLACPY copies all or part of one two-dimensional array to another.