![]() |
LAPACK
3.4.1
LAPACK: Linear Algebra PACKage
|
00001 *> \brief <b> CGBSV computes the solution to system of linear equations A * X = B for GB matrices</b> (simple driver) 00002 * 00003 * =========== DOCUMENTATION =========== 00004 * 00005 * Online html documentation available at 00006 * http://www.netlib.org/lapack/explore-html/ 00007 * 00008 *> \htmlonly 00009 *> Download CGBSV + dependencies 00010 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/cgbsv.f"> 00011 *> [TGZ]</a> 00012 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/cgbsv.f"> 00013 *> [ZIP]</a> 00014 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cgbsv.f"> 00015 *> [TXT]</a> 00016 *> \endhtmlonly 00017 * 00018 * Definition: 00019 * =========== 00020 * 00021 * SUBROUTINE CGBSV( N, KL, KU, NRHS, AB, LDAB, IPIV, B, LDB, INFO ) 00022 * 00023 * .. Scalar Arguments .. 00024 * INTEGER INFO, KL, KU, LDAB, LDB, N, NRHS 00025 * .. 00026 * .. Array Arguments .. 00027 * INTEGER IPIV( * ) 00028 * COMPLEX AB( LDAB, * ), B( LDB, * ) 00029 * .. 00030 * 00031 * 00032 *> \par Purpose: 00033 * ============= 00034 *> 00035 *> \verbatim 00036 *> 00037 *> CGBSV computes the solution to a complex system of linear equations 00038 *> A * X = B, where A is a band matrix of order N with KL subdiagonals 00039 *> and KU superdiagonals, and X and B are N-by-NRHS matrices. 00040 *> 00041 *> The LU decomposition with partial pivoting and row interchanges is 00042 *> used to factor A as A = L * U, where L is a product of permutation 00043 *> and unit lower triangular matrices with KL subdiagonals, and U is 00044 *> upper triangular with KL+KU superdiagonals. The factored form of A 00045 *> is then used to solve the system of equations A * X = B. 00046 *> \endverbatim 00047 * 00048 * Arguments: 00049 * ========== 00050 * 00051 *> \param[in] N 00052 *> \verbatim 00053 *> N is INTEGER 00054 *> The number of linear equations, i.e., the order of the 00055 *> 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] NRHS 00071 *> \verbatim 00072 *> NRHS is INTEGER 00073 *> The number of right hand sides, i.e., the number of columns 00074 *> of the matrix B. NRHS >= 0. 00075 *> \endverbatim 00076 *> 00077 *> \param[in,out] AB 00078 *> \verbatim 00079 *> AB is COMPLEX array, dimension (LDAB,N) 00080 *> On entry, the matrix A in band storage, in rows KL+1 to 00081 *> 2*KL+KU+1; rows 1 to KL of the array need not be set. 00082 *> The j-th column of A is stored in the j-th column of the 00083 *> array AB as follows: 00084 *> AB(KL+KU+1+i-j,j) = A(i,j) for max(1,j-KU)<=i<=min(N,j+KL) 00085 *> On exit, details of the factorization: U is stored as an 00086 *> upper triangular band matrix with KL+KU superdiagonals in 00087 *> rows 1 to KL+KU+1, and the multipliers used during the 00088 *> factorization are stored in rows KL+KU+2 to 2*KL+KU+1. 00089 *> See below for further details. 00090 *> \endverbatim 00091 *> 00092 *> \param[in] LDAB 00093 *> \verbatim 00094 *> LDAB is INTEGER 00095 *> The leading dimension of the array AB. LDAB >= 2*KL+KU+1. 00096 *> \endverbatim 00097 *> 00098 *> \param[out] IPIV 00099 *> \verbatim 00100 *> IPIV is INTEGER array, dimension (N) 00101 *> The pivot indices that define the permutation matrix P; 00102 *> row i of the matrix was interchanged with row IPIV(i). 00103 *> \endverbatim 00104 *> 00105 *> \param[in,out] B 00106 *> \verbatim 00107 *> B is COMPLEX array, dimension (LDB,NRHS) 00108 *> On entry, the N-by-NRHS right hand side matrix B. 00109 *> On exit, if INFO = 0, the N-by-NRHS solution matrix X. 00110 *> \endverbatim 00111 *> 00112 *> \param[in] LDB 00113 *> \verbatim 00114 *> LDB is INTEGER 00115 *> The leading dimension of the array B. LDB >= max(1,N). 00116 *> \endverbatim 00117 *> 00118 *> \param[out] INFO 00119 *> \verbatim 00120 *> INFO is INTEGER 00121 *> = 0: successful exit 00122 *> < 0: if INFO = -i, the i-th argument had an illegal value 00123 *> > 0: if INFO = i, U(i,i) is exactly zero. The factorization 00124 *> has been completed, but the factor U is exactly 00125 *> singular, and the solution has not been computed. 00126 *> \endverbatim 00127 * 00128 * Authors: 00129 * ======== 00130 * 00131 *> \author Univ. of Tennessee 00132 *> \author Univ. of California Berkeley 00133 *> \author Univ. of Colorado Denver 00134 *> \author NAG Ltd. 00135 * 00136 *> \date November 2011 00137 * 00138 *> \ingroup complexGBsolve 00139 * 00140 *> \par Further Details: 00141 * ===================== 00142 *> 00143 *> \verbatim 00144 *> 00145 *> The band storage scheme is illustrated by the following example, when 00146 *> M = N = 6, KL = 2, KU = 1: 00147 *> 00148 *> On entry: On exit: 00149 *> 00150 *> * * * + + + * * * u14 u25 u36 00151 *> * * + + + + * * u13 u24 u35 u46 00152 *> * a12 a23 a34 a45 a56 * u12 u23 u34 u45 u56 00153 *> a11 a22 a33 a44 a55 a66 u11 u22 u33 u44 u55 u66 00154 *> a21 a32 a43 a54 a65 * m21 m32 m43 m54 m65 * 00155 *> a31 a42 a53 a64 * * m31 m42 m53 m64 * * 00156 *> 00157 *> Array elements marked * are not used by the routine; elements marked 00158 *> + need not be set on entry, but are required by the routine to store 00159 *> elements of U because of fill-in resulting from the row interchanges. 00160 *> \endverbatim 00161 *> 00162 * ===================================================================== 00163 SUBROUTINE CGBSV( N, KL, KU, NRHS, AB, LDAB, IPIV, B, LDB, INFO ) 00164 * 00165 * -- LAPACK driver routine (version 3.4.0) -- 00166 * -- LAPACK is a software package provided by Univ. of Tennessee, -- 00167 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- 00168 * November 2011 00169 * 00170 * .. Scalar Arguments .. 00171 INTEGER INFO, KL, KU, LDAB, LDB, N, NRHS 00172 * .. 00173 * .. Array Arguments .. 00174 INTEGER IPIV( * ) 00175 COMPLEX AB( LDAB, * ), B( LDB, * ) 00176 * .. 00177 * 00178 * ===================================================================== 00179 * 00180 * .. External Subroutines .. 00181 EXTERNAL CGBTRF, CGBTRS, XERBLA 00182 * .. 00183 * .. Intrinsic Functions .. 00184 INTRINSIC MAX 00185 * .. 00186 * .. Executable Statements .. 00187 * 00188 * Test the input parameters. 00189 * 00190 INFO = 0 00191 IF( N.LT.0 ) THEN 00192 INFO = -1 00193 ELSE IF( KL.LT.0 ) THEN 00194 INFO = -2 00195 ELSE IF( KU.LT.0 ) THEN 00196 INFO = -3 00197 ELSE IF( NRHS.LT.0 ) THEN 00198 INFO = -4 00199 ELSE IF( LDAB.LT.2*KL+KU+1 ) THEN 00200 INFO = -6 00201 ELSE IF( LDB.LT.MAX( N, 1 ) ) THEN 00202 INFO = -9 00203 END IF 00204 IF( INFO.NE.0 ) THEN 00205 CALL XERBLA( 'CGBSV ', -INFO ) 00206 RETURN 00207 END IF 00208 * 00209 * Compute the LU factorization of the band matrix A. 00210 * 00211 CALL CGBTRF( N, N, KL, KU, AB, LDAB, IPIV, INFO ) 00212 IF( INFO.EQ.0 ) THEN 00213 * 00214 * Solve the system A*X = B, overwriting B with X. 00215 * 00216 CALL CGBTRS( 'No transpose', N, KL, KU, NRHS, AB, LDAB, IPIV, 00217 $ B, LDB, INFO ) 00218 END IF 00219 RETURN 00220 * 00221 * End of CGBSV 00222 * 00223 END