zpttrs.c
Go to the documentation of this file.
00001 /* zpttrs.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 static integer c_n1 = -1;
00020 
00021 /* Subroutine */ int zpttrs_(char *uplo, integer *n, integer *nrhs, 
00022         doublereal *d__, doublecomplex *e, doublecomplex *b, integer *ldb, 
00023         integer *info)
00024 {
00025     /* System generated locals */
00026     integer b_dim1, b_offset, i__1, i__2, i__3;
00027 
00028     /* Local variables */
00029     integer j, jb, nb, iuplo;
00030     logical upper;
00031     extern /* Subroutine */ int zptts2_(integer *, integer *, integer *, 
00032             doublereal *, doublecomplex *, doublecomplex *, integer *), 
00033             xerbla_(char *, integer *);
00034     extern integer ilaenv_(integer *, char *, char *, integer *, integer *, 
00035             integer *, integer *);
00036 
00037 
00038 /*  -- LAPACK routine (version 3.2) -- */
00039 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00040 /*     November 2006 */
00041 
00042 /*     .. Scalar Arguments .. */
00043 /*     .. */
00044 /*     .. Array Arguments .. */
00045 /*     .. */
00046 
00047 /*  Purpose */
00048 /*  ======= */
00049 
00050 /*  ZPTTRS solves a tridiagonal system of the form */
00051 /*     A * X = B */
00052 /*  using the factorization A = U'*D*U or A = L*D*L' computed by ZPTTRF. */
00053 /*  D is a diagonal matrix specified in the vector D, U (or L) is a unit */
00054 /*  bidiagonal matrix whose superdiagonal (subdiagonal) is specified in */
00055 /*  the vector E, and X and B are N by NRHS matrices. */
00056 
00057 /*  Arguments */
00058 /*  ========= */
00059 
00060 /*  UPLO    (input) CHARACTER*1 */
00061 /*          Specifies the form of the factorization and whether the */
00062 /*          vector E is the superdiagonal of the upper bidiagonal factor */
00063 /*          U or the subdiagonal of the lower bidiagonal factor L. */
00064 /*          = 'U':  A = U'*D*U, E is the superdiagonal of U */
00065 /*          = 'L':  A = L*D*L', E is the subdiagonal of L */
00066 
00067 /*  N       (input) INTEGER */
00068 /*          The order of the tridiagonal matrix A.  N >= 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 /*  D       (input) DOUBLE PRECISION array, dimension (N) */
00075 /*          The n diagonal elements of the diagonal matrix D from the */
00076 /*          factorization A = U'*D*U or A = L*D*L'. */
00077 
00078 /*  E       (input) COMPLEX*16 array, dimension (N-1) */
00079 /*          If UPLO = 'U', the (n-1) superdiagonal elements of the unit */
00080 /*          bidiagonal factor U from the factorization A = U'*D*U. */
00081 /*          If UPLO = 'L', the (n-1) subdiagonal elements of the unit */
00082 /*          bidiagonal factor L from the factorization A = L*D*L'. */
00083 
00084 /*  B       (input/output) DOUBLE PRECISION array, dimension (LDB,NRHS) */
00085 /*          On entry, the right hand side vectors B for the system of */
00086 /*          linear equations. */
00087 /*          On exit, the solution vectors, X. */
00088 
00089 /*  LDB     (input) INTEGER */
00090 /*          The leading dimension of the array B.  LDB >= max(1,N). */
00091 
00092 /*  INFO    (output) INTEGER */
00093 /*          = 0: successful exit */
00094 /*          < 0: if INFO = -k, the k-th argument had an illegal value */
00095 
00096 /*  ===================================================================== */
00097 
00098 /*     .. Local Scalars .. */
00099 /*     .. */
00100 /*     .. External Functions .. */
00101 /*     .. */
00102 /*     .. External Subroutines .. */
00103 /*     .. */
00104 /*     .. Intrinsic Functions .. */
00105 /*     .. */
00106 /*     .. Executable Statements .. */
00107 
00108 /*     Test the input arguments. */
00109 
00110     /* Parameter adjustments */
00111     --d__;
00112     --e;
00113     b_dim1 = *ldb;
00114     b_offset = 1 + b_dim1;
00115     b -= b_offset;
00116 
00117     /* Function Body */
00118     *info = 0;
00119     upper = *(unsigned char *)uplo == 'U' || *(unsigned char *)uplo == 'u';
00120     if (! upper && ! (*(unsigned char *)uplo == 'L' || *(unsigned char *)uplo 
00121             == 'l')) {
00122         *info = -1;
00123     } else if (*n < 0) {
00124         *info = -2;
00125     } else if (*nrhs < 0) {
00126         *info = -3;
00127     } else if (*ldb < max(1,*n)) {
00128         *info = -7;
00129     }
00130     if (*info != 0) {
00131         i__1 = -(*info);
00132         xerbla_("ZPTTRS", &i__1);
00133         return 0;
00134     }
00135 
00136 /*     Quick return if possible */
00137 
00138     if (*n == 0 || *nrhs == 0) {
00139         return 0;
00140     }
00141 
00142 /*     Determine the number of right-hand sides to solve at a time. */
00143 
00144     if (*nrhs == 1) {
00145         nb = 1;
00146     } else {
00147 /* Computing MAX */
00148         i__1 = 1, i__2 = ilaenv_(&c__1, "ZPTTRS", uplo, n, nrhs, &c_n1, &c_n1);
00149         nb = max(i__1,i__2);
00150     }
00151 
00152 /*     Decode UPLO */
00153 
00154     if (upper) {
00155         iuplo = 1;
00156     } else {
00157         iuplo = 0;
00158     }
00159 
00160     if (nb >= *nrhs) {
00161         zptts2_(&iuplo, n, nrhs, &d__[1], &e[1], &b[b_offset], ldb);
00162     } else {
00163         i__1 = *nrhs;
00164         i__2 = nb;
00165         for (j = 1; i__2 < 0 ? j >= i__1 : j <= i__1; j += i__2) {
00166 /* Computing MIN */
00167             i__3 = *nrhs - j + 1;
00168             jb = min(i__3,nb);
00169             zptts2_(&iuplo, n, &jb, &d__[1], &e[1], &b[j * b_dim1 + 1], ldb);
00170 /* L10: */
00171         }
00172     }
00173 
00174     return 0;
00175 
00176 /*     End of ZPTTRS */
00177 
00178 } /* zpttrs_ */


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