dptsv.c
Go to the documentation of this file.
00001 /* dptsv.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 dptsv_(integer *n, integer *nrhs, doublereal *d__, 
00017         doublereal *e, doublereal *b, integer *ldb, integer *info)
00018 {
00019     /* System generated locals */
00020     integer b_dim1, b_offset, i__1;
00021 
00022     /* Local variables */
00023     extern /* Subroutine */ int xerbla_(char *, integer *), dpttrf_(
00024             integer *, doublereal *, doublereal *, integer *), dpttrs_(
00025             integer *, integer *, doublereal *, doublereal *, doublereal *, 
00026             integer *, 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 /*  DPTSV computes the solution to a real system of linear equations */
00042 /*  A*X = B, where A is an N-by-N symmetric positive definite tridiagonal */
00043 /*  matrix, and X and B are N-by-NRHS matrices. */
00044 
00045 /*  A is factored as A = L*D*L**T, and the factored form of A is then */
00046 /*  used to solve the system of equations. */
00047 
00048 /*  Arguments */
00049 /*  ========= */
00050 
00051 /*  N       (input) INTEGER */
00052 /*          The order of the 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/output) DOUBLE PRECISION array, dimension (N) */
00059 /*          On entry, the n diagonal elements of the tridiagonal matrix */
00060 /*          A.  On exit, the n diagonal elements of the diagonal matrix */
00061 /*          D from the factorization A = L*D*L**T. */
00062 
00063 /*  E       (input/output) DOUBLE PRECISION array, dimension (N-1) */
00064 /*          On entry, the (n-1) subdiagonal elements of the tridiagonal */
00065 /*          matrix A.  On exit, the (n-1) subdiagonal elements of the */
00066 /*          unit bidiagonal factor L from the L*D*L**T factorization of */
00067 /*          A.  (E can also be regarded as the superdiagonal of the unit */
00068 /*          bidiagonal factor U from the U**T*D*U factorization of A.) */
00069 
00070 /*  B       (input/output) DOUBLE PRECISION array, dimension (LDB,NRHS) */
00071 /*          On entry, the N-by-NRHS right hand side matrix B. */
00072 /*          On exit, if INFO = 0, the N-by-NRHS solution matrix X. */
00073 
00074 /*  LDB     (input) INTEGER */
00075 /*          The leading dimension of the array B.  LDB >= max(1,N). */
00076 
00077 /*  INFO    (output) INTEGER */
00078 /*          = 0:  successful exit */
00079 /*          < 0:  if INFO = -i, the i-th argument had an illegal value */
00080 /*          > 0:  if INFO = i, the leading minor of order i is not */
00081 /*                positive definite, and the solution has not been */
00082 /*                computed.  The factorization has not been completed */
00083 /*                unless i = N. */
00084 
00085 /*  ===================================================================== */
00086 
00087 /*     .. External Subroutines .. */
00088 /*     .. */
00089 /*     .. Intrinsic Functions .. */
00090 /*     .. */
00091 /*     .. Executable Statements .. */
00092 
00093 /*     Test the input parameters. */
00094 
00095     /* Parameter adjustments */
00096     --d__;
00097     --e;
00098     b_dim1 = *ldb;
00099     b_offset = 1 + b_dim1;
00100     b -= b_offset;
00101 
00102     /* Function Body */
00103     *info = 0;
00104     if (*n < 0) {
00105         *info = -1;
00106     } else if (*nrhs < 0) {
00107         *info = -2;
00108     } else if (*ldb < max(1,*n)) {
00109         *info = -6;
00110     }
00111     if (*info != 0) {
00112         i__1 = -(*info);
00113         xerbla_("DPTSV ", &i__1);
00114         return 0;
00115     }
00116 
00117 /*     Compute the L*D*L' (or U'*D*U) factorization of A. */
00118 
00119     dpttrf_(n, &d__[1], &e[1], info);
00120     if (*info == 0) {
00121 
00122 /*        Solve the system A*X = B, overwriting B with X. */
00123 
00124         dpttrs_(n, nrhs, &d__[1], &e[1], &b[b_offset], ldb, info);
00125     }
00126     return 0;
00127 
00128 /*     End of DPTSV */
00129 
00130 } /* dptsv_ */


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