00001 /* ztbtrs.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 ztbtrs_(char *uplo, char *trans, char *diag, integer *n, 00021 integer *kd, integer *nrhs, doublecomplex *ab, integer *ldab, 00022 doublecomplex *b, integer *ldb, integer *info) 00023 { 00024 /* System generated locals */ 00025 integer ab_dim1, ab_offset, b_dim1, b_offset, i__1, i__2; 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 logical nounit; 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 /* ZTBTRS solves a triangular system of the form */ 00049 00050 /* A * X = B, A**T * X = B, or A**H * X = B, */ 00051 00052 /* where A is a triangular band matrix of order N, and B is an */ 00053 /* N-by-NRHS matrix. A check is made to verify that A is nonsingular. */ 00054 00055 /* Arguments */ 00056 /* ========= */ 00057 00058 /* UPLO (input) CHARACTER*1 */ 00059 /* = 'U': A is upper triangular; */ 00060 /* = 'L': A is lower triangular. */ 00061 00062 /* TRANS (input) CHARACTER*1 */ 00063 /* Specifies the form of the system of equations: */ 00064 /* = 'N': A * X = B (No transpose) */ 00065 /* = 'T': A**T * X = B (Transpose) */ 00066 /* = 'C': A**H * X = B (Conjugate transpose) */ 00067 00068 /* DIAG (input) CHARACTER*1 */ 00069 /* = 'N': A is non-unit triangular; */ 00070 /* = 'U': A is unit triangular. */ 00071 00072 /* N (input) INTEGER */ 00073 /* The order of the matrix A. N >= 0. */ 00074 00075 /* KD (input) INTEGER */ 00076 /* The number of superdiagonals or subdiagonals of the */ 00077 /* triangular band matrix A. KD >= 0. */ 00078 00079 /* NRHS (input) INTEGER */ 00080 /* The number of right hand sides, i.e., the number of columns */ 00081 /* of the matrix B. NRHS >= 0. */ 00082 00083 /* AB (input) COMPLEX*16 array, dimension (LDAB,N) */ 00084 /* The upper or lower triangular band matrix A, stored in the */ 00085 /* first kd+1 rows of AB. The j-th column of A is stored */ 00086 /* in the j-th column of the array AB as follows: */ 00087 /* if UPLO = 'U', AB(kd+1+i-j,j) = A(i,j) for max(1,j-kd)<=i<=j; */ 00088 /* if UPLO = 'L', AB(1+i-j,j) = A(i,j) for j<=i<=min(n,j+kd). */ 00089 /* If DIAG = 'U', the diagonal elements of A are not referenced */ 00090 /* and are assumed to be 1. */ 00091 00092 /* LDAB (input) INTEGER */ 00093 /* The leading dimension of the array AB. LDAB >= KD+1. */ 00094 00095 /* B (input/output) COMPLEX*16 array, dimension (LDB,NRHS) */ 00096 /* On entry, the right hand side matrix B. */ 00097 /* On exit, if INFO = 0, the solution matrix X. */ 00098 00099 /* LDB (input) INTEGER */ 00100 /* The leading dimension of the array B. LDB >= max(1,N). */ 00101 00102 /* INFO (output) INTEGER */ 00103 /* = 0: successful exit */ 00104 /* < 0: if INFO = -i, the i-th argument had an illegal value */ 00105 /* > 0: if INFO = i, the i-th diagonal element of A is zero, */ 00106 /* indicating that the matrix is singular and the */ 00107 /* solutions X have not been computed. */ 00108 00109 /* ===================================================================== */ 00110 00111 /* .. Parameters .. */ 00112 /* .. */ 00113 /* .. Local Scalars .. */ 00114 /* .. */ 00115 /* .. External Functions .. */ 00116 /* .. */ 00117 /* .. External Subroutines .. */ 00118 /* .. */ 00119 /* .. Intrinsic Functions .. */ 00120 /* .. */ 00121 /* .. Executable Statements .. */ 00122 00123 /* Test the input parameters. */ 00124 00125 /* Parameter adjustments */ 00126 ab_dim1 = *ldab; 00127 ab_offset = 1 + ab_dim1; 00128 ab -= ab_offset; 00129 b_dim1 = *ldb; 00130 b_offset = 1 + b_dim1; 00131 b -= b_offset; 00132 00133 /* Function Body */ 00134 *info = 0; 00135 nounit = lsame_(diag, "N"); 00136 upper = lsame_(uplo, "U"); 00137 if (! upper && ! lsame_(uplo, "L")) { 00138 *info = -1; 00139 } else if (! lsame_(trans, "N") && ! lsame_(trans, 00140 "T") && ! lsame_(trans, "C")) { 00141 *info = -2; 00142 } else if (! nounit && ! lsame_(diag, "U")) { 00143 *info = -3; 00144 } else if (*n < 0) { 00145 *info = -4; 00146 } else if (*kd < 0) { 00147 *info = -5; 00148 } else if (*nrhs < 0) { 00149 *info = -6; 00150 } else if (*ldab < *kd + 1) { 00151 *info = -8; 00152 } else if (*ldb < max(1,*n)) { 00153 *info = -10; 00154 } 00155 if (*info != 0) { 00156 i__1 = -(*info); 00157 xerbla_("ZTBTRS", &i__1); 00158 return 0; 00159 } 00160 00161 /* Quick return if possible */ 00162 00163 if (*n == 0) { 00164 return 0; 00165 } 00166 00167 /* Check for singularity. */ 00168 00169 if (nounit) { 00170 if (upper) { 00171 i__1 = *n; 00172 for (*info = 1; *info <= i__1; ++(*info)) { 00173 i__2 = *kd + 1 + *info * ab_dim1; 00174 if (ab[i__2].r == 0. && ab[i__2].i == 0.) { 00175 return 0; 00176 } 00177 /* L10: */ 00178 } 00179 } else { 00180 i__1 = *n; 00181 for (*info = 1; *info <= i__1; ++(*info)) { 00182 i__2 = *info * ab_dim1 + 1; 00183 if (ab[i__2].r == 0. && ab[i__2].i == 0.) { 00184 return 0; 00185 } 00186 /* L20: */ 00187 } 00188 } 00189 } 00190 *info = 0; 00191 00192 /* Solve A * X = B, A**T * X = B, or A**H * X = B. */ 00193 00194 i__1 = *nrhs; 00195 for (j = 1; j <= i__1; ++j) { 00196 ztbsv_(uplo, trans, diag, n, kd, &ab[ab_offset], ldab, &b[j * b_dim1 00197 + 1], &c__1); 00198 /* L30: */ 00199 } 00200 00201 return 0; 00202 00203 /* End of ZTBTRS */ 00204 00205 } /* ztbtrs_ */