zgttrs.c
Go to the documentation of this file.
00001 /* zgttrs.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 zgttrs_(char *trans, integer *n, integer *nrhs, 
00022         doublecomplex *dl, doublecomplex *d__, doublecomplex *du, 
00023         doublecomplex *du2, integer *ipiv, doublecomplex *b, integer *ldb, 
00024         integer *info)
00025 {
00026     /* System generated locals */
00027     integer b_dim1, b_offset, i__1, i__2, i__3;
00028 
00029     /* Local variables */
00030     integer j, jb, nb;
00031     extern /* Subroutine */ int zgtts2_(integer *, integer *, integer *, 
00032             doublecomplex *, doublecomplex *, doublecomplex *, doublecomplex *
00033 , integer *, doublecomplex *, integer *), xerbla_(char *, integer 
00034             *);
00035     extern integer ilaenv_(integer *, char *, char *, integer *, integer *, 
00036             integer *, integer *);
00037     integer itrans;
00038     logical notran;
00039 
00040 
00041 /*  -- LAPACK routine (version 3.2) -- */
00042 /*     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
00043 /*     November 2006 */
00044 
00045 /*     .. Scalar Arguments .. */
00046 /*     .. */
00047 /*     .. Array Arguments .. */
00048 /*     .. */
00049 
00050 /*  Purpose */
00051 /*  ======= */
00052 
00053 /*  ZGTTRS solves one of the systems of equations */
00054 /*     A * X = B,  A**T * X = B,  or  A**H * X = B, */
00055 /*  with a tridiagonal matrix A using the LU factorization computed */
00056 /*  by ZGTTRF. */
00057 
00058 /*  Arguments */
00059 /*  ========= */
00060 
00061 /*  TRANS   (input) CHARACTER*1 */
00062 /*          Specifies the form of the system of equations. */
00063 /*          = 'N':  A * X = B     (No transpose) */
00064 /*          = 'T':  A**T * X = B  (Transpose) */
00065 /*          = 'C':  A**H * X = B  (Conjugate transpose) */
00066 
00067 /*  N       (input) INTEGER */
00068 /*          The order of the matrix A. */
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 /*  DL      (input) COMPLEX*16 array, dimension (N-1) */
00075 /*          The (n-1) multipliers that define the matrix L from the */
00076 /*          LU factorization of A. */
00077 
00078 /*  D       (input) COMPLEX*16 array, dimension (N) */
00079 /*          The n diagonal elements of the upper triangular matrix U from */
00080 /*          the LU factorization of A. */
00081 
00082 /*  DU      (input) COMPLEX*16 array, dimension (N-1) */
00083 /*          The (n-1) elements of the first super-diagonal of U. */
00084 
00085 /*  DU2     (input) COMPLEX*16 array, dimension (N-2) */
00086 /*          The (n-2) elements of the second super-diagonal of U. */
00087 
00088 /*  IPIV    (input) INTEGER array, dimension (N) */
00089 /*          The pivot indices; for 1 <= i <= n, row i of the matrix was */
00090 /*          interchanged with row IPIV(i).  IPIV(i) will always be either */
00091 /*          i or i+1; IPIV(i) = i indicates a row interchange was not */
00092 /*          required. */
00093 
00094 /*  B       (input/output) COMPLEX*16 array, dimension (LDB,NRHS) */
00095 /*          On entry, the matrix of right hand side vectors B. */
00096 /*          On exit, B is overwritten by the solution vectors X. */
00097 
00098 /*  LDB     (input) INTEGER */
00099 /*          The leading dimension of the array B.  LDB >= max(1,N). */
00100 
00101 /*  INFO    (output) INTEGER */
00102 /*          = 0:  successful exit */
00103 /*          < 0:  if INFO = -k, the k-th argument had an illegal value */
00104 
00105 /*  ===================================================================== */
00106 
00107 /*     .. Local Scalars .. */
00108 /*     .. */
00109 /*     .. External Functions .. */
00110 /*     .. */
00111 /*     .. External Subroutines .. */
00112 /*     .. */
00113 /*     .. Intrinsic Functions .. */
00114 /*     .. */
00115 /*     .. Executable Statements .. */
00116 
00117     /* Parameter adjustments */
00118     --dl;
00119     --d__;
00120     --du;
00121     --du2;
00122     --ipiv;
00123     b_dim1 = *ldb;
00124     b_offset = 1 + b_dim1;
00125     b -= b_offset;
00126 
00127     /* Function Body */
00128     *info = 0;
00129     notran = *(unsigned char *)trans == 'N' || *(unsigned char *)trans == 'n';
00130     if (! notran && ! (*(unsigned char *)trans == 'T' || *(unsigned char *)
00131             trans == 't') && ! (*(unsigned char *)trans == 'C' || *(unsigned 
00132             char *)trans == 'c')) {
00133         *info = -1;
00134     } else if (*n < 0) {
00135         *info = -2;
00136     } else if (*nrhs < 0) {
00137         *info = -3;
00138     } else if (*ldb < max(*n,1)) {
00139         *info = -10;
00140     }
00141     if (*info != 0) {
00142         i__1 = -(*info);
00143         xerbla_("ZGTTRS", &i__1);
00144         return 0;
00145     }
00146 
00147 /*     Quick return if possible */
00148 
00149     if (*n == 0 || *nrhs == 0) {
00150         return 0;
00151     }
00152 
00153 /*     Decode TRANS */
00154 
00155     if (notran) {
00156         itrans = 0;
00157     } else if (*(unsigned char *)trans == 'T' || *(unsigned char *)trans == 
00158             't') {
00159         itrans = 1;
00160     } else {
00161         itrans = 2;
00162     }
00163 
00164 /*     Determine the number of right-hand sides to solve at a time. */
00165 
00166     if (*nrhs == 1) {
00167         nb = 1;
00168     } else {
00169 /* Computing MAX */
00170         i__1 = 1, i__2 = ilaenv_(&c__1, "ZGTTRS", trans, n, nrhs, &c_n1, &
00171                 c_n1);
00172         nb = max(i__1,i__2);
00173     }
00174 
00175     if (nb >= *nrhs) {
00176         zgtts2_(&itrans, n, nrhs, &dl[1], &d__[1], &du[1], &du2[1], &ipiv[1], 
00177                 &b[b_offset], ldb);
00178     } else {
00179         i__1 = *nrhs;
00180         i__2 = nb;
00181         for (j = 1; i__2 < 0 ? j >= i__1 : j <= i__1; j += i__2) {
00182 /* Computing MIN */
00183             i__3 = *nrhs - j + 1;
00184             jb = min(i__3,nb);
00185             zgtts2_(&itrans, n, &jb, &dl[1], &d__[1], &du[1], &du2[1], &ipiv[
00186                     1], &b[j * b_dim1 + 1], ldb);
00187 /* L10: */
00188         }
00189     }
00190 
00191 /*     End of ZGTTRS */
00192 
00193     return 0;
00194 } /* zgttrs_ */


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