![]() |
LAPACK
3.4.1
LAPACK: Linear Algebra PACKage
|
00001 *> \brief \b CGBTF2 00002 * 00003 * =========== DOCUMENTATION =========== 00004 * 00005 * Online html documentation available at 00006 * http://www.netlib.org/lapack/explore-html/ 00007 * 00008 *> \htmlonly 00009 *> Download CGBTF2 + dependencies 00010 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/cgbtf2.f"> 00011 *> [TGZ]</a> 00012 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/cgbtf2.f"> 00013 *> [ZIP]</a> 00014 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cgbtf2.f"> 00015 *> [TXT]</a> 00016 *> \endhtmlonly 00017 * 00018 * Definition: 00019 * =========== 00020 * 00021 * SUBROUTINE CGBTF2( M, N, KL, KU, AB, LDAB, IPIV, INFO ) 00022 * 00023 * .. Scalar Arguments .. 00024 * INTEGER INFO, KL, KU, LDAB, M, N 00025 * .. 00026 * .. Array Arguments .. 00027 * INTEGER IPIV( * ) 00028 * COMPLEX AB( LDAB, * ) 00029 * .. 00030 * 00031 * 00032 *> \par Purpose: 00033 * ============= 00034 *> 00035 *> \verbatim 00036 *> 00037 *> CGBTF2 computes an LU factorization of a complex m-by-n band matrix 00038 *> A using partial pivoting with row interchanges. 00039 *> 00040 *> This is the unblocked version of the algorithm, calling Level 2 BLAS. 00041 *> \endverbatim 00042 * 00043 * Arguments: 00044 * ========== 00045 * 00046 *> \param[in] M 00047 *> \verbatim 00048 *> M is INTEGER 00049 *> The number of rows of the matrix A. M >= 0. 00050 *> \endverbatim 00051 *> 00052 *> \param[in] N 00053 *> \verbatim 00054 *> N is INTEGER 00055 *> The number of columns of the matrix A. N >= 0. 00056 *> \endverbatim 00057 *> 00058 *> \param[in] KL 00059 *> \verbatim 00060 *> KL is INTEGER 00061 *> The number of subdiagonals within the band of A. KL >= 0. 00062 *> \endverbatim 00063 *> 00064 *> \param[in] KU 00065 *> \verbatim 00066 *> KU is INTEGER 00067 *> The number of superdiagonals within the band of A. KU >= 0. 00068 *> \endverbatim 00069 *> 00070 *> \param[in,out] AB 00071 *> \verbatim 00072 *> AB is COMPLEX array, dimension (LDAB,N) 00073 *> On entry, the matrix A in band storage, in rows KL+1 to 00074 *> 2*KL+KU+1; rows 1 to KL of the array need not be set. 00075 *> The j-th column of A is stored in the j-th column of the 00076 *> array AB as follows: 00077 *> AB(kl+ku+1+i-j,j) = A(i,j) for max(1,j-ku)<=i<=min(m,j+kl) 00078 *> 00079 *> On exit, details of the factorization: U is stored as an 00080 *> upper triangular band matrix with KL+KU superdiagonals in 00081 *> rows 1 to KL+KU+1, and the multipliers used during the 00082 *> factorization are stored in rows KL+KU+2 to 2*KL+KU+1. 00083 *> See below for further details. 00084 *> \endverbatim 00085 *> 00086 *> \param[in] LDAB 00087 *> \verbatim 00088 *> LDAB is INTEGER 00089 *> The leading dimension of the array AB. LDAB >= 2*KL+KU+1. 00090 *> \endverbatim 00091 *> 00092 *> \param[out] IPIV 00093 *> \verbatim 00094 *> IPIV is INTEGER array, dimension (min(M,N)) 00095 *> The pivot indices; for 1 <= i <= min(M,N), row i of the 00096 *> matrix was interchanged with row IPIV(i). 00097 *> \endverbatim 00098 *> 00099 *> \param[out] INFO 00100 *> \verbatim 00101 *> INFO is INTEGER 00102 *> = 0: successful exit 00103 *> < 0: if INFO = -i, the i-th argument had an illegal value 00104 *> > 0: if INFO = +i, U(i,i) is exactly zero. The factorization 00105 *> has been completed, but the factor U is exactly 00106 *> singular, and division by zero will occur if it is used 00107 *> to solve a system of equations. 00108 *> \endverbatim 00109 * 00110 * Authors: 00111 * ======== 00112 * 00113 *> \author Univ. of Tennessee 00114 *> \author Univ. of California Berkeley 00115 *> \author Univ. of Colorado Denver 00116 *> \author NAG Ltd. 00117 * 00118 *> \date November 2011 00119 * 00120 *> \ingroup complexGBcomputational 00121 * 00122 *> \par Further Details: 00123 * ===================== 00124 *> 00125 *> \verbatim 00126 *> 00127 *> The band storage scheme is illustrated by the following example, when 00128 *> M = N = 6, KL = 2, KU = 1: 00129 *> 00130 *> On entry: On exit: 00131 *> 00132 *> * * * + + + * * * u14 u25 u36 00133 *> * * + + + + * * u13 u24 u35 u46 00134 *> * a12 a23 a34 a45 a56 * u12 u23 u34 u45 u56 00135 *> a11 a22 a33 a44 a55 a66 u11 u22 u33 u44 u55 u66 00136 *> a21 a32 a43 a54 a65 * m21 m32 m43 m54 m65 * 00137 *> a31 a42 a53 a64 * * m31 m42 m53 m64 * * 00138 *> 00139 *> Array elements marked * are not used by the routine; elements marked 00140 *> + need not be set on entry, but are required by the routine to store 00141 *> elements of U, because of fill-in resulting from the row 00142 *> interchanges. 00143 *> \endverbatim 00144 *> 00145 * ===================================================================== 00146 SUBROUTINE CGBTF2( M, N, KL, KU, AB, LDAB, IPIV, INFO ) 00147 * 00148 * -- LAPACK computational routine (version 3.4.0) -- 00149 * -- LAPACK is a software package provided by Univ. of Tennessee, -- 00150 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- 00151 * November 2011 00152 * 00153 * .. Scalar Arguments .. 00154 INTEGER INFO, KL, KU, LDAB, M, N 00155 * .. 00156 * .. Array Arguments .. 00157 INTEGER IPIV( * ) 00158 COMPLEX AB( LDAB, * ) 00159 * .. 00160 * 00161 * ===================================================================== 00162 * 00163 * .. Parameters .. 00164 COMPLEX ONE, ZERO 00165 PARAMETER ( ONE = ( 1.0E+0, 0.0E+0 ), 00166 $ ZERO = ( 0.0E+0, 0.0E+0 ) ) 00167 * .. 00168 * .. Local Scalars .. 00169 INTEGER I, J, JP, JU, KM, KV 00170 * .. 00171 * .. External Functions .. 00172 INTEGER ICAMAX 00173 EXTERNAL ICAMAX 00174 * .. 00175 * .. External Subroutines .. 00176 EXTERNAL CGERU, CSCAL, CSWAP, XERBLA 00177 * .. 00178 * .. Intrinsic Functions .. 00179 INTRINSIC MAX, MIN 00180 * .. 00181 * .. Executable Statements .. 00182 * 00183 * KV is the number of superdiagonals in the factor U, allowing for 00184 * fill-in. 00185 * 00186 KV = KU + KL 00187 * 00188 * Test the input parameters. 00189 * 00190 INFO = 0 00191 IF( M.LT.0 ) THEN 00192 INFO = -1 00193 ELSE IF( N.LT.0 ) THEN 00194 INFO = -2 00195 ELSE IF( KL.LT.0 ) THEN 00196 INFO = -3 00197 ELSE IF( KU.LT.0 ) THEN 00198 INFO = -4 00199 ELSE IF( LDAB.LT.KL+KV+1 ) THEN 00200 INFO = -6 00201 END IF 00202 IF( INFO.NE.0 ) THEN 00203 CALL XERBLA( 'CGBTF2', -INFO ) 00204 RETURN 00205 END IF 00206 * 00207 * Quick return if possible 00208 * 00209 IF( M.EQ.0 .OR. N.EQ.0 ) 00210 $ RETURN 00211 * 00212 * Gaussian elimination with partial pivoting 00213 * 00214 * Set fill-in elements in columns KU+2 to KV to zero. 00215 * 00216 DO 20 J = KU + 2, MIN( KV, N ) 00217 DO 10 I = KV - J + 2, KL 00218 AB( I, J ) = ZERO 00219 10 CONTINUE 00220 20 CONTINUE 00221 * 00222 * JU is the index of the last column affected by the current stage 00223 * of the factorization. 00224 * 00225 JU = 1 00226 * 00227 DO 40 J = 1, MIN( M, N ) 00228 * 00229 * Set fill-in elements in column J+KV to zero. 00230 * 00231 IF( J+KV.LE.N ) THEN 00232 DO 30 I = 1, KL 00233 AB( I, J+KV ) = ZERO 00234 30 CONTINUE 00235 END IF 00236 * 00237 * Find pivot and test for singularity. KM is the number of 00238 * subdiagonal elements in the current column. 00239 * 00240 KM = MIN( KL, M-J ) 00241 JP = ICAMAX( KM+1, AB( KV+1, J ), 1 ) 00242 IPIV( J ) = JP + J - 1 00243 IF( AB( KV+JP, J ).NE.ZERO ) THEN 00244 JU = MAX( JU, MIN( J+KU+JP-1, N ) ) 00245 * 00246 * Apply interchange to columns J to JU. 00247 * 00248 IF( JP.NE.1 ) 00249 $ CALL CSWAP( JU-J+1, AB( KV+JP, J ), LDAB-1, 00250 $ AB( KV+1, J ), LDAB-1 ) 00251 IF( KM.GT.0 ) THEN 00252 * 00253 * Compute multipliers. 00254 * 00255 CALL CSCAL( KM, ONE / AB( KV+1, J ), AB( KV+2, J ), 1 ) 00256 * 00257 * Update trailing submatrix within the band. 00258 * 00259 IF( JU.GT.J ) 00260 $ CALL CGERU( KM, JU-J, -ONE, AB( KV+2, J ), 1, 00261 $ AB( KV, J+1 ), LDAB-1, AB( KV+1, J+1 ), 00262 $ LDAB-1 ) 00263 END IF 00264 ELSE 00265 * 00266 * If pivot is zero, set INFO to the index of the pivot 00267 * unless a zero pivot has already been found. 00268 * 00269 IF( INFO.EQ.0 ) 00270 $ INFO = J 00271 END IF 00272 40 CONTINUE 00273 RETURN 00274 * 00275 * End of CGBTF2 00276 * 00277 END