3 /* Table of constant values */
5 static doublereal c_b12 = 1.;
7 /* Subroutine */ int dtrtrs_(char *uplo, char *trans, char *diag, integer *n,
8 integer *nrhs, doublereal *a, integer *lda, doublereal *b, 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 dtrsm_(char *, char *, char *, char *,
17 integer *, integer *, doublereal *, doublereal *, integer *,
18 doublereal *, integer *), xerbla_(
23 /* -- LAPACK routine (version 3.1) -- */
24 /* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
27 /* .. Scalar Arguments .. */
29 /* .. Array Arguments .. */
35 /* DTRTRS solves a triangular system of the form */
37 /* A * X = B or A**T * X = B, */
39 /* where A is a triangular matrix of order N, and B is an N-by-NRHS */
40 /* matrix. A check is made to verify that A is nonsingular. */
45 /* UPLO (input) CHARACTER*1 */
46 /* = 'U': A is upper triangular; */
47 /* = 'L': A is lower triangular. */
49 /* TRANS (input) CHARACTER*1 */
50 /* Specifies the form of the system of equations: */
51 /* = 'N': A * X = B (No transpose) */
52 /* = 'T': A**T * X = B (Transpose) */
53 /* = 'C': A**H * X = B (Conjugate transpose = Transpose) */
55 /* DIAG (input) CHARACTER*1 */
56 /* = 'N': A is non-unit triangular; */
57 /* = 'U': A is unit triangular. */
59 /* N (input) INTEGER */
60 /* The order of the matrix A. N >= 0. */
62 /* NRHS (input) INTEGER */
63 /* The number of right hand sides, i.e., the number of columns */
64 /* of the matrix B. NRHS >= 0. */
66 /* A (input) DOUBLE PRECISION array, dimension (LDA,N) */
67 /* The triangular matrix A. If UPLO = 'U', the leading N-by-N */
68 /* upper triangular part of the array A contains the upper */
69 /* triangular matrix, and the strictly lower triangular part of */
70 /* A is not referenced. If UPLO = 'L', the leading N-by-N lower */
71 /* triangular part of the array A contains the lower triangular */
72 /* matrix, and the strictly upper triangular part of A is not */
73 /* referenced. If DIAG = 'U', the diagonal elements of A are */
74 /* also not referenced and are assumed to be 1. */
76 /* LDA (input) INTEGER */
77 /* The leading dimension of the array A. LDA >= max(1,N). */
79 /* B (input/output) DOUBLE PRECISION array, dimension (LDB,NRHS) */
80 /* On entry, the right hand side matrix B. */
81 /* On exit, if INFO = 0, the solution matrix X. */
83 /* LDB (input) INTEGER */
84 /* The leading dimension of the array B. LDB >= max(1,N). */
86 /* INFO (output) INTEGER */
87 /* = 0: successful exit */
88 /* < 0: if INFO = -i, the i-th argument had an illegal value */
89 /* > 0: if INFO = i, the i-th diagonal element of A is zero, */
90 /* indicating that the matrix is singular and the solutions */
91 /* X have not been computed. */
93 /* ===================================================================== */
95 /* .. Parameters .. */
97 /* .. Local Scalars .. */
99 /* .. External Functions .. */
101 /* .. External Subroutines .. */
103 /* .. Intrinsic Functions .. */
105 /* .. Executable Statements .. */
107 /* Test the input parameters. */
109 /* Parameter adjustments */
111 a_offset = 1 + a_dim1;
114 b_offset = 1 + b_dim1;
119 nounit = lsame_(diag, "N");
120 if (! lsame_(uplo, "U") && ! lsame_(uplo, "L")) {
122 } else if (! lsame_(trans, "N") && ! lsame_(trans,
123 "T") && ! lsame_(trans, "C")) {
125 } else if (! nounit && ! lsame_(diag, "U")) {
129 } else if (*nrhs < 0) {
131 } else if (*lda < max(1,*n)) {
133 } else if (*ldb < max(1,*n)) {
138 xerbla_("DTRTRS", &i__1);
142 /* Quick return if possible */
148 /* Check for singularity. */
152 for (*info = 1; *info <= i__1; ++(*info)) {
153 if (a[*info + *info * a_dim1] == 0.) {
161 /* Solve A * x = b or A' * x = b. */
163 dtrsm_("Left", uplo, trans, diag, n, nrhs, &c_b12, &a[a_offset], lda, &b[