Mercurial > hg > qm-dsp
comparison ext/clapack/src/dtrti2.c @ 427:905e45637745
Add the CLAPACK and CBLAS/F2C-BLAS files we use
author | Chris Cannam <c.cannam@qmul.ac.uk> |
---|---|
date | Fri, 30 Sep 2016 15:51:22 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
426:a23b9f8b4a59 | 427:905e45637745 |
---|---|
1 /* dtrti2.f -- translated by f2c (version 20061008). | |
2 You must link the resulting object file with libf2c: | |
3 on Microsoft Windows system, link with libf2c.lib; | |
4 on Linux or Unix systems, link with .../path/to/libf2c.a -lm | |
5 or, if you install libf2c.a in a standard place, with -lf2c -lm | |
6 -- in that order, at the end of the command line, as in | |
7 cc *.o -lf2c -lm | |
8 Source for libf2c is in /netlib/f2c/libf2c.zip, e.g., | |
9 | |
10 http://www.netlib.org/f2c/libf2c.zip | |
11 */ | |
12 | |
13 #include "f2c.h" | |
14 #include "blaswrap.h" | |
15 | |
16 /* Table of constant values */ | |
17 | |
18 static integer c__1 = 1; | |
19 | |
20 /* Subroutine */ int dtrti2_(char *uplo, char *diag, integer *n, doublereal * | |
21 a, integer *lda, integer *info) | |
22 { | |
23 /* System generated locals */ | |
24 integer a_dim1, a_offset, i__1, i__2; | |
25 | |
26 /* Local variables */ | |
27 integer j; | |
28 doublereal ajj; | |
29 extern /* Subroutine */ int dscal_(integer *, doublereal *, doublereal *, | |
30 integer *); | |
31 extern logical lsame_(char *, char *); | |
32 logical upper; | |
33 extern /* Subroutine */ int dtrmv_(char *, char *, char *, integer *, | |
34 doublereal *, integer *, doublereal *, integer *), xerbla_(char *, integer *); | |
35 logical nounit; | |
36 | |
37 | |
38 /* -- LAPACK routine (version 3.2) -- */ | |
39 /* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */ | |
40 /* November 2006 */ | |
41 | |
42 /* .. Scalar Arguments .. */ | |
43 /* .. */ | |
44 /* .. Array Arguments .. */ | |
45 /* .. */ | |
46 | |
47 /* Purpose */ | |
48 /* ======= */ | |
49 | |
50 /* DTRTI2 computes the inverse of a real upper or lower triangular */ | |
51 /* matrix. */ | |
52 | |
53 /* This is the Level 2 BLAS version of the algorithm. */ | |
54 | |
55 /* Arguments */ | |
56 /* ========= */ | |
57 | |
58 /* UPLO (input) CHARACTER*1 */ | |
59 /* Specifies whether the matrix A is upper or lower triangular. */ | |
60 /* = 'U': Upper triangular */ | |
61 /* = 'L': Lower triangular */ | |
62 | |
63 /* DIAG (input) CHARACTER*1 */ | |
64 /* Specifies whether or not the matrix A is unit triangular. */ | |
65 /* = 'N': Non-unit triangular */ | |
66 /* = 'U': Unit triangular */ | |
67 | |
68 /* N (input) INTEGER */ | |
69 /* The order of the matrix A. N >= 0. */ | |
70 | |
71 /* A (input/output) DOUBLE PRECISION array, dimension (LDA,N) */ | |
72 /* On entry, the triangular matrix A. If UPLO = 'U', the */ | |
73 /* leading n by n upper triangular part of the array A contains */ | |
74 /* the upper triangular matrix, and the strictly lower */ | |
75 /* triangular part of A is not referenced. If UPLO = 'L', the */ | |
76 /* leading n by n lower triangular part of the array A contains */ | |
77 /* the lower triangular matrix, and the strictly upper */ | |
78 /* triangular part of A is not referenced. If DIAG = 'U', the */ | |
79 /* diagonal elements of A are also not referenced and are */ | |
80 /* assumed to be 1. */ | |
81 | |
82 /* On exit, the (triangular) inverse of the original matrix, in */ | |
83 /* the same storage format. */ | |
84 | |
85 /* LDA (input) INTEGER */ | |
86 /* The leading dimension of the array A. LDA >= max(1,N). */ | |
87 | |
88 /* INFO (output) INTEGER */ | |
89 /* = 0: successful exit */ | |
90 /* < 0: if INFO = -k, the k-th argument had an illegal value */ | |
91 | |
92 /* ===================================================================== */ | |
93 | |
94 /* .. Parameters .. */ | |
95 /* .. */ | |
96 /* .. Local Scalars .. */ | |
97 /* .. */ | |
98 /* .. External Functions .. */ | |
99 /* .. */ | |
100 /* .. External Subroutines .. */ | |
101 /* .. */ | |
102 /* .. Intrinsic Functions .. */ | |
103 /* .. */ | |
104 /* .. Executable Statements .. */ | |
105 | |
106 /* Test the input parameters. */ | |
107 | |
108 /* Parameter adjustments */ | |
109 a_dim1 = *lda; | |
110 a_offset = 1 + a_dim1; | |
111 a -= a_offset; | |
112 | |
113 /* Function Body */ | |
114 *info = 0; | |
115 upper = lsame_(uplo, "U"); | |
116 nounit = lsame_(diag, "N"); | |
117 if (! upper && ! lsame_(uplo, "L")) { | |
118 *info = -1; | |
119 } else if (! nounit && ! lsame_(diag, "U")) { | |
120 *info = -2; | |
121 } else if (*n < 0) { | |
122 *info = -3; | |
123 } else if (*lda < max(1,*n)) { | |
124 *info = -5; | |
125 } | |
126 if (*info != 0) { | |
127 i__1 = -(*info); | |
128 xerbla_("DTRTI2", &i__1); | |
129 return 0; | |
130 } | |
131 | |
132 if (upper) { | |
133 | |
134 /* Compute inverse of upper triangular matrix. */ | |
135 | |
136 i__1 = *n; | |
137 for (j = 1; j <= i__1; ++j) { | |
138 if (nounit) { | |
139 a[j + j * a_dim1] = 1. / a[j + j * a_dim1]; | |
140 ajj = -a[j + j * a_dim1]; | |
141 } else { | |
142 ajj = -1.; | |
143 } | |
144 | |
145 /* Compute elements 1:j-1 of j-th column. */ | |
146 | |
147 i__2 = j - 1; | |
148 dtrmv_("Upper", "No transpose", diag, &i__2, &a[a_offset], lda, & | |
149 a[j * a_dim1 + 1], &c__1); | |
150 i__2 = j - 1; | |
151 dscal_(&i__2, &ajj, &a[j * a_dim1 + 1], &c__1); | |
152 /* L10: */ | |
153 } | |
154 } else { | |
155 | |
156 /* Compute inverse of lower triangular matrix. */ | |
157 | |
158 for (j = *n; j >= 1; --j) { | |
159 if (nounit) { | |
160 a[j + j * a_dim1] = 1. / a[j + j * a_dim1]; | |
161 ajj = -a[j + j * a_dim1]; | |
162 } else { | |
163 ajj = -1.; | |
164 } | |
165 if (j < *n) { | |
166 | |
167 /* Compute elements j+1:n of j-th column. */ | |
168 | |
169 i__1 = *n - j; | |
170 dtrmv_("Lower", "No transpose", diag, &i__1, &a[j + 1 + (j + | |
171 1) * a_dim1], lda, &a[j + 1 + j * a_dim1], &c__1); | |
172 i__1 = *n - j; | |
173 dscal_(&i__1, &ajj, &a[j + 1 + j * a_dim1], &c__1); | |
174 } | |
175 /* L20: */ | |
176 } | |
177 } | |
178 | |
179 return 0; | |
180 | |
181 /* End of DTRTI2 */ | |
182 | |
183 } /* dtrti2_ */ |