dptts2.c
Go to the documentation of this file.
00001 /* dptts2.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 dptts2_(integer *n, integer *nrhs, doublereal *d__, 
00017         doublereal *e, doublereal *b, integer *ldb)
00018 {
00019     /* System generated locals */
00020     integer b_dim1, b_offset, i__1, i__2;
00021     doublereal d__1;
00022 
00023     /* Local variables */
00024     integer i__, j;
00025     extern /* Subroutine */ int dscal_(integer *, doublereal *, doublereal *, 
00026             integer *);
00027 
00028 
00029 /*  -- LAPACK routine (version 3.2) -- */
00030 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00031 /*     November 2006 */
00032 
00033 /*     .. Scalar Arguments .. */
00034 /*     .. */
00035 /*     .. Array Arguments .. */
00036 /*     .. */
00037 
00038 /*  Purpose */
00039 /*  ======= */
00040 
00041 /*  DPTTS2 solves a tridiagonal system of the form */
00042 /*     A * X = B */
00043 /*  using the L*D*L' factorization of A computed by DPTTRF.  D is a */
00044 /*  diagonal matrix specified in the vector D, L is a unit bidiagonal */
00045 /*  matrix whose subdiagonal is specified in the vector E, and X and B */
00046 /*  are N by NRHS matrices. */
00047 
00048 /*  Arguments */
00049 /*  ========= */
00050 
00051 /*  N       (input) INTEGER */
00052 /*          The order of the tridiagonal matrix A.  N >= 0. */
00053 
00054 /*  NRHS    (input) INTEGER */
00055 /*          The number of right hand sides, i.e., the number of columns */
00056 /*          of the matrix B.  NRHS >= 0. */
00057 
00058 /*  D       (input) DOUBLE PRECISION array, dimension (N) */
00059 /*          The n diagonal elements of the diagonal matrix D from the */
00060 /*          L*D*L' factorization of A. */
00061 
00062 /*  E       (input) DOUBLE PRECISION array, dimension (N-1) */
00063 /*          The (n-1) subdiagonal elements of the unit bidiagonal factor */
00064 /*          L from the L*D*L' factorization of A.  E can also be regarded */
00065 /*          as the superdiagonal of the unit bidiagonal factor U from the */
00066 /*          factorization A = U'*D*U. */
00067 
00068 /*  B       (input/output) DOUBLE PRECISION array, dimension (LDB,NRHS) */
00069 /*          On entry, the right hand side vectors B for the system of */
00070 /*          linear equations. */
00071 /*          On exit, the solution vectors, X. */
00072 
00073 /*  LDB     (input) INTEGER */
00074 /*          The leading dimension of the array B.  LDB >= max(1,N). */
00075 
00076 /*  ===================================================================== */
00077 
00078 /*     .. Local Scalars .. */
00079 /*     .. */
00080 /*     .. External Subroutines .. */
00081 /*     .. */
00082 /*     .. Executable Statements .. */
00083 
00084 /*     Quick return if possible */
00085 
00086     /* Parameter adjustments */
00087     --d__;
00088     --e;
00089     b_dim1 = *ldb;
00090     b_offset = 1 + b_dim1;
00091     b -= b_offset;
00092 
00093     /* Function Body */
00094     if (*n <= 1) {
00095         if (*n == 1) {
00096             d__1 = 1. / d__[1];
00097             dscal_(nrhs, &d__1, &b[b_offset], ldb);
00098         }
00099         return 0;
00100     }
00101 
00102 /*     Solve A * X = B using the factorization A = L*D*L', */
00103 /*     overwriting each right hand side vector with its solution. */
00104 
00105     i__1 = *nrhs;
00106     for (j = 1; j <= i__1; ++j) {
00107 
00108 /*           Solve L * x = b. */
00109 
00110         i__2 = *n;
00111         for (i__ = 2; i__ <= i__2; ++i__) {
00112             b[i__ + j * b_dim1] -= b[i__ - 1 + j * b_dim1] * e[i__ - 1];
00113 /* L10: */
00114         }
00115 
00116 /*           Solve D * L' * x = b. */
00117 
00118         b[*n + j * b_dim1] /= d__[*n];
00119         for (i__ = *n - 1; i__ >= 1; --i__) {
00120             b[i__ + j * b_dim1] = b[i__ + j * b_dim1] / d__[i__] - b[i__ + 1 
00121                     + j * b_dim1] * e[i__];
00122 /* L20: */
00123         }
00124 /* L30: */
00125     }
00126 
00127     return 0;
00128 
00129 /*     End of DPTTS2 */
00130 
00131 } /* dptts2_ */


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