00001 /* dgbsv.f -- translated by f2c (version 20061008). 00002 You must link the resulting object file with libf2c: 00003 on Microsoft Windows system, link with libf2c.lib; 00004 on Linux or Unix systems, link with .../path/to/libf2c.a -lm 00005 or, if you install libf2c.a in a standard place, with -lf2c -lm 00006 -- in that order, at the end of the command line, as in 00007 cc *.o -lf2c -lm 00008 Source for libf2c is in /netlib/f2c/libf2c.zip, e.g., 00009 00010 http://www.netlib.org/f2c/libf2c.zip 00011 */ 00012 00013 #include "f2c.h" 00014 #include "blaswrap.h" 00015 00016 /* Subroutine */ int dgbsv_(integer *n, integer *kl, integer *ku, integer * 00017 nrhs, doublereal *ab, integer *ldab, integer *ipiv, doublereal *b, 00018 integer *ldb, integer *info) 00019 { 00020 /* System generated locals */ 00021 integer ab_dim1, ab_offset, b_dim1, b_offset, i__1; 00022 00023 /* Local variables */ 00024 extern /* Subroutine */ int dgbtrf_(integer *, integer *, integer *, 00025 integer *, doublereal *, integer *, integer *, integer *), 00026 xerbla_(char *, integer *), dgbtrs_(char *, integer *, 00027 integer *, integer *, integer *, doublereal *, integer *, integer 00028 *, doublereal *, integer *, integer *); 00029 00030 00031 /* -- LAPACK driver routine (version 3.2) -- */ 00032 /* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */ 00033 /* November 2006 */ 00034 00035 /* .. Scalar Arguments .. */ 00036 /* .. */ 00037 /* .. Array Arguments .. */ 00038 /* .. */ 00039 00040 /* Purpose */ 00041 /* ======= */ 00042 00043 /* DGBSV computes the solution to a real system of linear equations */ 00044 /* A * X = B, where A is a band matrix of order N with KL subdiagonals */ 00045 /* and KU superdiagonals, and X and B are N-by-NRHS matrices. */ 00046 00047 /* The LU decomposition with partial pivoting and row interchanges is */ 00048 /* used to factor A as A = L * U, where L is a product of permutation */ 00049 /* and unit lower triangular matrices with KL subdiagonals, and U is */ 00050 /* upper triangular with KL+KU superdiagonals. The factored form of A */ 00051 /* is then used to solve the system of equations A * X = B. */ 00052 00053 /* Arguments */ 00054 /* ========= */ 00055 00056 /* N (input) INTEGER */ 00057 /* The number of linear equations, i.e., the order of the */ 00058 /* matrix A. N >= 0. */ 00059 00060 /* KL (input) INTEGER */ 00061 /* The number of subdiagonals within the band of A. KL >= 0. */ 00062 00063 /* KU (input) INTEGER */ 00064 /* The number of superdiagonals within the band of A. KU >= 0. */ 00065 00066 /* NRHS (input) INTEGER */ 00067 /* The number of right hand sides, i.e., the number of columns */ 00068 /* of the matrix B. NRHS >= 0. */ 00069 00070 /* AB (input/output) DOUBLE PRECISION array, dimension (LDAB,N) */ 00071 /* On entry, the matrix A in band storage, in rows KL+1 to */ 00072 /* 2*KL+KU+1; rows 1 to KL of the array need not be set. */ 00073 /* The j-th column of A is stored in the j-th column of the */ 00074 /* array AB as follows: */ 00075 /* AB(KL+KU+1+i-j,j) = A(i,j) for max(1,j-KU)<=i<=min(N,j+KL) */ 00076 /* On exit, details of the factorization: U is stored as an */ 00077 /* upper triangular band matrix with KL+KU superdiagonals in */ 00078 /* rows 1 to KL+KU+1, and the multipliers used during the */ 00079 /* factorization are stored in rows KL+KU+2 to 2*KL+KU+1. */ 00080 /* See below for further details. */ 00081 00082 /* LDAB (input) INTEGER */ 00083 /* The leading dimension of the array AB. LDAB >= 2*KL+KU+1. */ 00084 00085 /* IPIV (output) INTEGER array, dimension (N) */ 00086 /* The pivot indices that define the permutation matrix P; */ 00087 /* row i of the matrix was interchanged with row IPIV(i). */ 00088 00089 /* B (input/output) DOUBLE PRECISION array, dimension (LDB,NRHS) */ 00090 /* On entry, the N-by-NRHS right hand side matrix B. */ 00091 /* On exit, if INFO = 0, the N-by-NRHS solution matrix X. */ 00092 00093 /* LDB (input) INTEGER */ 00094 /* The leading dimension of the array B. LDB >= max(1,N). */ 00095 00096 /* INFO (output) INTEGER */ 00097 /* = 0: successful exit */ 00098 /* < 0: if INFO = -i, the i-th argument had an illegal value */ 00099 /* > 0: if INFO = i, U(i,i) is exactly zero. The factorization */ 00100 /* has been completed, but the factor U is exactly */ 00101 /* singular, and the solution has not been computed. */ 00102 00103 /* Further Details */ 00104 /* =============== */ 00105 00106 /* The band storage scheme is illustrated by the following example, when */ 00107 /* M = N = 6, KL = 2, KU = 1: */ 00108 00109 /* On entry: On exit: */ 00110 00111 /* * * * + + + * * * u14 u25 u36 */ 00112 /* * * + + + + * * u13 u24 u35 u46 */ 00113 /* * a12 a23 a34 a45 a56 * u12 u23 u34 u45 u56 */ 00114 /* a11 a22 a33 a44 a55 a66 u11 u22 u33 u44 u55 u66 */ 00115 /* a21 a32 a43 a54 a65 * m21 m32 m43 m54 m65 * */ 00116 /* a31 a42 a53 a64 * * m31 m42 m53 m64 * * */ 00117 00118 /* Array elements marked * are not used by the routine; elements marked */ 00119 /* + need not be set on entry, but are required by the routine to store */ 00120 /* elements of U because of fill-in resulting from the row interchanges. */ 00121 00122 /* ===================================================================== */ 00123 00124 /* .. External Subroutines .. */ 00125 /* .. */ 00126 /* .. Intrinsic Functions .. */ 00127 /* .. */ 00128 /* .. Executable Statements .. */ 00129 00130 /* Test the input parameters. */ 00131 00132 /* Parameter adjustments */ 00133 ab_dim1 = *ldab; 00134 ab_offset = 1 + ab_dim1; 00135 ab -= ab_offset; 00136 --ipiv; 00137 b_dim1 = *ldb; 00138 b_offset = 1 + b_dim1; 00139 b -= b_offset; 00140 00141 /* Function Body */ 00142 *info = 0; 00143 if (*n < 0) { 00144 *info = -1; 00145 } else if (*kl < 0) { 00146 *info = -2; 00147 } else if (*ku < 0) { 00148 *info = -3; 00149 } else if (*nrhs < 0) { 00150 *info = -4; 00151 } else if (*ldab < (*kl << 1) + *ku + 1) { 00152 *info = -6; 00153 } else if (*ldb < max(*n,1)) { 00154 *info = -9; 00155 } 00156 if (*info != 0) { 00157 i__1 = -(*info); 00158 xerbla_("DGBSV ", &i__1); 00159 return 0; 00160 } 00161 00162 /* Compute the LU factorization of the band matrix A. */ 00163 00164 dgbtrf_(n, n, kl, ku, &ab[ab_offset], ldab, &ipiv[1], info); 00165 if (*info == 0) { 00166 00167 /* Solve the system A*X = B, overwriting B with X. */ 00168 00169 dgbtrs_("No transpose", n, kl, ku, nrhs, &ab[ab_offset], ldab, &ipiv[ 00170 1], &b[b_offset], ldb, info); 00171 } 00172 return 0; 00173 00174 /* End of DGBSV */ 00175 00176 } /* dgbsv_ */