1 *> \brief \b CGBTF2 computes the LU factorization of a general band matrix using the unblocked version of the algorithm.
3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
9 *> Download CGBTF2 + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/cgbtf2.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/cgbtf2.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cgbtf2.f">
21 * SUBROUTINE CGBTF2( M, N, KL, KU, AB, LDAB, IPIV, INFO )
23 * .. Scalar Arguments ..
24 * INTEGER INFO, KL, KU, LDAB, M, N
26 * .. Array Arguments ..
28 * COMPLEX AB( LDAB, * )
37 *> CGBTF2 computes an LU factorization of a complex m-by-n band matrix
38 *> A using partial pivoting with row interchanges.
40 *> This is the unblocked version of the algorithm, calling Level 2 BLAS.
49 *> The number of rows of the matrix A. M >= 0.
55 *> The number of columns of the matrix A. N >= 0.
61 *> The number of subdiagonals within the band of A. KL >= 0.
67 *> The number of superdiagonals within the band of A. KU >= 0.
72 *> AB is COMPLEX array, dimension (LDAB,N)
73 *> On entry, the matrix A in band storage, in rows KL+1 to
74 *> 2*KL+KU+1; rows 1 to KL of the array need not be set.
75 *> The j-th column of A is stored in the j-th column of the
76 *> array AB as follows:
77 *> AB(kl+ku+1+i-j,j) = A(i,j) for max(1,j-ku)<=i<=min(m,j+kl)
79 *> On exit, details of the factorization: U is stored as an
80 *> upper triangular band matrix with KL+KU superdiagonals in
81 *> rows 1 to KL+KU+1, and the multipliers used during the
82 *> factorization are stored in rows KL+KU+2 to 2*KL+KU+1.
83 *> See below for further details.
89 *> The leading dimension of the array AB. LDAB >= 2*KL+KU+1.
94 *> IPIV is INTEGER array, dimension (min(M,N))
95 *> The pivot indices; for 1 <= i <= min(M,N), row i of the
96 *> matrix was interchanged with row IPIV(i).
102 *> = 0: successful exit
103 *> < 0: if INFO = -i, the i-th argument had an illegal value
104 *> > 0: if INFO = +i, U(i,i) is exactly zero. The factorization
105 *> has been completed, but the factor U is exactly
106 *> singular, and division by zero will occur if it is used
107 *> to solve a system of equations.
113 *> \author Univ. of Tennessee
114 *> \author Univ. of California Berkeley
115 *> \author Univ. of Colorado Denver
118 *> \date September 2012
120 *> \ingroup complexGBcomputational
122 *> \par Further Details:
123 * =====================
127 *> The band storage scheme is illustrated by the following example, when
128 *> M = N = 6, KL = 2, KU = 1:
130 *> On entry: On exit:
132 *> * * * + + + * * * u14 u25 u36
133 *> * * + + + + * * u13 u24 u35 u46
134 *> * a12 a23 a34 a45 a56 * u12 u23 u34 u45 u56
135 *> a11 a22 a33 a44 a55 a66 u11 u22 u33 u44 u55 u66
136 *> a21 a32 a43 a54 a65 * m21 m32 m43 m54 m65 *
137 *> a31 a42 a53 a64 * * m31 m42 m53 m64 * *
139 *> Array elements marked * are not used by the routine; elements marked
140 *> + need not be set on entry, but are required by the routine to store
141 *> elements of U, because of fill-in resulting from the row
145 * =====================================================================
146 SUBROUTINE CGBTF2( M, N, KL, KU, AB, LDAB, IPIV, INFO )
148 * -- LAPACK computational routine (version 3.4.2) --
149 * -- LAPACK is a software package provided by Univ. of Tennessee, --
150 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
153 * .. Scalar Arguments ..
154 INTEGER INFO, KL, KU, LDAB, M, N
156 * .. Array Arguments ..
158 COMPLEX AB( LDAB, * )
161 * =====================================================================
165 PARAMETER ( ONE = ( 1.0E+0, 0.0E+0 ),
166 $ ZERO = ( 0.0E+0, 0.0E+0 ) )
168 * .. Local Scalars ..
169 INTEGER I, J, JP, JU, KM, KV
171 * .. External Functions ..
175 * .. External Subroutines ..
176 EXTERNAL CGERU, CSCAL, CSWAP, XERBLA
178 * .. Intrinsic Functions ..
181 * .. Executable Statements ..
183 * KV is the number of superdiagonals in the factor U, allowing for
188 * Test the input parameters.
193 ELSE IF( N.LT.0 ) THEN
195 ELSE IF( KL.LT.0 ) THEN
197 ELSE IF( KU.LT.0 ) THEN
199 ELSE IF( LDAB.LT.KL+KV+1 ) THEN
203 CALL XERBLA( 'CGBTF2', -INFO )
207 * Quick return if possible
209 IF( M.EQ.0 .OR. N.EQ.0 )
212 * Gaussian elimination with partial pivoting
214 * Set fill-in elements in columns KU+2 to KV to zero.
216 DO 20 J = KU + 2, MIN( KV, N )
217 DO 10 I = KV - J + 2, KL
222 * JU is the index of the last column affected by the current stage
223 * of the factorization.
227 DO 40 J = 1, MIN( M, N )
229 * Set fill-in elements in column J+KV to zero.
237 * Find pivot and test for singularity. KM is the number of
238 * subdiagonal elements in the current column.
241 JP = ICAMAX( KM+1, AB( KV+1, J ), 1 )
242 IPIV( J ) = JP + J - 1
243 IF( AB( KV+JP, J ).NE.ZERO ) THEN
244 JU = MAX( JU, MIN( J+KU+JP-1, N ) )
246 * Apply interchange to columns J to JU.
249 $ CALL CSWAP( JU-J+1, AB( KV+JP, J ), LDAB-1,
250 $ AB( KV+1, J ), LDAB-1 )
253 * Compute multipliers.
255 CALL CSCAL( KM, ONE / AB( KV+1, J ), AB( KV+2, J ), 1 )
257 * Update trailing submatrix within the band.
260 $ CALL CGERU( KM, JU-J, -ONE, AB( KV+2, J ), 1,
261 $ AB( KV, J+1 ), LDAB-1, AB( KV+1, J+1 ),
266 * If pivot is zero, set INFO to the index of the pivot
267 * unless a zero pivot has already been found.