1 /* ./src_f77/cpbsv.f -- translated by f2c (version 20030320).
2    You must link the resulting object file with the libraries:
3 	-lf2c -lm   (in that order)
4 */
5 
6 #include <punc/vf2c.h>
7 
cpbsv_(char * uplo,integer * n,integer * kd,integer * nrhs,complex * ab,integer * ldab,complex * b,integer * ldb,integer * info,ftnlen uplo_len)8 /* Subroutine */ int cpbsv_(char *uplo, integer *n, integer *kd, integer *
9 	nrhs, complex *ab, integer *ldab, complex *b, integer *ldb, integer *
10 	info, ftnlen uplo_len)
11 {
12     /* System generated locals */
13     integer ab_dim1, ab_offset, b_dim1, b_offset, i__1;
14 
15     /* Local variables */
16     extern logical lsame_(char *, char *, ftnlen, ftnlen);
17     extern /* Subroutine */ int xerbla_(char *, integer *, ftnlen), cpbtrf_(
18 	    char *, integer *, integer *, complex *, integer *, integer *,
19 	    ftnlen), cpbtrs_(char *, integer *, integer *, integer *, complex
20 	    *, integer *, complex *, integer *, integer *, ftnlen);
21 
22 
23 /*  -- LAPACK driver routine (version 3.0) -- */
24 /*     Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd., */
25 /*     Courant Institute, Argonne National Lab, and Rice University */
26 /*     March 31, 1993 */
27 
28 /*     .. Scalar Arguments .. */
29 /*     .. */
30 /*     .. Array Arguments .. */
31 /*     .. */
32 
33 /*  Purpose */
34 /*  ======= */
35 
36 /*  CPBSV computes the solution to a complex system of linear equations */
37 /*     A * X = B, */
38 /*  where A is an N-by-N Hermitian positive definite band matrix and X */
39 /*  and B are N-by-NRHS matrices. */
40 
41 /*  The Cholesky decomposition is used to factor A as */
42 /*     A = U**H * U,  if UPLO = 'U', or */
43 /*     A = L * L**H,  if UPLO = 'L', */
44 /*  where U is an upper triangular band matrix, and L is a lower */
45 /*  triangular band matrix, with the same number of superdiagonals or */
46 /*  subdiagonals as A.  The factored form of A is then used to solve the */
47 /*  system of equations A * X = B. */
48 
49 /*  Arguments */
50 /*  ========= */
51 
52 /*  UPLO    (input) CHARACTER*1 */
53 /*          = 'U':  Upper triangle of A is stored; */
54 /*          = 'L':  Lower triangle of A is stored. */
55 
56 /*  N       (input) INTEGER */
57 /*          The number of linear equations, i.e., the order of the */
58 /*          matrix A.  N >= 0. */
59 
60 /*  KD      (input) INTEGER */
61 /*          The number of superdiagonals of the matrix A if UPLO = 'U', */
62 /*          or the number of subdiagonals if UPLO = 'L'.  KD >= 0. */
63 
64 /*  NRHS    (input) INTEGER */
65 /*          The number of right hand sides, i.e., the number of columns */
66 /*          of the matrix B.  NRHS >= 0. */
67 
68 /*  AB      (input/output) COMPLEX array, dimension (LDAB,N) */
69 /*          On entry, the upper or lower triangle of the Hermitian band */
70 /*          matrix A, stored in the first KD+1 rows of the array.  The */
71 /*          j-th column of A is stored in the j-th column of the array AB */
72 /*          as follows: */
73 /*          if UPLO = 'U', AB(KD+1+i-j,j) = A(i,j) for max(1,j-KD)<=i<=j; */
74 /*          if UPLO = 'L', AB(1+i-j,j)    = A(i,j) for j<=i<=min(N,j+KD). */
75 /*          See below for further details. */
76 
77 /*          On exit, if INFO = 0, the triangular factor U or L from the */
78 /*          Cholesky factorization A = U**H*U or A = L*L**H of the band */
79 /*          matrix A, in the same storage format as A. */
80 
81 /*  LDAB    (input) INTEGER */
82 /*          The leading dimension of the array AB.  LDAB >= KD+1. */
83 
84 /*  B       (input/output) COMPLEX array, dimension (LDB,NRHS) */
85 /*          On entry, the N-by-NRHS right hand side matrix B. */
86 /*          On exit, if INFO = 0, the N-by-NRHS solution matrix X. */
87 
88 /*  LDB     (input) INTEGER */
89 /*          The leading dimension of the array B.  LDB >= max(1,N). */
90 
91 /*  INFO    (output) INTEGER */
92 /*          = 0:  successful exit */
93 /*          < 0:  if INFO = -i, the i-th argument had an illegal value */
94 /*          > 0:  if INFO = i, the leading minor of order i of A is not */
95 /*                positive definite, so the factorization could not be */
96 /*                completed, and the solution has not been computed. */
97 
98 /*  Further Details */
99 /*  =============== */
100 
101 /*  The band storage scheme is illustrated by the following example, when */
102 /*  N = 6, KD = 2, and UPLO = 'U': */
103 
104 /*  On entry:                       On exit: */
105 
106 /*      *    *   a13  a24  a35  a46      *    *   u13  u24  u35  u46 */
107 /*      *   a12  a23  a34  a45  a56      *   u12  u23  u34  u45  u56 */
108 /*     a11  a22  a33  a44  a55  a66     u11  u22  u33  u44  u55  u66 */
109 
110 /*  Similarly, if UPLO = 'L' the format of A is as follows: */
111 
112 /*  On entry:                       On exit: */
113 
114 /*     a11  a22  a33  a44  a55  a66     l11  l22  l33  l44  l55  l66 */
115 /*     a21  a32  a43  a54  a65   *      l21  l32  l43  l54  l65   * */
116 /*     a31  a42  a53  a64   *    *      l31  l42  l53  l64   *    * */
117 
118 /*  Array elements marked * are not used by the routine. */
119 
120 /*  ===================================================================== */
121 
122 /*     .. External Functions .. */
123 /*     .. */
124 /*     .. External Subroutines .. */
125 /*     .. */
126 /*     .. Intrinsic Functions .. */
127 /*     .. */
128 /*     .. Executable Statements .. */
129 
130 /*     Test the input parameters. */
131 
132     /* Parameter adjustments */
133     ab_dim1 = *ldab;
134     ab_offset = 1 + ab_dim1;
135     ab -= ab_offset;
136     b_dim1 = *ldb;
137     b_offset = 1 + b_dim1;
138     b -= b_offset;
139 
140     /* Function Body */
141     *info = 0;
142     if (! lsame_(uplo, "U", (ftnlen)1, (ftnlen)1) && ! lsame_(uplo, "L", (
143 	    ftnlen)1, (ftnlen)1)) {
144 	*info = -1;
145     } else if (*n < 0) {
146 	*info = -2;
147     } else if (*kd < 0) {
148 	*info = -3;
149     } else if (*nrhs < 0) {
150 	*info = -4;
151     } else if (*ldab < *kd + 1) {
152 	*info = -6;
153     } else if (*ldb < max(1,*n)) {
154 	*info = -8;
155     }
156     if (*info != 0) {
157 	i__1 = -(*info);
158 	xerbla_("CPBSV ", &i__1, (ftnlen)6);
159 	return 0;
160     }
161 
162 /*     Compute the Cholesky factorization A = U'*U or A = L*L'. */
163 
164     cpbtrf_(uplo, n, kd, &ab[ab_offset], ldab, info, (ftnlen)1);
165     if (*info == 0) {
166 
167 /*        Solve the system A*X = B, overwriting B with X. */
168 
169 	cpbtrs_(uplo, n, kd, nrhs, &ab[ab_offset], ldab, &b[b_offset], ldb,
170 		info, (ftnlen)1);
171 
172     }
173     return 0;
174 
175 /*     End of CPBSV */
176 
177 } /* cpbsv_ */
178 
179