LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ dgbtf2()

subroutine dgbtf2 ( integer m,
integer n,
integer kl,
integer ku,
double precision, dimension( ldab, * ) ab,
integer ldab,
integer, dimension( * ) ipiv,
integer info )

DGBTF2 computes the LU factorization of a general band matrix using the unblocked version of the algorithm.

Download DGBTF2 + dependencies [TGZ] [ZIP] [TXT]

Purpose:
!>
!> DGBTF2 computes an LU factorization of a real m-by-n band matrix A
!> using partial pivoting with row interchanges.
!>
!> This is the unblocked version of the algorithm, calling Level 2 BLAS.
!> 
Parameters
[in]M
!>          M is INTEGER
!>          The number of rows of the matrix A.  M >= 0.
!> 
[in]N
!>          N is INTEGER
!>          The number of columns of the matrix A.  N >= 0.
!> 
[in]KL
!>          KL is INTEGER
!>          The number of subdiagonals within the band of A.  KL >= 0.
!> 
[in]KU
!>          KU is INTEGER
!>          The number of superdiagonals within the band of A.  KU >= 0.
!> 
[in,out]AB
!>          AB is DOUBLE PRECISION array, dimension (LDAB,N)
!>          On entry, the matrix A in band storage, in rows KL+1 to
!>          2*KL+KU+1; rows 1 to KL of the array need not be set.
!>          The j-th column of A is stored in the j-th column of the
!>          array AB as follows:
!>          AB(kl+ku+1+i-j,j) = A(i,j) for max(1,j-ku)<=i<=min(m,j+kl)
!>
!>          On exit, details of the factorization: U is stored as an
!>          upper triangular band matrix with KL+KU superdiagonals in
!>          rows 1 to KL+KU+1, and the multipliers used during the
!>          factorization are stored in rows KL+KU+2 to 2*KL+KU+1.
!>          See below for further details.
!> 
[in]LDAB
!>          LDAB is INTEGER
!>          The leading dimension of the array AB.  LDAB >= 2*KL+KU+1.
!> 
[out]IPIV
!>          IPIV is INTEGER array, dimension (min(M,N))
!>          The pivot indices; for 1 <= i <= min(M,N), row i of the
!>          matrix was interchanged with row IPIV(i).
!> 
[out]INFO
!>          INFO is INTEGER
!>          = 0: successful exit
!>          < 0: if INFO = -i, the i-th argument had an illegal value
!>          > 0: if INFO = +i, U(i,i) is exactly zero. The factorization
!>               has been completed, but the factor U is exactly
!>               singular, and division by zero will occur if it is used
!>               to solve a system of equations.
!> 
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Further Details:
!>
!>  The band storage scheme is illustrated by the following example, when
!>  M = N = 6, KL = 2, KU = 1:
!>
!>  On entry:                       On exit:
!>
!>      *    *    *    +    +    +       *    *    *   u14  u25  u36
!>      *    *    +    +    +    +       *    *   u13  u24  u35  u46
!>      *   a12  a23  a34  a45  a56      *   u12  u23  u34  u45  u56
!>     a11  a22  a33  a44  a55  a66     u11  u22  u33  u44  u55  u66
!>     a21  a32  a43  a54  a65   *      m21  m32  m43  m54  m65   *
!>     a31  a42  a53  a64   *    *      m31  m42  m53  m64   *    *
!>
!>  Array elements marked * are not used by the routine; elements marked
!>  + need not be set on entry, but are required by the routine to store
!>  elements of U, because of fill-in resulting from the row
!>  interchanges.
!> 

Definition at line 142 of file dgbtf2.f.

