00001 /* dpbtrs.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 /* Table of constant values */ 00017 00018 static integer c__1 = 1; 00019 00020 /* Subroutine */ int dpbtrs_(char *uplo, integer *n, integer *kd, integer * 00021 nrhs, doublereal *ab, integer *ldab, doublereal *b, integer *ldb, 00022 integer *info) 00023 { 00024 /* System generated locals */ 00025 integer ab_dim1, ab_offset, b_dim1, b_offset, i__1; 00026 00027 /* Local variables */ 00028 integer j; 00029 extern logical lsame_(char *, char *); 00030 extern /* Subroutine */ int dtbsv_(char *, char *, char *, integer *, 00031 integer *, doublereal *, integer *, doublereal *, integer *); 00032 logical upper; 00033 extern /* Subroutine */ int xerbla_(char *, integer *); 00034 00035 00036 /* -- LAPACK routine (version 3.2) -- */ 00037 /* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */ 00038 /* November 2006 */ 00039 00040 /* .. Scalar Arguments .. */ 00041 /* .. */ 00042 /* .. Array Arguments .. */ 00043 /* .. */ 00044 00045 /* Purpose */ 00046 /* ======= */ 00047 00048 /* DPBTRS solves a system of linear equations A*X = B with a symmetric */ 00049 /* positive definite band matrix A using the Cholesky factorization */ 00050 /* A = U**T*U or A = L*L**T computed by DPBTRF. */ 00051 00052 /* Arguments */ 00053 /* ========= */ 00054 00055 /* UPLO (input) CHARACTER*1 */ 00056 /* = 'U': Upper triangular factor stored in AB; */ 00057 /* = 'L': Lower triangular factor stored in AB. */ 00058 00059 /* N (input) INTEGER */ 00060 /* The order of the matrix A. N >= 0. */ 00061 00062 /* KD (input) INTEGER */ 00063 /* The number of superdiagonals of the matrix A if UPLO = 'U', */ 00064 /* or the number of subdiagonals if UPLO = 'L'. KD >= 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) DOUBLE PRECISION array, dimension (LDAB,N) */ 00071 /* The triangular factor U or L from the Cholesky factorization */ 00072 /* A = U**T*U or A = L*L**T of the band matrix A, stored in the */ 00073 /* first KD+1 rows of the array. The j-th column of U or L is */ 00074 /* stored in the j-th column of the array AB as follows: */ 00075 /* if UPLO ='U', AB(kd+1+i-j,j) = U(i,j) for max(1,j-kd)<=i<=j; */ 00076 /* if UPLO ='L', AB(1+i-j,j) = L(i,j) for j<=i<=min(n,j+kd). */ 00077 00078 /* LDAB (input) INTEGER */ 00079 /* The leading dimension of the array AB. LDAB >= KD+1. */ 00080 00081 /* B (input/output) DOUBLE PRECISION array, dimension (LDB,NRHS) */ 00082 /* On entry, the right hand side matrix B. */ 00083 /* On exit, the solution matrix X. */ 00084 00085 /* LDB (input) INTEGER */ 00086 /* The leading dimension of the array B. LDB >= max(1,N). */ 00087 00088 /* INFO (output) INTEGER */ 00089 /* = 0: successful exit */ 00090 /* < 0: if INFO = -i, the i-th argument had an illegal value */ 00091 00092 /* ===================================================================== */ 00093 00094 /* .. Local Scalars .. */ 00095 /* .. */ 00096 /* .. External Functions .. */ 00097 /* .. */ 00098 /* .. External Subroutines .. */ 00099 /* .. */ 00100 /* .. Intrinsic Functions .. */ 00101 /* .. */ 00102 /* .. Executable Statements .. */ 00103 00104 /* Test the input parameters. */ 00105 00106 /* Parameter adjustments */ 00107 ab_dim1 = *ldab; 00108 ab_offset = 1 + ab_dim1; 00109 ab -= ab_offset; 00110 b_dim1 = *ldb; 00111 b_offset = 1 + b_dim1; 00112 b -= b_offset; 00113 00114 /* Function Body */ 00115 *info = 0; 00116 upper = lsame_(uplo, "U"); 00117 if (! upper && ! lsame_(uplo, "L")) { 00118 *info = -1; 00119 } else if (*n < 0) { 00120 *info = -2; 00121 } else if (*kd < 0) { 00122 *info = -3; 00123 } else if (*nrhs < 0) { 00124 *info = -4; 00125 } else if (*ldab < *kd + 1) { 00126 *info = -6; 00127 } else if (*ldb < max(1,*n)) { 00128 *info = -8; 00129 } 00130 if (*info != 0) { 00131 i__1 = -(*info); 00132 xerbla_("DPBTRS", &i__1); 00133 return 0; 00134 } 00135 00136 /* Quick return if possible */ 00137 00138 if (*n == 0 || *nrhs == 0) { 00139 return 0; 00140 } 00141 00142 if (upper) { 00143 00144 /* Solve A*X = B where A = U'*U. */ 00145 00146 i__1 = *nrhs; 00147 for (j = 1; j <= i__1; ++j) { 00148 00149 /* Solve U'*X = B, overwriting B with X. */ 00150 00151 dtbsv_("Upper", "Transpose", "Non-unit", n, kd, &ab[ab_offset], 00152 ldab, &b[j * b_dim1 + 1], &c__1); 00153 00154 /* Solve U*X = B, overwriting B with X. */ 00155 00156 dtbsv_("Upper", "No transpose", "Non-unit", n, kd, &ab[ab_offset], 00157 ldab, &b[j * b_dim1 + 1], &c__1); 00158 /* L10: */ 00159 } 00160 } else { 00161 00162 /* Solve A*X = B where A = L*L'. */ 00163 00164 i__1 = *nrhs; 00165 for (j = 1; j <= i__1; ++j) { 00166 00167 /* Solve L*X = B, overwriting B with X. */ 00168 00169 dtbsv_("Lower", "No transpose", "Non-unit", n, kd, &ab[ab_offset], 00170 ldab, &b[j * b_dim1 + 1], &c__1); 00171 00172 /* Solve L'*X = B, overwriting B with X. */ 00173 00174 dtbsv_("Lower", "Transpose", "Non-unit", n, kd, &ab[ab_offset], 00175 ldab, &b[j * b_dim1 + 1], &c__1); 00176 /* L20: */ 00177 } 00178 } 00179 00180 return 0; 00181 00182 /* End of DPBTRS */ 00183 00184 } /* dpbtrs_ */