cpbsv.c
Go to the documentation of this file.
00001 /* cpbsv.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 /* Subroutine */ int cpbsv_(char *uplo, integer *n, integer *kd, integer *
00017         nrhs, complex *ab, integer *ldab, complex *b, integer *ldb, integer *
00018         info)
00019 {
00020     /* System generated locals */
00021     integer ab_dim1, ab_offset, b_dim1, b_offset, i__1;
00022 
00023     /* Local variables */
00024     extern logical lsame_(char *, char *);
00025     extern /* Subroutine */ int xerbla_(char *, integer *), cpbtrf_(
00026             char *, integer *, integer *, complex *, integer *, integer *), cpbtrs_(char *, integer *, integer *, integer *, complex 
00027             *, integer *, complex *, integer *, integer *);
00028 
00029 
00030 /*  -- LAPACK driver routine (version 3.2) -- */
00031 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00032 /*     November 2006 */
00033 
00034 /*     .. Scalar Arguments .. */
00035 /*     .. */
00036 /*     .. Array Arguments .. */
00037 /*     .. */
00038 
00039 /*  Purpose */
00040 /*  ======= */
00041 
00042 /*  CPBSV computes the solution to a complex system of linear equations */
00043 /*     A * X = B, */
00044 /*  where A is an N-by-N Hermitian positive definite band matrix and X */
00045 /*  and B are N-by-NRHS matrices. */
00046 
00047 /*  The Cholesky decomposition is used to factor A as */
00048 /*     A = U**H * U,  if UPLO = 'U', or */
00049 /*     A = L * L**H,  if UPLO = 'L', */
00050 /*  where U is an upper triangular band matrix, and L is a lower */
00051 /*  triangular band matrix, with the same number of superdiagonals or */
00052 /*  subdiagonals as A.  The factored form of A is then used to solve the */
00053 /*  system of equations A * X = B. */
00054 
00055 /*  Arguments */
00056 /*  ========= */
00057 
00058 /*  UPLO    (input) CHARACTER*1 */
00059 /*          = 'U':  Upper triangle of A is stored; */
00060 /*          = 'L':  Lower triangle of A is stored. */
00061 
00062 /*  N       (input) INTEGER */
00063 /*          The number of linear equations, i.e., the order of the */
00064 /*          matrix A.  N >= 0. */
00065 
00066 /*  KD      (input) INTEGER */
00067 /*          The number of superdiagonals of the matrix A if UPLO = 'U', */
00068 /*          or the number of subdiagonals if UPLO = 'L'.  KD >= 0. */
00069 
00070 /*  NRHS    (input) INTEGER */
00071 /*          The number of right hand sides, i.e., the number of columns */
00072 /*          of the matrix B.  NRHS >= 0. */
00073 
00074 /*  AB      (input/output) COMPLEX array, dimension (LDAB,N) */
00075 /*          On entry, the upper or lower triangle of the Hermitian band */
00076 /*          matrix A, stored in the first KD+1 rows of the array.  The */
00077 /*          j-th column of A is stored in the j-th column of the array AB */
00078 /*          as follows: */
00079 /*          if UPLO = 'U', AB(KD+1+i-j,j) = A(i,j) for max(1,j-KD)<=i<=j; */
00080 /*          if UPLO = 'L', AB(1+i-j,j)    = A(i,j) for j<=i<=min(N,j+KD). */
00081 /*          See below for further details. */
00082 
00083 /*          On exit, if INFO = 0, the triangular factor U or L from the */
00084 /*          Cholesky factorization A = U**H*U or A = L*L**H of the band */
00085 /*          matrix A, in the same storage format as A. */
00086 
00087 /*  LDAB    (input) INTEGER */
00088 /*          The leading dimension of the array AB.  LDAB >= KD+1. */
00089 
00090 /*  B       (input/output) COMPLEX array, dimension (LDB,NRHS) */
00091 /*          On entry, the N-by-NRHS right hand side matrix B. */
00092 /*          On exit, if INFO = 0, the N-by-NRHS solution matrix X. */
00093 
00094 /*  LDB     (input) INTEGER */
00095 /*          The leading dimension of the array B.  LDB >= max(1,N). */
00096 
00097 /*  INFO    (output) INTEGER */
00098 /*          = 0:  successful exit */
00099 /*          < 0:  if INFO = -i, the i-th argument had an illegal value */
00100 /*          > 0:  if INFO = i, the leading minor of order i of A is not */
00101 /*                positive definite, so the factorization could not be */
00102 /*                completed, and the solution has not been computed. */
00103 
00104 /*  Further Details */
00105 /*  =============== */
00106 
00107 /*  The band storage scheme is illustrated by the following example, when */
00108 /*  N = 6, KD = 2, and UPLO = 'U': */
00109 
00110 /*  On entry:                       On exit: */
00111 
00112 /*      *    *   a13  a24  a35  a46      *    *   u13  u24  u35  u46 */
00113 /*      *   a12  a23  a34  a45  a56      *   u12  u23  u34  u45  u56 */
00114 /*     a11  a22  a33  a44  a55  a66     u11  u22  u33  u44  u55  u66 */
00115 
00116 /*  Similarly, if UPLO = 'L' the format of A is as follows: */
00117 
00118 /*  On entry:                       On exit: */
00119 
00120 /*     a11  a22  a33  a44  a55  a66     l11  l22  l33  l44  l55  l66 */
00121 /*     a21  a32  a43  a54  a65   *      l21  l32  l43  l54  l65   * */
00122 /*     a31  a42  a53  a64   *    *      l31  l42  l53  l64   *    * */
00123 
00124 /*  Array elements marked * are not used by the routine. */
00125 
00126 /*  ===================================================================== */
00127 
00128 /*     .. External Functions .. */
00129 /*     .. */
00130 /*     .. External Subroutines .. */
00131 /*     .. */
00132 /*     .. Intrinsic Functions .. */
00133 /*     .. */
00134 /*     .. Executable Statements .. */
00135 
00136 /*     Test the input parameters. */
00137 
00138     /* Parameter adjustments */
00139     ab_dim1 = *ldab;
00140     ab_offset = 1 + ab_dim1;
00141     ab -= ab_offset;
00142     b_dim1 = *ldb;
00143     b_offset = 1 + b_dim1;
00144     b -= b_offset;
00145 
00146     /* Function Body */
00147     *info = 0;
00148     if (! lsame_(uplo, "U") && ! lsame_(uplo, "L")) {
00149         *info = -1;
00150     } else if (*n < 0) {
00151         *info = -2;
00152     } else if (*kd < 0) {
00153         *info = -3;
00154     } else if (*nrhs < 0) {
00155         *info = -4;
00156     } else if (*ldab < *kd + 1) {
00157         *info = -6;
00158     } else if (*ldb < max(1,*n)) {
00159         *info = -8;
00160     }
00161     if (*info != 0) {
00162         i__1 = -(*info);
00163         xerbla_("CPBSV ", &i__1);
00164         return 0;
00165     }
00166 
00167 /*     Compute the Cholesky factorization A = U'*U or A = L*L'. */
00168 
00169     cpbtrf_(uplo, n, kd, &ab[ab_offset], ldab, info);
00170     if (*info == 0) {
00171 
00172 /*        Solve the system A*X = B, overwriting B with X. */
00173 
00174         cpbtrs_(uplo, n, kd, nrhs, &ab[ab_offset], ldab, &b[b_offset], ldb, 
00175                 info);
00176 
00177     }
00178     return 0;
00179 
00180 /*     End of CPBSV */
00181 
00182 } /* cpbsv_ */


swiftnav
Author(s):
autogenerated on Sat Jun 8 2019 18:55:32