139 SUBROUTINE sbdt01( M, N, KD, A, LDA, Q, LDQ, D, E, PT, LDPT, WORK,
147 INTEGER KD, LDA, LDPT, LDQ, M, N
151 REAL A( LDA, * ), D( * ), E( * ), PT( LDPT, * ),
152 $ q( ldq, * ), work( * )
159 parameter( zero = 0.0e+0, one = 1.0e+0 )
166 REAL SASUM, SLAMCH, SLANGE
167 EXTERNAL sasum, slamch, slange
173 INTRINSIC max, min, real
179 IF( m.LE.0 .OR. n.LE.0 )
THEN
191 IF( kd.NE.0 .AND. m.GE.n )
THEN
196 CALL scopy( m, a( 1, j ), 1, work, 1 )
198 work( m+i ) = d( i )*pt( i, j ) + e( i )*pt( i+1, j )
200 work( m+n ) = d( n )*pt( n, j )
201 CALL sgemv(
'No transpose', m, n, -one, q, ldq,
202 $ work( m+1 ), 1, one, work, 1 )
203 resid = max( resid, sasum( m, work, 1 ) )
205 ELSE IF( kd.LT.0 )
THEN
210 CALL scopy( m, a( 1, j ), 1, work, 1 )
212 work( m+i ) = d( i )*pt( i, j ) + e( i )*pt( i+1, j )
214 work( m+m ) = d( m )*pt( m, j )
215 CALL sgemv(
'No transpose', m, m, -one, q, ldq,
216 $ work( m+1 ), 1, one, work, 1 )
217 resid = max( resid, sasum( m, work, 1 ) )
224 CALL scopy( m, a( 1, j ), 1, work, 1 )
225 work( m+1 ) = d( 1 )*pt( 1, j )
227 work( m+i ) = e( i-1 )*pt( i-1, j ) +
230 CALL sgemv(
'No transpose', m, m, -one, q, ldq,
231 $ work( m+1 ), 1, one, work, 1 )
232 resid = max( resid, sasum( m, work, 1 ) )
241 CALL scopy( m, a( 1, j ), 1, work, 1 )
243 work( m+i ) = d( i )*pt( i, j )
245 CALL sgemv(
'No transpose', m, n, -one, q, ldq,
246 $ work( m+1 ), 1, one, work, 1 )
247 resid = max( resid, sasum( m, work, 1 ) )
251 CALL scopy( m, a( 1, j ), 1, work, 1 )
253 work( m+i ) = d( i )*pt( i, j )
255 CALL sgemv(
'No transpose', m, m, -one, q, ldq,
256 $ work( m+1 ), 1, one, work, 1 )
257 resid = max( resid, sasum( m, work, 1 ) )
264 anorm = slange(
'1', m, n, a, lda, work )
265 eps = slamch(
'Precision' )
267 IF( anorm.LE.zero )
THEN
271 IF( anorm.GE.resid )
THEN
272 resid = ( resid / anorm ) / ( real( n )*eps )
274 IF( anorm.LT.one )
THEN
275 resid = ( min( resid, real( n )*anorm ) / anorm ) /
278 resid = min( resid / anorm, real( n ) ) /