annotate ext/clapack/src/dtrti2.c @ 211:a41bea655151 msvc

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