3 /* Table of constant values */
5 static real c_b12 = 1.f;
7 /* Subroutine */ int strtrs_(char *uplo, char *trans, char *diag, integer *n,
8 integer *nrhs, real *a, integer *lda, real *b, integer *ldb, integer *
11 /* System generated locals */
12 integer a_dim1, a_offset, b_dim1, b_offset, i__1;
15 extern logical lsame_(char *, char *);
16 extern /* Subroutine */ int strsm_(char *, char *, char *, char *,
17 integer *, integer *, real *, real *, integer *, real *, integer *
18 ), xerbla_(char *, integer *);
22 /* -- LAPACK routine (version 3.1) -- */
23 /* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
26 /* .. Scalar Arguments .. */
28 /* .. Array Arguments .. */
34 /* STRTRS solves a triangular system of the form */
36 /* A * X = B or A**T * X = B, */
38 /* where A is a triangular matrix of order N, and B is an N-by-NRHS */
39 /* matrix. A check is made to verify that A is nonsingular. */
44 /* UPLO (input) CHARACTER*1 */
45 /* = 'U': A is upper triangular; */
46 /* = 'L': A is lower triangular. */
48 /* TRANS (input) CHARACTER*1 */
49 /* Specifies the form of the system of equations: */
50 /* = 'N': A * X = B (No transpose) */
51 /* = 'T': A**T * X = B (Transpose) */
52 /* = 'C': A**H * X = B (Conjugate transpose = Transpose) */
54 /* DIAG (input) CHARACTER*1 */
55 /* = 'N': A is non-unit triangular; */
56 /* = 'U': A is unit triangular. */
58 /* N (input) INTEGER */
59 /* The order of the matrix A. N >= 0. */
61 /* NRHS (input) INTEGER */
62 /* The number of right hand sides, i.e., the number of columns */
63 /* of the matrix B. NRHS >= 0. */
65 /* A (input) REAL array, dimension (LDA,N) */
66 /* The triangular matrix A. If UPLO = 'U', the leading N-by-N */
67 /* upper triangular part of the array A contains the upper */
68 /* triangular matrix, and the strictly lower triangular part of */
69 /* A is not referenced. If UPLO = 'L', the leading N-by-N lower */
70 /* triangular part of the array A contains the lower triangular */
71 /* matrix, and the strictly upper triangular part of A is not */
72 /* referenced. If DIAG = 'U', the diagonal elements of A are */
73 /* also not referenced and are assumed to be 1. */
75 /* LDA (input) INTEGER */
76 /* The leading dimension of the array A. LDA >= max(1,N). */
78 /* B (input/output) REAL array, dimension (LDB,NRHS) */
79 /* On entry, the right hand side matrix B. */
80 /* On exit, if INFO = 0, the solution matrix X. */
82 /* LDB (input) INTEGER */
83 /* The leading dimension of the array B. LDB >= max(1,N). */
85 /* INFO (output) INTEGER */
86 /* = 0: successful exit */
87 /* < 0: if INFO = -i, the i-th argument had an illegal value */
88 /* > 0: if INFO = i, the i-th diagonal element of A is zero, */
89 /* indicating that the matrix is singular and the solutions */
90 /* X have not been computed. */
92 /* ===================================================================== */
94 /* .. Parameters .. */
96 /* .. Local Scalars .. */
98 /* .. External Functions .. */
100 /* .. External Subroutines .. */
102 /* .. Intrinsic Functions .. */
104 /* .. Executable Statements .. */
106 /* Test the input parameters. */
108 /* Parameter adjustments */
110 a_offset = 1 + a_dim1;
113 b_offset = 1 + b_dim1;
118 nounit = lsame_(diag, "N");
119 if (! lsame_(uplo, "U") && ! lsame_(uplo, "L")) {
121 } else if (! lsame_(trans, "N") && ! lsame_(trans,
122 "T") && ! lsame_(trans, "C")) {
124 } else if (! nounit && ! lsame_(diag, "U")) {
128 } else if (*nrhs < 0) {
130 } else if (*lda < max(1,*n)) {
132 } else if (*ldb < max(1,*n)) {
137 xerbla_("STRTRS", &i__1);
141 /* Quick return if possible */
147 /* Check for singularity. */
151 for (*info = 1; *info <= i__1; ++(*info)) {
152 if (a[*info + *info * a_dim1] == 0.f) {
160 /* Solve A * x = b or A' * x = b. */
162 strsm_("Left", uplo, trans, diag, n, nrhs, &c_b12, &a[a_offset], lda, &b[