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


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