spttrs.c
Go to the documentation of this file.
00001 /* spttrs.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 spttrs_(integer *n, integer *nrhs, real *d__, real *e, 
00022         real *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;
00029     extern /* Subroutine */ int sptts2_(integer *, integer *, real *, real *, 
00030             real *, integer *), xerbla_(char *, integer *);
00031     extern integer ilaenv_(integer *, char *, char *, integer *, integer *, 
00032             integer *, integer *);
00033 
00034 
00035 /*  -- LAPACK routine (version 3.2) -- */
00036 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00037 /*     November 2006 */
00038 
00039 /*     .. Scalar Arguments .. */
00040 /*     .. */
00041 /*     .. Array Arguments .. */
00042 /*     .. */
00043 
00044 /*  Purpose */
00045 /*  ======= */
00046 
00047 /*  SPTTRS solves a tridiagonal system of the form */
00048 /*     A * X = B */
00049 /*  using the L*D*L' factorization of A computed by SPTTRF.  D is a */
00050 /*  diagonal matrix specified in the vector D, L is a unit bidiagonal */
00051 /*  matrix whose subdiagonal is specified in the vector E, and X and B */
00052 /*  are N by NRHS matrices. */
00053 
00054 /*  Arguments */
00055 /*  ========= */
00056 
00057 /*  N       (input) INTEGER */
00058 /*          The order of the tridiagonal matrix A.  N >= 0. */
00059 
00060 /*  NRHS    (input) INTEGER */
00061 /*          The number of right hand sides, i.e., the number of columns */
00062 /*          of the matrix B.  NRHS >= 0. */
00063 
00064 /*  D       (input) REAL array, dimension (N) */
00065 /*          The n diagonal elements of the diagonal matrix D from the */
00066 /*          L*D*L' factorization of A. */
00067 
00068 /*  E       (input) REAL array, dimension (N-1) */
00069 /*          The (n-1) subdiagonal elements of the unit bidiagonal factor */
00070 /*          L from the L*D*L' factorization of A.  E can also be regarded */
00071 /*          as the superdiagonal of the unit bidiagonal factor U from the */
00072 /*          factorization A = U'*D*U. */
00073 
00074 /*  B       (input/output) REAL array, dimension (LDB,NRHS) */
00075 /*          On entry, the right hand side vectors B for the system of */
00076 /*          linear equations. */
00077 /*          On exit, the solution vectors, X. */
00078 
00079 /*  LDB     (input) INTEGER */
00080 /*          The leading dimension of the array B.  LDB >= max(1,N). */
00081 
00082 /*  INFO    (output) INTEGER */
00083 /*          = 0: successful exit */
00084 /*          < 0: if INFO = -k, the k-th argument had an illegal value */
00085 
00086 /*  ===================================================================== */
00087 
00088 /*     .. Local Scalars .. */
00089 /*     .. */
00090 /*     .. External Functions .. */
00091 /*     .. */
00092 /*     .. External Subroutines .. */
00093 /*     .. */
00094 /*     .. Intrinsic Functions .. */
00095 /*     .. */
00096 /*     .. Executable Statements .. */
00097 
00098 /*     Test the input arguments. */
00099 
00100     /* Parameter adjustments */
00101     --d__;
00102     --e;
00103     b_dim1 = *ldb;
00104     b_offset = 1 + b_dim1;
00105     b -= b_offset;
00106 
00107     /* Function Body */
00108     *info = 0;
00109     if (*n < 0) {
00110         *info = -1;
00111     } else if (*nrhs < 0) {
00112         *info = -2;
00113     } else if (*ldb < max(1,*n)) {
00114         *info = -6;
00115     }
00116     if (*info != 0) {
00117         i__1 = -(*info);
00118         xerbla_("SPTTRS", &i__1);
00119         return 0;
00120     }
00121 
00122 /*     Quick return if possible */
00123 
00124     if (*n == 0 || *nrhs == 0) {
00125         return 0;
00126     }
00127 
00128 /*     Determine the number of right-hand sides to solve at a time. */
00129 
00130     if (*nrhs == 1) {
00131         nb = 1;
00132     } else {
00133 /* Computing MAX */
00134         i__1 = 1, i__2 = ilaenv_(&c__1, "SPTTRS", " ", n, nrhs, &c_n1, &c_n1);
00135         nb = max(i__1,i__2);
00136     }
00137 
00138     if (nb >= *nrhs) {
00139         sptts2_(n, nrhs, &d__[1], &e[1], &b[b_offset], ldb);
00140     } else {
00141         i__1 = *nrhs;
00142         i__2 = nb;
00143         for (j = 1; i__2 < 0 ? j >= i__1 : j <= i__1; j += i__2) {
00144 /* Computing MIN */
00145             i__3 = *nrhs - j + 1;
00146             jb = min(i__3,nb);
00147             sptts2_(n, &jb, &d__[1], &e[1], &b[j * b_dim1 + 1], ldb);
00148 /* L10: */
00149         }
00150     }
00151 
00152     return 0;
00153 
00154 /*     End of SPTTRS */
00155 
00156 } /* spttrs_ */


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