143*
144* -- LAPACK computational routine --
145* -- LAPACK is a software package provided by Univ. of Tennessee, --
146* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
147*
148* .. Scalar Arguments ..
149 INTEGER INFO, KL, KU, LDAB, M, N
150* ..
151* .. Array Arguments ..
152 INTEGER IPIV( * )
153 DOUBLE PRECISION AB( LDAB, * )
154* ..
155*
156* =====================================================================
157*
158* .. Parameters ..
159 DOUBLE PRECISION ONE, ZERO
160 parameter( one = 1.0d+0, zero = 0.0d+0 )
161* ..
162* .. Local Scalars ..
163 INTEGER I, J, JP, JU, KM, KV
164* ..
165* .. External Functions ..
166 INTEGER IDAMAX
167 EXTERNAL idamax
168* ..
169* .. External Subroutines ..
170 EXTERNAL dger, dscal, dswap, xerbla
171* ..
172* .. Intrinsic Functions ..
173 INTRINSIC max, min
174* ..
175* .. Executable Statements ..
176*
177* KV is the number of superdiagonals in the factor U, allowing for
178* fill-in.
179*
180 kv = ku + kl
181*
182* Test the input parameters.
183*
184 info = 0
185 IF( m.LT.0 ) THEN
186 info = -1
187 ELSE IF( n.LT.0 ) THEN
188 info = -2
189 ELSE IF( kl.LT.0 ) THEN
190 info = -3
191 ELSE IF( ku.LT.0 ) THEN
192 info = -4
193 ELSE IF( ldab.LT.kl+kv+1 ) THEN
194 info = -6
195 END IF
196 IF( info.NE.0 ) THEN
197 CALL xerbla( 'DGBTF2', -info )
198 RETURN
199 END IF
200*
201* Quick return if possible
202*
203 IF( m.EQ.0 .OR. n.EQ.0 )
204 $ RETURN
205*
206* Gaussian elimination with partial pivoting
207*
208* Set fill-in elements in columns KU+2 to KV to zero.
209*
210 DO 20 j = ku + 2, min( kv, n )
211 DO 10 i = kv - j + 2, kl
212 ab( i, j ) = zero
213 10 CONTINUE
214 20 CONTINUE
215*
216* JU is the index of the last column affected by the current stage
217* of the factorization.
218*
219 ju = 1
220*
221 DO 40 j = 1, min( m, n )
222*
223* Set fill-in elements in column J+KV to zero.
224*
225 IF( j+kv.LE.n ) THEN
226 DO 30 i = 1, kl
227 ab( i, j+kv ) = zero
228 30 CONTINUE
229 END IF
230*
231* Find pivot and test for singularity. KM is the number of
232* subdiagonal elements in the current column.
233*
234 km = min( kl, m-j )
235 jp = idamax( km+1, ab( kv+1, j ), 1 )
236 ipiv( j ) = jp + j - 1
237 IF( ab( kv+jp, j ).NE.zero ) THEN
238 ju = max( ju, min( j+ku+jp-1, n ) )
239*
240* Apply interchange to columns J to JU.
241*
242 IF( jp.NE.1 )
243 $ CALL dswap( ju-j+1, ab( kv+jp, j ), ldab-1,
244 $ ab( kv+1, j ), ldab-1 )
245*
246 IF( km.GT.0 ) THEN
247*
248* Compute multipliers.
249*
250 CALL dscal( km, one / ab( kv+1, j ), ab( kv+2, j ),
251 $ 1 )
252*
253* Update trailing submatrix within the band.
254*
255 IF( ju.GT.j )
256 $ CALL dger( km, ju-j, -one, ab( kv+2, j ), 1,
257 $ ab( kv, j+1 ), ldab-1, ab( kv+1, j+1 ),
258 $ ldab-1 )
259 END IF
260 ELSE
261*
262* If pivot is zero, set INFO to the index of the pivot
263* unless a zero pivot has already been found.
264*
265 IF( info.EQ.0 )
266 $ info = j
267 END IF
268 40 CONTINUE
269 RETURN
270*
271* End of DGBTF2
272*
subroutine xerbla(srname, info)
Definition cblat2.f:3285
subroutine dger(m, n, alpha, x, incx, y, incy, a, lda)
DGER
Definition dger.f:130
integer function idamax(n, dx, incx)
IDAMAX
Definition idamax.f:71
subroutine dscal(n, da, dx, incx)
DSCAL
Definition dscal.f:79
subroutine dswap(n, dx, incx, dy, incy)
DSWAP
Definition dswap.f:82
Here is the call graph for this function:
Here is the caller graph for this function: