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