annotate ext/cblas/src/dtrmv.c @ 206:335be766a54d

Fix erroneous header guard
author Chris Cannam
date Fri, 30 Sep 2016 19:04:06 +0100
parents 45330e0d2819
children
rev   line source
Chris@202 1 /* dtrmv.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 /* Subroutine */ int dtrmv_(char *uplo, char *trans, char *diag, integer *n,
Chris@202 17 doublereal *a, integer *lda, doublereal *x, integer *incx)
Chris@202 18 {
Chris@202 19 /* System generated locals */
Chris@202 20 integer a_dim1, a_offset, i__1, i__2;
Chris@202 21
Chris@202 22 /* Local variables */
Chris@202 23 integer i__, j, ix, jx, kx, info;
Chris@202 24 doublereal temp;
Chris@202 25 extern logical lsame_(char *, char *);
Chris@202 26 extern /* Subroutine */ int xerbla_(char *, integer *);
Chris@202 27 logical nounit;
Chris@202 28
Chris@202 29 /* .. Scalar Arguments .. */
Chris@202 30 /* .. */
Chris@202 31 /* .. Array Arguments .. */
Chris@202 32 /* .. */
Chris@202 33
Chris@202 34 /* Purpose */
Chris@202 35 /* ======= */
Chris@202 36
Chris@202 37 /* DTRMV performs one of the matrix-vector operations */
Chris@202 38
Chris@202 39 /* x := A*x, or x := A'*x, */
Chris@202 40
Chris@202 41 /* where x is an n element vector and A is an n by n unit, or non-unit, */
Chris@202 42 /* upper or lower triangular matrix. */
Chris@202 43
Chris@202 44 /* Arguments */
Chris@202 45 /* ========== */
Chris@202 46
Chris@202 47 /* UPLO - CHARACTER*1. */
Chris@202 48 /* On entry, UPLO specifies whether the matrix is an upper or */
Chris@202 49 /* lower triangular matrix as follows: */
Chris@202 50
Chris@202 51 /* UPLO = 'U' or 'u' A is an upper triangular matrix. */
Chris@202 52
Chris@202 53 /* UPLO = 'L' or 'l' A is a lower triangular matrix. */
Chris@202 54
Chris@202 55 /* Unchanged on exit. */
Chris@202 56
Chris@202 57 /* TRANS - CHARACTER*1. */
Chris@202 58 /* On entry, TRANS specifies the operation to be performed as */
Chris@202 59 /* follows: */
Chris@202 60
Chris@202 61 /* TRANS = 'N' or 'n' x := A*x. */
Chris@202 62
Chris@202 63 /* TRANS = 'T' or 't' x := A'*x. */
Chris@202 64
Chris@202 65 /* TRANS = 'C' or 'c' x := A'*x. */
Chris@202 66
Chris@202 67 /* Unchanged on exit. */
Chris@202 68
Chris@202 69 /* DIAG - CHARACTER*1. */
Chris@202 70 /* On entry, DIAG specifies whether or not A is unit */
Chris@202 71 /* triangular as follows: */
Chris@202 72
Chris@202 73 /* DIAG = 'U' or 'u' A is assumed to be unit triangular. */
Chris@202 74
Chris@202 75 /* DIAG = 'N' or 'n' A is not assumed to be unit */
Chris@202 76 /* triangular. */
Chris@202 77
Chris@202 78 /* Unchanged on exit. */
Chris@202 79
Chris@202 80 /* N - INTEGER. */
Chris@202 81 /* On entry, N specifies the order of the matrix A. */
Chris@202 82 /* N must be at least zero. */
Chris@202 83 /* Unchanged on exit. */
Chris@202 84
Chris@202 85 /* A - DOUBLE PRECISION array of DIMENSION ( LDA, n ). */
Chris@202 86 /* Before entry with UPLO = 'U' or 'u', the leading n by n */
Chris@202 87 /* upper triangular part of the array A must contain the upper */
Chris@202 88 /* triangular matrix and the strictly lower triangular part of */
Chris@202 89 /* A is not referenced. */
Chris@202 90 /* Before entry with UPLO = 'L' or 'l', the leading n by n */
Chris@202 91 /* lower triangular part of the array A must contain the lower */
Chris@202 92 /* triangular matrix and the strictly upper triangular part of */
Chris@202 93 /* A is not referenced. */
Chris@202 94 /* Note that when DIAG = 'U' or 'u', the diagonal elements of */
Chris@202 95 /* A are not referenced either, but are assumed to be unity. */
Chris@202 96 /* Unchanged on exit. */
Chris@202 97
Chris@202 98 /* LDA - INTEGER. */
Chris@202 99 /* On entry, LDA specifies the first dimension of A as declared */
Chris@202 100 /* in the calling (sub) program. LDA must be at least */
Chris@202 101 /* max( 1, n ). */
Chris@202 102 /* Unchanged on exit. */
Chris@202 103
Chris@202 104 /* X - DOUBLE PRECISION array of dimension at least */
Chris@202 105 /* ( 1 + ( n - 1 )*abs( INCX ) ). */
Chris@202 106 /* Before entry, the incremented array X must contain the n */
Chris@202 107 /* element vector x. On exit, X is overwritten with the */
Chris@202 108 /* tranformed vector x. */
Chris@202 109
Chris@202 110 /* INCX - INTEGER. */
Chris@202 111 /* On entry, INCX specifies the increment for the elements of */
Chris@202 112 /* X. INCX must not be zero. */
Chris@202 113 /* Unchanged on exit. */
Chris@202 114
Chris@202 115
Chris@202 116 /* Level 2 Blas routine. */
Chris@202 117
Chris@202 118 /* -- Written on 22-October-1986. */
Chris@202 119 /* Jack Dongarra, Argonne National Lab. */
Chris@202 120 /* Jeremy Du Croz, Nag Central Office. */
Chris@202 121 /* Sven Hammarling, Nag Central Office. */
Chris@202 122 /* Richard Hanson, Sandia National Labs. */
Chris@202 123
Chris@202 124
Chris@202 125 /* .. Parameters .. */
Chris@202 126 /* .. */
Chris@202 127 /* .. Local Scalars .. */
Chris@202 128 /* .. */
Chris@202 129 /* .. External Functions .. */
Chris@202 130 /* .. */
Chris@202 131 /* .. External Subroutines .. */
Chris@202 132 /* .. */
Chris@202 133 /* .. Intrinsic Functions .. */
Chris@202 134 /* .. */
Chris@202 135
Chris@202 136 /* Test the input parameters. */
Chris@202 137
Chris@202 138 /* Parameter adjustments */
Chris@202 139 a_dim1 = *lda;
Chris@202 140 a_offset = 1 + a_dim1;
Chris@202 141 a -= a_offset;
Chris@202 142 --x;
Chris@202 143
Chris@202 144 /* Function Body */
Chris@202 145 info = 0;
Chris@202 146 if (! lsame_(uplo, "U") && ! lsame_(uplo, "L")) {
Chris@202 147 info = 1;
Chris@202 148 } else if (! lsame_(trans, "N") && ! lsame_(trans,
Chris@202 149 "T") && ! lsame_(trans, "C")) {
Chris@202 150 info = 2;
Chris@202 151 } else if (! lsame_(diag, "U") && ! lsame_(diag,
Chris@202 152 "N")) {
Chris@202 153 info = 3;
Chris@202 154 } else if (*n < 0) {
Chris@202 155 info = 4;
Chris@202 156 } else if (*lda < max(1,*n)) {
Chris@202 157 info = 6;
Chris@202 158 } else if (*incx == 0) {
Chris@202 159 info = 8;
Chris@202 160 }
Chris@202 161 if (info != 0) {
Chris@202 162 xerbla_("DTRMV ", &info);
Chris@202 163 return 0;
Chris@202 164 }
Chris@202 165
Chris@202 166 /* Quick return if possible. */
Chris@202 167
Chris@202 168 if (*n == 0) {
Chris@202 169 return 0;
Chris@202 170 }
Chris@202 171
Chris@202 172 nounit = lsame_(diag, "N");
Chris@202 173
Chris@202 174 /* Set up the start point in X if the increment is not unity. This */
Chris@202 175 /* will be ( N - 1 )*INCX too small for descending loops. */
Chris@202 176
Chris@202 177 if (*incx <= 0) {
Chris@202 178 kx = 1 - (*n - 1) * *incx;
Chris@202 179 } else if (*incx != 1) {
Chris@202 180 kx = 1;
Chris@202 181 }
Chris@202 182
Chris@202 183 /* Start the operations. In this version the elements of A are */
Chris@202 184 /* accessed sequentially with one pass through A. */
Chris@202 185
Chris@202 186 if (lsame_(trans, "N")) {
Chris@202 187
Chris@202 188 /* Form x := A*x. */
Chris@202 189
Chris@202 190 if (lsame_(uplo, "U")) {
Chris@202 191 if (*incx == 1) {
Chris@202 192 i__1 = *n;
Chris@202 193 for (j = 1; j <= i__1; ++j) {
Chris@202 194 if (x[j] != 0.) {
Chris@202 195 temp = x[j];
Chris@202 196 i__2 = j - 1;
Chris@202 197 for (i__ = 1; i__ <= i__2; ++i__) {
Chris@202 198 x[i__] += temp * a[i__ + j * a_dim1];
Chris@202 199 /* L10: */
Chris@202 200 }
Chris@202 201 if (nounit) {
Chris@202 202 x[j] *= a[j + j * a_dim1];
Chris@202 203 }
Chris@202 204 }
Chris@202 205 /* L20: */
Chris@202 206 }
Chris@202 207 } else {
Chris@202 208 jx = kx;
Chris@202 209 i__1 = *n;
Chris@202 210 for (j = 1; j <= i__1; ++j) {
Chris@202 211 if (x[jx] != 0.) {
Chris@202 212 temp = x[jx];
Chris@202 213 ix = kx;
Chris@202 214 i__2 = j - 1;
Chris@202 215 for (i__ = 1; i__ <= i__2; ++i__) {
Chris@202 216 x[ix] += temp * a[i__ + j * a_dim1];
Chris@202 217 ix += *incx;
Chris@202 218 /* L30: */
Chris@202 219 }
Chris@202 220 if (nounit) {
Chris@202 221 x[jx] *= a[j + j * a_dim1];
Chris@202 222 }
Chris@202 223 }
Chris@202 224 jx += *incx;
Chris@202 225 /* L40: */
Chris@202 226 }
Chris@202 227 }
Chris@202 228 } else {
Chris@202 229 if (*incx == 1) {
Chris@202 230 for (j = *n; j >= 1; --j) {
Chris@202 231 if (x[j] != 0.) {
Chris@202 232 temp = x[j];
Chris@202 233 i__1 = j + 1;
Chris@202 234 for (i__ = *n; i__ >= i__1; --i__) {
Chris@202 235 x[i__] += temp * a[i__ + j * a_dim1];
Chris@202 236 /* L50: */
Chris@202 237 }
Chris@202 238 if (nounit) {
Chris@202 239 x[j] *= a[j + j * a_dim1];
Chris@202 240 }
Chris@202 241 }
Chris@202 242 /* L60: */
Chris@202 243 }
Chris@202 244 } else {
Chris@202 245 kx += (*n - 1) * *incx;
Chris@202 246 jx = kx;
Chris@202 247 for (j = *n; j >= 1; --j) {
Chris@202 248 if (x[jx] != 0.) {
Chris@202 249 temp = x[jx];
Chris@202 250 ix = kx;
Chris@202 251 i__1 = j + 1;
Chris@202 252 for (i__ = *n; i__ >= i__1; --i__) {
Chris@202 253 x[ix] += temp * a[i__ + j * a_dim1];
Chris@202 254 ix -= *incx;
Chris@202 255 /* L70: */
Chris@202 256 }
Chris@202 257 if (nounit) {
Chris@202 258 x[jx] *= a[j + j * a_dim1];
Chris@202 259 }
Chris@202 260 }
Chris@202 261 jx -= *incx;
Chris@202 262 /* L80: */
Chris@202 263 }
Chris@202 264 }
Chris@202 265 }
Chris@202 266 } else {
Chris@202 267
Chris@202 268 /* Form x := A'*x. */
Chris@202 269
Chris@202 270 if (lsame_(uplo, "U")) {
Chris@202 271 if (*incx == 1) {
Chris@202 272 for (j = *n; j >= 1; --j) {
Chris@202 273 temp = x[j];
Chris@202 274 if (nounit) {
Chris@202 275 temp *= a[j + j * a_dim1];
Chris@202 276 }
Chris@202 277 for (i__ = j - 1; i__ >= 1; --i__) {
Chris@202 278 temp += a[i__ + j * a_dim1] * x[i__];
Chris@202 279 /* L90: */
Chris@202 280 }
Chris@202 281 x[j] = temp;
Chris@202 282 /* L100: */
Chris@202 283 }
Chris@202 284 } else {
Chris@202 285 jx = kx + (*n - 1) * *incx;
Chris@202 286 for (j = *n; j >= 1; --j) {
Chris@202 287 temp = x[jx];
Chris@202 288 ix = jx;
Chris@202 289 if (nounit) {
Chris@202 290 temp *= a[j + j * a_dim1];
Chris@202 291 }
Chris@202 292 for (i__ = j - 1; i__ >= 1; --i__) {
Chris@202 293 ix -= *incx;
Chris@202 294 temp += a[i__ + j * a_dim1] * x[ix];
Chris@202 295 /* L110: */
Chris@202 296 }
Chris@202 297 x[jx] = temp;
Chris@202 298 jx -= *incx;
Chris@202 299 /* L120: */
Chris@202 300 }
Chris@202 301 }
Chris@202 302 } else {
Chris@202 303 if (*incx == 1) {
Chris@202 304 i__1 = *n;
Chris@202 305 for (j = 1; j <= i__1; ++j) {
Chris@202 306 temp = x[j];
Chris@202 307 if (nounit) {
Chris@202 308 temp *= a[j + j * a_dim1];
Chris@202 309 }
Chris@202 310 i__2 = *n;
Chris@202 311 for (i__ = j + 1; i__ <= i__2; ++i__) {
Chris@202 312 temp += a[i__ + j * a_dim1] * x[i__];
Chris@202 313 /* L130: */
Chris@202 314 }
Chris@202 315 x[j] = temp;
Chris@202 316 /* L140: */
Chris@202 317 }
Chris@202 318 } else {
Chris@202 319 jx = kx;
Chris@202 320 i__1 = *n;
Chris@202 321 for (j = 1; j <= i__1; ++j) {
Chris@202 322 temp = x[jx];
Chris@202 323 ix = jx;
Chris@202 324 if (nounit) {
Chris@202 325 temp *= a[j + j * a_dim1];
Chris@202 326 }
Chris@202 327 i__2 = *n;
Chris@202 328 for (i__ = j + 1; i__ <= i__2; ++i__) {
Chris@202 329 ix += *incx;
Chris@202 330 temp += a[i__ + j * a_dim1] * x[ix];
Chris@202 331 /* L150: */
Chris@202 332 }
Chris@202 333 x[jx] = temp;
Chris@202 334 jx += *incx;
Chris@202 335 /* L160: */
Chris@202 336 }
Chris@202 337 }
Chris@202 338 }
Chris@202 339 }
Chris@202 340
Chris@202 341 return 0;
Chris@202 342
Chris@202 343 /* End of DTRMV . */
Chris@202 344
Chris@202 345 } /* dtrmv_ */