141 SUBROUTINE zgbtrf( M, N, KL, KU, AB, LDAB, IPIV, INFO )
148 INTEGER INFO, KL, KU, LDAB, M, N
152 COMPLEX*16 AB( LDAB, * )
159 parameter( one = ( 1.0d+0, 0.0d+0 ),
160 $ zero = ( 0.0d+0, 0.0d+0 ) )
161 INTEGER NBMAX, LDWORK
162 parameter( nbmax = 64, ldwork = nbmax+1 )
165 INTEGER I, I2, I3, II, IP, J, J2, J3, JB, JJ, JM, JP,
166 $ JU, K2, KM, KV, NB, NW
170 COMPLEX*16 WORK13( LDWORK, NBMAX ),
171 $ WORK31( LDWORK, NBMAX )
174 INTEGER ILAENV, IZAMAX
175 EXTERNAL ilaenv, izamax
197 ELSE IF( n.LT.0 )
THEN
199 ELSE IF( kl.LT.0 )
THEN
201 ELSE IF( ku.LT.0 )
THEN
203 ELSE IF( ldab.LT.kl+kv+1 )
THEN
207 CALL xerbla(
'ZGBTRF', -info )
213 IF( m.EQ.0 .OR. n.EQ.0 )
218 nb = ilaenv( 1,
'ZGBTRF',
' ', m, n, kl, ku )
223 nb = min( nb, nbmax )
225 IF( nb.LE.1 .OR. nb.GT.kl )
THEN
229 CALL zgbtf2( m, n, kl, ku, ab, ldab, ipiv, info )
238 work13( i, j ) = zero
246 work31( i, j ) = zero
254 DO 60 j = ku + 2, min( kv, n )
255 DO 50 i = kv - j + 2, kl
265 DO 180 j = 1, min( m, n ), nb
266 jb = min( nb, min( m, n )-j+1 )
280 i2 = min( kl-jb, m-j-jb+1 )
281 i3 = min( jb, m-j-kl+1 )
287 DO 80 jj = j, j + jb - 1
291 IF( jj+kv.LE.n )
THEN
293 ab( i, jj+kv ) = zero
301 jp = izamax( km+1, ab( kv+1, jj ), 1 )
302 ipiv( jj ) = jp + jj - j
303 IF( ab( kv+jp, jj ).NE.zero )
THEN
304 ju = max( ju, min( jj+ku+jp-1, n ) )
309 IF( jp+jj-1.LT.j+kl )
THEN
311 CALL zswap( jb, ab( kv+1+jj-j, j ), ldab-1,
312 $ ab( kv+jp+jj-j, j ), ldab-1 )
318 CALL zswap( jj-j, ab( kv+1+jj-j, j ), ldab-1,
319 $ work31( jp+jj-j-kl, 1 ), ldwork )
320 CALL zswap( j+jb-jj, ab( kv+1, jj ), ldab-1,
321 $ ab( kv+jp, jj ), ldab-1 )
327 CALL zscal( km, one / ab( kv+1, jj ), ab( kv+2,
335 jm = min( ju, j+jb-1 )
337 $
CALL zgeru( km, jm-jj, -one, ab( kv+2, jj ), 1,
338 $ ab( kv, jj+1 ), ldab-1,
339 $ ab( kv+1, jj+1 ), ldab-1 )
351 nw = min( jj-j+1, i3 )
353 $
CALL zcopy( nw, ab( kv+kl+1-jj+j, jj ), 1,
354 $ work31( 1, jj-j+1 ), 1 )
360 j2 = min( ju-j+1, kv ) - jb
361 j3 = max( 0, ju-j-kv+1 )
366 CALL zlaswp( j2, ab( kv+1-jb, j+jb ), ldab-1, 1, jb,
371 DO 90 i = j, j + jb - 1
372 ipiv( i ) = ipiv( i ) + j - 1
381 DO 100 ii = j + i - 1, j + jb - 1
384 temp = ab( kv+1+ii-jj, jj )
385 ab( kv+1+ii-jj, jj ) = ab( kv+1+ip-jj, jj )
386 ab( kv+1+ip-jj, jj ) = temp
397 CALL ztrsm(
'Left',
'Lower',
'No transpose',
399 $ jb, j2, one, ab( kv+1, j ), ldab-1,
400 $ ab( kv+1-jb, j+jb ), ldab-1 )
406 CALL zgemm(
'No transpose',
'No transpose', i2,
408 $ jb, -one, ab( kv+1+jb, j ), ldab-1,
409 $ ab( kv+1-jb, j+jb ), ldab-1, one,
410 $ ab( kv+1, j+jb ), ldab-1 )
417 CALL zgemm(
'No transpose',
'No transpose', i3,
419 $ jb, -one, work31, ldwork,
420 $ ab( kv+1-jb, j+jb ), ldab-1, one,
421 $ ab( kv+kl+1-jb, j+jb ), ldab-1 )
432 work13( ii, jj ) = ab( ii-jj+1, jj+j+kv-1 )
438 CALL ztrsm(
'Left',
'Lower',
'No transpose',
440 $ jb, j3, one, ab( kv+1, j ), ldab-1,
447 CALL zgemm(
'No transpose',
'No transpose', i2,
449 $ jb, -one, ab( kv+1+jb, j ), ldab-1,
450 $ work13, ldwork, one, ab( 1+jb, j+kv ),
458 CALL zgemm(
'No transpose',
'No transpose', i3,
460 $ jb, -one, work31, ldwork, work13,
461 $ ldwork, one, ab( 1+kl, j+kv ), ldab-1 )
468 ab( ii-jj+1, jj+j+kv-1 ) = work13( ii, jj )
476 DO 160 i = j, j + jb - 1
477 ipiv( i ) = ipiv( i ) + j - 1
485 DO 170 jj = j + jb - 1, j, -1
486 jp = ipiv( jj ) - jj + 1
491 IF( jp+jj-1.LT.j+kl )
THEN
495 CALL zswap( jj-j, ab( kv+1+jj-j, j ), ldab-1,
496 $ ab( kv+jp+jj-j, j ), ldab-1 )
501 CALL zswap( jj-j, ab( kv+1+jj-j, j ), ldab-1,
502 $ work31( jp+jj-j-kl, 1 ), ldwork )
508 nw = min( i3, jj-j+1 )
510 $
CALL zcopy( nw, work31( 1, jj-j+1 ), 1,
511 $ ab( kv+kl+1-jj+j, jj ), 1 )