141 SUBROUTINE sgbtrf( M, N, KL, KU, AB, LDAB, IPIV, INFO )
148 INTEGER INFO, KL, KU, LDAB, M, N
159 parameter( one = 1.0e+0, zero = 0.0e+0 )
160 INTEGER NBMAX, LDWORK
161 parameter( nbmax = 64, ldwork = nbmax+1 )
164 INTEGER I, I2, I3, II, IP, J, J2, J3, JB, JJ, JM, JP,
165 $ JU, K2, KM, KV, NB, NW
169 REAL WORK13( LDWORK, NBMAX ),
170 $ WORK31( LDWORK, NBMAX )
173 INTEGER ILAENV, ISAMAX
174 EXTERNAL ilaenv, isamax
196 ELSE IF( n.LT.0 )
THEN
198 ELSE IF( kl.LT.0 )
THEN
200 ELSE IF( ku.LT.0 )
THEN
202 ELSE IF( ldab.LT.kl+kv+1 )
THEN
206 CALL xerbla(
'SGBTRF', -info )
212 IF( m.EQ.0 .OR. n.EQ.0 )
217 nb = ilaenv( 1,
'SGBTRF',
' ', m, n, kl, ku )
222 nb = min( nb, nbmax )
224 IF( nb.LE.1 .OR. nb.GT.kl )
THEN
228 CALL sgbtf2( m, n, kl, ku, ab, ldab, ipiv, info )
237 work13( i, j ) = zero
245 work31( i, j ) = zero
253 DO 60 j = ku + 2, min( kv, n )
254 DO 50 i = kv - j + 2, kl
264 DO 180 j = 1, min( m, n ), nb
265 jb = min( nb, min( m, n )-j+1 )
279 i2 = min( kl-jb, m-j-jb+1 )
280 i3 = min( jb, m-j-kl+1 )
286 DO 80 jj = j, j + jb - 1
290 IF( jj+kv.LE.n )
THEN
292 ab( i, jj+kv ) = zero
300 jp = isamax( km+1, ab( kv+1, jj ), 1 )
301 ipiv( jj ) = jp + jj - j
302 IF( ab( kv+jp, jj ).NE.zero )
THEN
303 ju = max( ju, min( jj+ku+jp-1, n ) )
308 IF( jp+jj-1.LT.j+kl )
THEN
310 CALL sswap( jb, ab( kv+1+jj-j, j ), ldab-1,
311 $ ab( kv+jp+jj-j, j ), ldab-1 )
317 CALL sswap( jj-j, ab( kv+1+jj-j, j ), ldab-1,
318 $ work31( jp+jj-j-kl, 1 ), ldwork )
319 CALL sswap( j+jb-jj, ab( kv+1, jj ), ldab-1,
320 $ ab( kv+jp, jj ), ldab-1 )
326 CALL sscal( km, one / ab( kv+1, jj ), ab( kv+2,
334 jm = min( ju, j+jb-1 )
336 $
CALL sger( km, jm-jj, -one, ab( kv+2, jj ), 1,
337 $ ab( kv, jj+1 ), ldab-1,
338 $ ab( kv+1, jj+1 ), ldab-1 )
350 nw = min( jj-j+1, i3 )
352 $
CALL scopy( nw, ab( kv+kl+1-jj+j, jj ), 1,
353 $ work31( 1, jj-j+1 ), 1 )
359 j2 = min( ju-j+1, kv ) - jb
360 j3 = max( 0, ju-j-kv+1 )
365 CALL slaswp( j2, ab( kv+1-jb, j+jb ), ldab-1, 1, jb,
370 DO 90 i = j, j + jb - 1
371 ipiv( i ) = ipiv( i ) + j - 1
380 DO 100 ii = j + i - 1, j + jb - 1
383 temp = ab( kv+1+ii-jj, jj )
384 ab( kv+1+ii-jj, jj ) = ab( kv+1+ip-jj, jj )
385 ab( kv+1+ip-jj, jj ) = temp
396 CALL strsm(
'Left',
'Lower',
'No transpose',
398 $ jb, j2, one, ab( kv+1, j ), ldab-1,
399 $ ab( kv+1-jb, j+jb ), ldab-1 )
405 CALL sgemm(
'No transpose',
'No transpose', i2,
407 $ jb, -one, ab( kv+1+jb, j ), ldab-1,
408 $ ab( kv+1-jb, j+jb ), ldab-1, one,
409 $ ab( kv+1, j+jb ), ldab-1 )
416 CALL sgemm(
'No transpose',
'No transpose', i3,
418 $ jb, -one, work31, ldwork,
419 $ ab( kv+1-jb, j+jb ), ldab-1, one,
420 $ ab( kv+kl+1-jb, j+jb ), ldab-1 )
431 work13( ii, jj ) = ab( ii-jj+1, jj+j+kv-1 )
437 CALL strsm(
'Left',
'Lower',
'No transpose',
439 $ jb, j3, one, ab( kv+1, j ), ldab-1,
446 CALL sgemm(
'No transpose',
'No transpose', i2,
448 $ jb, -one, ab( kv+1+jb, j ), ldab-1,
449 $ work13, ldwork, one, ab( 1+jb, j+kv ),
457 CALL sgemm(
'No transpose',
'No transpose', i3,
459 $ jb, -one, work31, ldwork, work13,
460 $ ldwork, one, ab( 1+kl, j+kv ), ldab-1 )
467 ab( ii-jj+1, jj+j+kv-1 ) = work13( ii, jj )
475 DO 160 i = j, j + jb - 1
476 ipiv( i ) = ipiv( i ) + j - 1
484 DO 170 jj = j + jb - 1, j, -1
485 jp = ipiv( jj ) - jj + 1
490 IF( jp+jj-1.LT.j+kl )
THEN
494 CALL sswap( jj-j, ab( kv+1+jj-j, j ), ldab-1,
495 $ ab( kv+jp+jj-j, j ), ldab-1 )
500 CALL sswap( jj-j, ab( kv+1+jj-j, j ), ldab-1,
501 $ work31( jp+jj-j-kl, 1 ), ldwork )
507 nw = min( i3, jj-j+1 )
509 $
CALL scopy( nw, work31( 1, jj-j+1 ), 1,
510 $ ab( kv+kl+1-jj+j, jj ), 1 )