145 SUBROUTINE cbdt01( M, N, KD, A, LDA, Q, LDQ, D, E, PT, LDPT, WORK,
153 INTEGER KD, LDA, LDPT, LDQ, M, N
157 REAL D( * ), E( * ), RWORK( * )
158 COMPLEX A( LDA, * ), PT( LDPT, * ), Q( LDQ, * ),
166 parameter( zero = 0.0e+0, one = 1.0e+0 )
173 REAL CLANGE, SCASUM, SLAMCH
174 EXTERNAL clange, scasum, slamch
180 INTRINSIC cmplx, max, min, real
186 IF( m.LE.0 .OR. n.LE.0 )
THEN
198 IF( kd.NE.0 .AND. m.GE.n )
THEN
203 CALL ccopy( m, a( 1, j ), 1, work, 1 )
205 work( m+i ) = d( i )*pt( i, j ) + e( i )*pt( i+1, j )
207 work( m+n ) = d( n )*pt( n, j )
208 CALL cgemv(
'No transpose', m, n, -cmplx( one ), q, ldq,
209 $ work( m+1 ), 1, cmplx( one ), work, 1 )
210 resid = max( resid, scasum( m, work, 1 ) )
212 ELSE IF( kd.LT.0 )
THEN
217 CALL ccopy( m, a( 1, j ), 1, work, 1 )
219 work( m+i ) = d( i )*pt( i, j ) + e( i )*pt( i+1, j )
221 work( m+m ) = d( m )*pt( m, j )
222 CALL cgemv(
'No transpose', m, m, -cmplx( one ), q, ldq,
223 $ work( m+1 ), 1, cmplx( one ), work, 1 )
224 resid = max( resid, scasum( m, work, 1 ) )
231 CALL ccopy( m, a( 1, j ), 1, work, 1 )
232 work( m+1 ) = d( 1 )*pt( 1, j )
234 work( m+i ) = e( i-1 )*pt( i-1, j ) +
237 CALL cgemv(
'No transpose', m, m, -cmplx( one ), q, ldq,
238 $ work( m+1 ), 1, cmplx( one ), work, 1 )
239 resid = max( resid, scasum( m, work, 1 ) )
248 CALL ccopy( m, a( 1, j ), 1, work, 1 )
250 work( m+i ) = d( i )*pt( i, j )
252 CALL cgemv(
'No transpose', m, n, -cmplx( one ), q, ldq,
253 $ work( m+1 ), 1, cmplx( one ), work, 1 )
254 resid = max( resid, scasum( m, work, 1 ) )
258 CALL ccopy( m, a( 1, j ), 1, work, 1 )
260 work( m+i ) = d( i )*pt( i, j )
262 CALL cgemv(
'No transpose', m, m, -cmplx( one ), q, ldq,
263 $ work( m+1 ), 1, cmplx( one ), work, 1 )
264 resid = max( resid, scasum( m, work, 1 ) )
271 anorm = clange(
'1', m, n, a, lda, rwork )
272 eps = slamch(
'Precision' )
274 IF( anorm.LE.zero )
THEN
278 IF( anorm.GE.resid )
THEN
279 resid = ( resid / anorm ) / ( real( n )*eps )
281 IF( anorm.LT.one )
THEN
282 resid = ( min( resid, real( n )*anorm ) / anorm ) /
285 resid = min( resid / anorm, real( n ) ) /