strtrs.c
Go to the documentation of this file.
00001 /* strtrs.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 real c_b12 = 1.f;
00019 
00020 /* Subroutine */ int strtrs_(char *uplo, char *trans, char *diag, integer *n, 
00021         integer *nrhs, real *a, integer *lda, real *b, integer *ldb, integer *
00022         info)
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_(char *, char *);
00029     extern /* Subroutine */ int strsm_(char *, char *, char *, char *, 
00030             integer *, integer *, real *, real *, integer *, real *, integer *
00031 ), xerbla_(char *, integer *);
00032     logical nounit;
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 /*  STRTRS solves a triangular system of the form */
00048 
00049 /*     A * X = B  or  A**T * X = B, */
00050 
00051 /*  where A is a triangular matrix of order N, and B is an N-by-NRHS */
00052 /*  matrix.  A check is made to verify that A is nonsingular. */
00053 
00054 /*  Arguments */
00055 /*  ========= */
00056 
00057 /*  UPLO    (input) CHARACTER*1 */
00058 /*          = 'U':  A is upper triangular; */
00059 /*          = 'L':  A is lower triangular. */
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 = Transpose) */
00066 
00067 /*  DIAG    (input) CHARACTER*1 */
00068 /*          = 'N':  A is non-unit triangular; */
00069 /*          = 'U':  A is unit triangular. */
00070 
00071 /*  N       (input) INTEGER */
00072 /*          The order of the matrix A.  N >= 0. */
00073 
00074 /*  NRHS    (input) INTEGER */
00075 /*          The number of right hand sides, i.e., the number of columns */
00076 /*          of the matrix B.  NRHS >= 0. */
00077 
00078 /*  A       (input) REAL array, dimension (LDA,N) */
00079 /*          The triangular matrix A.  If UPLO = 'U', the leading N-by-N */
00080 /*          upper triangular part of the array A contains the upper */
00081 /*          triangular matrix, and the strictly lower triangular part of */
00082 /*          A is not referenced.  If UPLO = 'L', the leading N-by-N lower */
00083 /*          triangular part of the array A contains the lower triangular */
00084 /*          matrix, and the strictly upper triangular part of A is not */
00085 /*          referenced.  If DIAG = 'U', the diagonal elements of A are */
00086 /*          also not referenced and are assumed to be 1. */
00087 
00088 /*  LDA     (input) INTEGER */
00089 /*          The leading dimension of the array A.  LDA >= max(1,N). */
00090 
00091 /*  B       (input/output) REAL array, dimension (LDB,NRHS) */
00092 /*          On entry, the right hand side matrix B. */
00093 /*          On exit, if INFO = 0, the solution matrix X. */
00094 
00095 /*  LDB     (input) INTEGER */
00096 /*          The leading dimension of the array B.  LDB >= max(1,N). */
00097 
00098 /*  INFO    (output) INTEGER */
00099 /*          = 0:  successful exit */
00100 /*          < 0: if INFO = -i, the i-th argument had an illegal value */
00101 /*          > 0: if INFO = i, the i-th diagonal element of A is zero, */
00102 /*               indicating that the matrix is singular and the solutions */
00103 /*               X have not been computed. */
00104 
00105 /*  ===================================================================== */
00106 
00107 /*     .. Parameters .. */
00108 /*     .. */
00109 /*     .. Local Scalars .. */
00110 /*     .. */
00111 /*     .. External Functions .. */
00112 /*     .. */
00113 /*     .. External Subroutines .. */
00114 /*     .. */
00115 /*     .. Intrinsic Functions .. */
00116 /*     .. */
00117 /*     .. Executable Statements .. */
00118 
00119 /*     Test the input parameters. */
00120 
00121     /* Parameter adjustments */
00122     a_dim1 = *lda;
00123     a_offset = 1 + a_dim1;
00124     a -= a_offset;
00125     b_dim1 = *ldb;
00126     b_offset = 1 + b_dim1;
00127     b -= b_offset;
00128 
00129     /* Function Body */
00130     *info = 0;
00131     nounit = lsame_(diag, "N");
00132     if (! lsame_(uplo, "U") && ! lsame_(uplo, "L")) {
00133         *info = -1;
00134     } else if (! lsame_(trans, "N") && ! lsame_(trans, 
00135             "T") && ! lsame_(trans, "C")) {
00136         *info = -2;
00137     } else if (! nounit && ! lsame_(diag, "U")) {
00138         *info = -3;
00139     } else if (*n < 0) {
00140         *info = -4;
00141     } else if (*nrhs < 0) {
00142         *info = -5;
00143     } else if (*lda < max(1,*n)) {
00144         *info = -7;
00145     } else if (*ldb < max(1,*n)) {
00146         *info = -9;
00147     }
00148     if (*info != 0) {
00149         i__1 = -(*info);
00150         xerbla_("STRTRS", &i__1);
00151         return 0;
00152     }
00153 
00154 /*     Quick return if possible */
00155 
00156     if (*n == 0) {
00157         return 0;
00158     }
00159 
00160 /*     Check for singularity. */
00161 
00162     if (nounit) {
00163         i__1 = *n;
00164         for (*info = 1; *info <= i__1; ++(*info)) {
00165             if (a[*info + *info * a_dim1] == 0.f) {
00166                 return 0;
00167             }
00168 /* L10: */
00169         }
00170     }
00171     *info = 0;
00172 
00173 /*     Solve A * x = b  or  A' * x = b. */
00174 
00175     strsm_("Left", uplo, trans, diag, n, nrhs, &c_b12, &a[a_offset], lda, &b[
00176             b_offset], ldb);
00177 
00178     return 0;
00179 
00180 /*     End of STRTRS */
00181 
00182 } /* strtrs_ */


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