3 /* Table of constant values */
5 static integer c__1 = 1;
7 /* Subroutine */ int strti2_(char *uplo, char *diag, integer *n, real *a,
8 integer *lda, integer *info)
10 /* System generated locals */
11 integer a_dim1, a_offset, i__1, i__2;
16 extern logical lsame_(char *, char *);
17 extern /* Subroutine */ int sscal_(integer *, real *, real *, integer *);
19 extern /* Subroutine */ int strmv_(char *, char *, char *, integer *,
20 real *, integer *, real *, integer *),
21 xerbla_(char *, integer *);
25 /* -- LAPACK routine (version 3.1) -- */
26 /* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */
29 /* .. Scalar Arguments .. */
31 /* .. Array Arguments .. */
37 /* STRTI2 computes the inverse of a real upper or lower triangular */
40 /* This is the Level 2 BLAS version of the algorithm. */
45 /* UPLO (input) CHARACTER*1 */
46 /* Specifies whether the matrix A is upper or lower triangular. */
47 /* = 'U': Upper triangular */
48 /* = 'L': Lower triangular */
50 /* DIAG (input) CHARACTER*1 */
51 /* Specifies whether or not the matrix A is unit triangular. */
52 /* = 'N': Non-unit triangular */
53 /* = 'U': Unit triangular */
55 /* N (input) INTEGER */
56 /* The order of the matrix A. N >= 0. */
58 /* A (input/output) REAL array, dimension (LDA,N) */
59 /* On entry, the triangular matrix A. If UPLO = 'U', the */
60 /* leading n by n upper triangular part of the array A contains */
61 /* the upper triangular matrix, and the strictly lower */
62 /* triangular part of A is not referenced. If UPLO = 'L', the */
63 /* leading n by n lower triangular part of the array A contains */
64 /* the lower triangular matrix, and the strictly upper */
65 /* triangular part of A is not referenced. If DIAG = 'U', the */
66 /* diagonal elements of A are also not referenced and are */
67 /* assumed to be 1. */
69 /* On exit, the (triangular) inverse of the original matrix, in */
70 /* the same storage format. */
72 /* LDA (input) INTEGER */
73 /* The leading dimension of the array A. LDA >= max(1,N). */
75 /* INFO (output) INTEGER */
76 /* = 0: successful exit */
77 /* < 0: if INFO = -k, the k-th argument had an illegal value */
79 /* ===================================================================== */
81 /* .. Parameters .. */
83 /* .. Local Scalars .. */
85 /* .. External Functions .. */
87 /* .. External Subroutines .. */
89 /* .. Intrinsic Functions .. */
91 /* .. Executable Statements .. */
93 /* Test the input parameters. */
95 /* Parameter adjustments */
97 a_offset = 1 + a_dim1;
102 upper = lsame_(uplo, "U");
103 nounit = lsame_(diag, "N");
104 if (! upper && ! lsame_(uplo, "L")) {
106 } else if (! nounit && ! lsame_(diag, "U")) {
110 } else if (*lda < max(1,*n)) {
115 xerbla_("STRTI2", &i__1);
121 /* Compute inverse of upper triangular matrix. */
124 for (j = 1; j <= i__1; ++j) {
126 a[j + j * a_dim1] = 1.f / a[j + j * a_dim1];
127 ajj = -a[j + j * a_dim1];
132 /* Compute elements 1:j-1 of j-th column. */
135 strmv_("Upper", "No transpose", diag, &i__2, &a[a_offset], lda, &
136 a[j * a_dim1 + 1], &c__1);
138 sscal_(&i__2, &ajj, &a[j * a_dim1 + 1], &c__1);
143 /* Compute inverse of lower triangular matrix. */
145 for (j = *n; j >= 1; --j) {
147 a[j + j * a_dim1] = 1.f / a[j + j * a_dim1];
148 ajj = -a[j + j * a_dim1];
154 /* Compute elements j+1:n of j-th column. */
157 strmv_("Lower", "No transpose", diag, &i__1, &a[j + 1 + (j +
158 1) * a_dim1], lda, &a[j + 1 + j * a_dim1], &c__1);
160 sscal_(&i__1, &ajj, &a[j + 1 + j * a_dim1], &c__1);