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