Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages | Examples

dgetrs.c

Go to the documentation of this file.
00001 /* DGETRS.F -- translated by f2c (version 19941215).
00002    You must link the resulting object file with the libraries:
00003         -lf2c -lm   (in that order)
00004 */
00005 
00006 #include "f2c.h"
00007 
00008 /* Table of constant values */
00009 
00010 static integer c__1 = 1;
00011 static doublereal c_b12 = 1.;
00012 static integer c_n1 = -1;
00013 
00014 /* Subroutine */ int dgetrs_(trans, n, nrhs, a, lda, ipiv, b, ldb, info, 
00015         trans_len)
00016 char *trans;
00017 integer *n, *nrhs;
00018 doublereal *a;
00019 integer *lda, *ipiv;
00020 doublereal *b;
00021 integer *ldb, *info;
00022 ftnlen trans_len;
00023 {
00024     /* System generated locals */
00025     integer a_dim1, a_offset, b_dim1, b_offset, i__1;
00026 
00027     /* Local variables */
00028     extern logical lsame_();
00029     extern /* Subroutine */ int dtrsm_(), xerbla_(), dlaswp_();
00030     static logical notran;
00031 
00032 
00033 /*  -- LAPACK routine (version 1.1) -- */
00034 /*     Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd., */
00035 /*     Courant Institute, Argonne National Lab, and Rice University */
00036 /*     March 31, 1993 */
00037 
00038 /*     .. Scalar Arguments .. */
00039 /*     .. */
00040 /*     .. Array Arguments .. */
00041 /*     .. */
00042 
00043 /*  Purpose */
00044 /*  ======= */
00045 
00046 /*  DGETRS solves a system of linear equations */
00047 /*     A * X = B  or  A' * X = B */
00048 /*  with a general N-by-N matrix A using the LU factorization computed */
00049 /*  by DGETRF. */
00050 
00051 /*  Arguments */
00052 /*  ========= */
00053 
00054 /*  TRANS   (input) CHARACTER*1 */
00055 /*          Specifies the form of the system of equations: */
00056 /*          = 'N':  A * X = B  (No transpose) */
00057 /*          = 'T':  A'* X = B  (Transpose) */
00058 /*          = 'C':  A'* X = B  (Conjugate transpose = Transpose) */
00059 
00060 /*  N       (input) INTEGER */
00061 /*          The order of the matrix A.  N >= 0. */
00062 
00063 /*  NRHS    (input) INTEGER */
00064 /*          The number of right hand sides, i.e., the number of columns */
00065 /*          of the matrix B.  NRHS >= 0. */
00066 
00067 /*  A       (input) DOUBLE PRECISION array, dimension (LDA,N) */
00068 /*          The factors L and U from the factorization A = P*L*U */
00069 /*          as computed by DGETRF. */
00070 
00071 /*  LDA     (input) INTEGER */
00072 /*          The leading dimension of the array A.  LDA >= max(1,N). */
00073 
00074 /*  IPIV    (input) INTEGER array, dimension (N) */
00075 /*          The pivot indices from DGETRF; for 1<=i<=N, row i of the */
00076 /*          matrix was interchanged with row IPIV(i). */
00077 
00078 /*  B       (input/output) DOUBLE PRECISION array, dimension (LDB,NRHS) */
00079 /*          On entry, the right hand side matrix B. */
00080 /*          On exit, the solution matrix X. */
00081 
00082 /*  LDB     (input) INTEGER */
00083 /*          The leading dimension of the array B.  LDB >= max(1,N). */
00084 
00085 /*  INFO    (output) INTEGER */
00086 /*          = 0:  successful exit */
00087 /*          < 0:  if INFO = -i, the i-th argument had an illegal value */
00088 
00089 /*  ===================================================================== 
00090 */
00091 
00092 /*     .. Parameters .. */
00093 /*     .. */
00094 /*     .. Local Scalars .. */
00095 /*     .. */
00096 /*     .. External Functions .. */
00097 /*     .. */
00098 /*     .. External Subroutines .. */
00099 /*     .. */
00100 /*     .. Intrinsic Functions .. */
00101 /*     .. */
00102 /*     .. Executable Statements .. */
00103 
00104 /*     Test the input parameters. */
00105 
00106     /* Parameter adjustments */
00107     a_dim1 = *lda;
00108     a_offset = a_dim1 + 1;
00109     a -= a_offset;
00110     --ipiv;
00111     b_dim1 = *ldb;
00112     b_offset = b_dim1 + 1;
00113     b -= b_offset;
00114 
00115     /* Function Body */
00116     *info = 0;
00117     notran = lsame_(trans, "N", 1L, 1L);
00118     if (! notran && ! lsame_(trans, "T", 1L, 1L) && ! lsame_(trans, "C", 1L, 
00119             1L)) {
00120         *info = -1;
00121     } else if (*n < 0) {
00122         *info = -2;
00123     } else if (*nrhs < 0) {
00124         *info = -3;
00125     } else if (*lda < max(1,*n)) {
00126         *info = -5;
00127     } else if (*ldb < max(1,*n)) {
00128         *info = -8;
00129     }
00130     if (*info != 0) {
00131         i__1 = -(*info);
00132         xerbla_("DGETRS", &i__1, 6L);
00133         return 0;
00134     }
00135 
00136 /*     Quick return if possible */
00137 
00138     if (*n == 0 || *nrhs == 0) {
00139         return 0;
00140     }
00141 
00142     if (notran) {
00143 
00144 /*        Solve A * X = B. */
00145 
00146 /*        Apply row interchanges to the right hand sides. */
00147 
00148         dlaswp_(nrhs, &b[b_offset], ldb, &c__1, n, &ipiv[1], &c__1);
00149 
00150 /*        Solve L*X = B, overwriting B with X. */
00151 
00152         dtrsm_("Left", "Lower", "No transpose", "Unit", n, nrhs, &c_b12, &a[
00153                 a_offset], lda, &b[b_offset], ldb, 4L, 5L, 12L, 4L);
00154 
00155 /*        Solve U*X = B, overwriting B with X. */
00156 
00157         dtrsm_("Left", "Upper", "No transpose", "Non-unit", n, nrhs, &c_b12, &
00158                 a[a_offset], lda, &b[b_offset], ldb, 4L, 5L, 12L, 8L);
00159     } else {
00160 
00161 /*        Solve A' * X = B. */
00162 
00163 /*        Solve U'*X = B, overwriting B with X. */
00164 
00165         dtrsm_("Left", "Upper", "Transpose", "Non-unit", n, nrhs, &c_b12, &a[
00166                 a_offset], lda, &b[b_offset], ldb, 4L, 5L, 9L, 8L);
00167 
00168 /*        Solve L'*X = B, overwriting B with X. */
00169 
00170         dtrsm_("Left", "Lower", "Transpose", "Unit", n, nrhs, &c_b12, &a[
00171                 a_offset], lda, &b[b_offset], ldb, 4L, 5L, 9L, 4L);
00172 
00173 /*        Apply row interchanges to the solution vectors. */
00174 
00175         dlaswp_(nrhs, &b[b_offset], ldb, &c__1, n, &ipiv[1], &c_n1);
00176     }
00177 
00178     return 0;
00179 
00180 /*     End of DGETRS */
00181 
00182 } /* dgetrs_ */
00183 

Generated on Wed Sep 5 12:54:19 2007 for DSACSS Operational Code by  doxygen 1.3.9.1