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


swiftnav
Author(s):
autogenerated on Sat Jun 8 2019 18:56:42