143 SUBROUTINE dgbtrf( M, N, KL, KU, AB, LDAB, IPIV, INFO )
150 INTEGER INFO, KL, KU, LDAB, M, N
154 DOUBLE PRECISION AB( LDAB, * )
160 DOUBLE PRECISION ONE, ZERO
161 parameter( one = 1.0d+0, zero = 0.0d+0 )
162 INTEGER NBMAX, LDWORK
163 parameter( nbmax = 64, ldwork = nbmax+1 )
166 INTEGER I, I2, I3, II, IP, J, J2, J3, JB, JJ, JM, JP,
167 $ JU, K2, KM, KV, NB, NW
168 DOUBLE PRECISION TEMP
171 DOUBLE PRECISION WORK13( LDWORK, NBMAX ),
172 $ WORK31( LDWORK, NBMAX )
175 INTEGER IDAMAX, ILAENV
176 EXTERNAL idamax, ilaenv
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(
'DGBTRF', -info )
213 IF( m.EQ.0 .OR. n.EQ.0 )
218 nb = ilaenv( 1,
'DGBTRF',
' ', m, n, kl, ku )
223 nb = min( nb, nbmax )
225 IF( nb.LE.1 .OR. nb.GT.kl )
THEN
229 CALL dgbtf2( 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 = idamax( 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 dswap( jb, ab( kv+1+jj-j, j ), ldab-1,
312 $ ab( kv+jp+jj-j, j ), ldab-1 )
318 CALL dswap( jj-j, ab( kv+1+jj-j, j ), ldab-1,
319 $ work31( jp+jj-j-kl, 1 ), ldwork )
320 CALL dswap( j+jb-jj, ab( kv+1, jj ), ldab-1,
321 $ ab( kv+jp, jj ), ldab-1 )
327 CALL dscal( km, one / ab( kv+1, jj ), ab( kv+2, jj ),
334 jm = min( ju, j+jb-1 )
336 $
CALL dger( 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 dcopy( 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 dlaswp( 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 dtrsm(
'Left',
'Lower',
'No transpose',
'Unit',
397 $ jb, j2, one, ab( kv+1, j ), ldab-1,
398 $ ab( kv+1-jb, j+jb ), ldab-1 )
404 CALL dgemm(
'No transpose',
'No transpose', i2, j2,
405 $ jb, -one, ab( kv+1+jb, j ), ldab-1,
406 $ ab( kv+1-jb, j+jb ), ldab-1, one,
407 $ ab( kv+1, j+jb ), ldab-1 )
414 CALL dgemm(
'No transpose',
'No transpose', i3, j2,
415 $ jb, -one, work31, ldwork,
416 $ ab( kv+1-jb, j+jb ), ldab-1, one,
417 $ ab( kv+kl+1-jb, j+jb ), ldab-1 )
428 work13( ii, jj ) = ab( ii-jj+1, jj+j+kv-1 )
434 CALL dtrsm(
'Left',
'Lower',
'No transpose',
'Unit',
435 $ jb, j3, one, ab( kv+1, j ), ldab-1,
442 CALL dgemm(
'No transpose',
'No transpose', i2, j3,
443 $ jb, -one, ab( kv+1+jb, j ), ldab-1,
444 $ work13, ldwork, one, ab( 1+jb, j+kv ),
452 CALL dgemm(
'No transpose',
'No transpose', i3, j3,
453 $ jb, -one, work31, ldwork, work13,
454 $ ldwork, one, ab( 1+kl, j+kv ), ldab-1 )
461 ab( ii-jj+1, jj+j+kv-1 ) = work13( ii, jj )
469 DO 160 i = j, j + jb - 1
470 ipiv( i ) = ipiv( i ) + j - 1
478 DO 170 jj = j + jb - 1, j, -1
479 jp = ipiv( jj ) - jj + 1
484 IF( jp+jj-1.LT.j+kl )
THEN
488 CALL dswap( jj-j, ab( kv+1+jj-j, j ), ldab-1,
489 $ ab( kv+jp+jj-j, j ), ldab-1 )
494 CALL dswap( jj-j, ab( kv+1+jj-j, j ), ldab-1,
495 $ work31( jp+jj-j-kl, 1 ), ldwork )
501 nw = min( i3, jj-j+1 )
503 $
CALL dcopy( nw, work31( 1, jj-j+1 ), 1,
504 $ ab( kv+kl+1-jj+j, jj ), 1 )
subroutine xerbla(srname, info)
subroutine dcopy(n, dx, incx, dy, incy)
DCOPY
subroutine dgbtf2(m, n, kl, ku, ab, ldab, ipiv, info)
DGBTF2 computes the LU factorization of a general band matrix using the unblocked version of the algo...
subroutine dgbtrf(m, n, kl, ku, ab, ldab, ipiv, info)
DGBTRF
subroutine dgemm(transa, transb, m, n, k, alpha, a, lda, b, ldb, beta, c, ldc)
DGEMM
subroutine dger(m, n, alpha, x, incx, y, incy, a, lda)
DGER
subroutine dlaswp(n, a, lda, k1, k2, ipiv, incx)
DLASWP performs a series of row interchanges on a general rectangular matrix.
subroutine dscal(n, da, dx, incx)
DSCAL
subroutine dswap(n, dx, incx, dy, incy)
DSWAP
subroutine dtrsm(side, uplo, transa, diag, m, n, alpha, a, lda, b, ldb)
DTRSM