| 1 |
/* ./src_f77/dtbmv.f -- translated by f2c (version 20030320). |
| 2 |
You must link the resulting object file with the libraries: |
| 3 |
-lf2c -lm (in that order) |
| 4 |
*/ |
| 5 |
|
| 6 |
#include <punc/vf2c.h> |
| 7 |
|
| 8 |
/* Subroutine */ int dtbmv_(char *uplo, char *trans, char *diag, integer *n, |
| 9 |
integer *k, doublereal *a, integer *lda, doublereal *x, integer *incx, |
| 10 |
ftnlen uplo_len, ftnlen trans_len, ftnlen diag_len) |
| 11 |
{ |
| 12 |
/* System generated locals */ |
| 13 |
integer a_dim1, a_offset, i__1, i__2, i__3, i__4; |
| 14 |
|
| 15 |
/* Local variables */ |
| 16 |
static integer i__, j, l, ix, jx, kx, info; |
| 17 |
static doublereal temp; |
| 18 |
extern logical lsame_(char *, char *, ftnlen, ftnlen); |
| 19 |
static integer kplus1; |
| 20 |
extern /* Subroutine */ int xerbla_(char *, integer *, ftnlen); |
| 21 |
static logical nounit; |
| 22 |
|
| 23 |
/* .. Scalar Arguments .. */ |
| 24 |
/* .. Array Arguments .. */ |
| 25 |
/* .. */ |
| 26 |
|
| 27 |
/* Purpose */ |
| 28 |
/* ======= */ |
| 29 |
|
| 30 |
/* DTBMV performs one of the matrix-vector operations */ |
| 31 |
|
| 32 |
/* x := A*x, or x := A'*x, */ |
| 33 |
|
| 34 |
/* where x is an n element vector and A is an n by n unit, or non-unit, */ |
| 35 |
/* upper or lower triangular band matrix, with ( k + 1 ) diagonals. */ |
| 36 |
|
| 37 |
/* Parameters */ |
| 38 |
/* ========== */ |
| 39 |
|
| 40 |
/* UPLO - CHARACTER*1. */ |
| 41 |
/* On entry, UPLO specifies whether the matrix is an upper or */ |
| 42 |
/* lower triangular matrix as follows: */ |
| 43 |
|
| 44 |
/* UPLO = 'U' or 'u' A is an upper triangular matrix. */ |
| 45 |
|
| 46 |
/* UPLO = 'L' or 'l' A is a lower triangular matrix. */ |
| 47 |
|
| 48 |
/* Unchanged on exit. */ |
| 49 |
|
| 50 |
/* TRANS - CHARACTER*1. */ |
| 51 |
/* On entry, TRANS specifies the operation to be performed as */ |
| 52 |
/* follows: */ |
| 53 |
|
| 54 |
/* TRANS = 'N' or 'n' x := A*x. */ |
| 55 |
|
| 56 |
/* TRANS = 'T' or 't' x := A'*x. */ |
| 57 |
|
| 58 |
/* TRANS = 'C' or 'c' x := A'*x. */ |
| 59 |
|
| 60 |
/* Unchanged on exit. */ |
| 61 |
|
| 62 |
/* DIAG - CHARACTER*1. */ |
| 63 |
/* On entry, DIAG specifies whether or not A is unit */ |
| 64 |
/* triangular as follows: */ |
| 65 |
|
| 66 |
/* DIAG = 'U' or 'u' A is assumed to be unit triangular. */ |
| 67 |
|
| 68 |
/* DIAG = 'N' or 'n' A is not assumed to be unit */ |
| 69 |
/* triangular. */ |
| 70 |
|
| 71 |
/* Unchanged on exit. */ |
| 72 |
|
| 73 |
/* N - INTEGER. */ |
| 74 |
/* On entry, N specifies the order of the matrix A. */ |
| 75 |
/* N must be at least zero. */ |
| 76 |
/* Unchanged on exit. */ |
| 77 |
|
| 78 |
/* K - INTEGER. */ |
| 79 |
/* On entry with UPLO = 'U' or 'u', K specifies the number of */ |
| 80 |
/* super-diagonals of the matrix A. */ |
| 81 |
/* On entry with UPLO = 'L' or 'l', K specifies the number of */ |
| 82 |
/* sub-diagonals of the matrix A. */ |
| 83 |
/* K must satisfy 0 .le. K. */ |
| 84 |
/* Unchanged on exit. */ |
| 85 |
|
| 86 |
/* A - DOUBLE PRECISION array of DIMENSION ( LDA, n ). */ |
| 87 |
/* Before entry with UPLO = 'U' or 'u', the leading ( k + 1 ) */ |
| 88 |
/* by n part of the array A must contain the upper triangular */ |
| 89 |
/* band part of the matrix of coefficients, supplied column by */ |
| 90 |
/* column, with the leading diagonal of the matrix in row */ |
| 91 |
/* ( k + 1 ) of the array, the first super-diagonal starting at */ |
| 92 |
/* position 2 in row k, and so on. The top left k by k triangle */ |
| 93 |
/* of the array A is not referenced. */ |
| 94 |
/* The following program segment will transfer an upper */ |
| 95 |
/* triangular band matrix from conventional full matrix storage */ |
| 96 |
/* to band storage: */ |
| 97 |
|
| 98 |
/* DO 20, J = 1, N */ |
| 99 |
/* M = K + 1 - J */ |
| 100 |
/* DO 10, I = MAX( 1, J - K ), J */ |
| 101 |
/* A( M + I, J ) = matrix( I, J ) */ |
| 102 |
/* 10 CONTINUE */ |
| 103 |
/* 20 CONTINUE */ |
| 104 |
|
| 105 |
/* Before entry with UPLO = 'L' or 'l', the leading ( k + 1 ) */ |
| 106 |
/* by n part of the array A must contain the lower triangular */ |
| 107 |
/* band part of the matrix of coefficients, supplied column by */ |
| 108 |
/* column, with the leading diagonal of the matrix in row 1 of */ |
| 109 |
/* the array, the first sub-diagonal starting at position 1 in */ |
| 110 |
/* row 2, and so on. The bottom right k by k triangle of the */ |
| 111 |
/* array A is not referenced. */ |
| 112 |
/* The following program segment will transfer a lower */ |
| 113 |
/* triangular band matrix from conventional full matrix storage */ |
| 114 |
/* to band storage: */ |
| 115 |
|
| 116 |
/* DO 20, J = 1, N */ |
| 117 |
/* M = 1 - J */ |
| 118 |
/* DO 10, I = J, MIN( N, J + K ) */ |
| 119 |
/* A( M + I, J ) = matrix( I, J ) */ |
| 120 |
/* 10 CONTINUE */ |
| 121 |
/* 20 CONTINUE */ |
| 122 |
|
| 123 |
/* Note that when DIAG = 'U' or 'u' the elements of the array A */ |
| 124 |
/* corresponding to the diagonal elements of the matrix are not */ |
| 125 |
/* referenced, but are assumed to be unity. */ |
| 126 |
/* Unchanged on exit. */ |
| 127 |
|
| 128 |
/* LDA - INTEGER. */ |
| 129 |
/* On entry, LDA specifies the first dimension of A as declared */ |
| 130 |
/* in the calling (sub) program. LDA must be at least */ |
| 131 |
/* ( k + 1 ). */ |
| 132 |
/* Unchanged on exit. */ |
| 133 |
|
| 134 |
/* X - DOUBLE PRECISION array of dimension at least */ |
| 135 |
/* ( 1 + ( n - 1 )*abs( INCX ) ). */ |
| 136 |
/* Before entry, the incremented array X must contain the n */ |
| 137 |
/* element vector x. On exit, X is overwritten with the */ |
| 138 |
/* tranformed vector x. */ |
| 139 |
|
| 140 |
/* INCX - INTEGER. */ |
| 141 |
/* On entry, INCX specifies the increment for the elements of */ |
| 142 |
/* X. INCX must not be zero. */ |
| 143 |
/* Unchanged on exit. */ |
| 144 |
|
| 145 |
|
| 146 |
/* Level 2 Blas routine. */ |
| 147 |
|
| 148 |
/* -- Written on 22-October-1986. */ |
| 149 |
/* Jack Dongarra, Argonne National Lab. */ |
| 150 |
/* Jeremy Du Croz, Nag Central Office. */ |
| 151 |
/* Sven Hammarling, Nag Central Office. */ |
| 152 |
/* Richard Hanson, Sandia National Labs. */ |
| 153 |
|
| 154 |
|
| 155 |
/* .. Parameters .. */ |
| 156 |
/* .. Local Scalars .. */ |
| 157 |
/* .. External Functions .. */ |
| 158 |
/* .. External Subroutines .. */ |
| 159 |
/* .. Intrinsic Functions .. */ |
| 160 |
/* .. */ |
| 161 |
/* .. Executable Statements .. */ |
| 162 |
|
| 163 |
/* Test the input parameters. */ |
| 164 |
|
| 165 |
/* Parameter adjustments */ |
| 166 |
a_dim1 = *lda; |
| 167 |
a_offset = 1 + a_dim1; |
| 168 |
a -= a_offset; |
| 169 |
--x; |
| 170 |
|
| 171 |
/* Function Body */ |
| 172 |
info = 0; |
| 173 |
if (! lsame_(uplo, "U", (ftnlen)1, (ftnlen)1) && ! lsame_(uplo, "L", ( |
| 174 |
ftnlen)1, (ftnlen)1)) { |
| 175 |
info = 1; |
| 176 |
} else if (! lsame_(trans, "N", (ftnlen)1, (ftnlen)1) && ! lsame_(trans, |
| 177 |
"T", (ftnlen)1, (ftnlen)1) && ! lsame_(trans, "C", (ftnlen)1, ( |
| 178 |
ftnlen)1)) { |
| 179 |
info = 2; |
| 180 |
} else if (! lsame_(diag, "U", (ftnlen)1, (ftnlen)1) && ! lsame_(diag, |
| 181 |
"N", (ftnlen)1, (ftnlen)1)) { |
| 182 |
info = 3; |
| 183 |
} else if (*n < 0) { |
| 184 |
info = 4; |
| 185 |
} else if (*k < 0) { |
| 186 |
info = 5; |
| 187 |
} else if (*lda < *k + 1) { |
| 188 |
info = 7; |
| 189 |
} else if (*incx == 0) { |
| 190 |
info = 9; |
| 191 |
} |
| 192 |
if (info != 0) { |
| 193 |
xerbla_("DTBMV ", &info, (ftnlen)6); |
| 194 |
return 0; |
| 195 |
} |
| 196 |
|
| 197 |
/* Quick return if possible. */ |
| 198 |
|
| 199 |
if (*n == 0) { |
| 200 |
return 0; |
| 201 |
} |
| 202 |
|
| 203 |
nounit = lsame_(diag, "N", (ftnlen)1, (ftnlen)1); |
| 204 |
|
| 205 |
/* Set up the start point in X if the increment is not unity. This */ |
| 206 |
/* will be ( N - 1 )*INCX too small for descending loops. */ |
| 207 |
|
| 208 |
if (*incx <= 0) { |
| 209 |
kx = 1 - (*n - 1) * *incx; |
| 210 |
} else if (*incx != 1) { |
| 211 |
kx = 1; |
| 212 |
} |
| 213 |
|
| 214 |
/* Start the operations. In this version the elements of A are */ |
| 215 |
/* accessed sequentially with one pass through A. */ |
| 216 |
|
| 217 |
if (lsame_(trans, "N", (ftnlen)1, (ftnlen)1)) { |
| 218 |
|
| 219 |
/* Form x := A*x. */ |
| 220 |
|
| 221 |
if (lsame_(uplo, "U", (ftnlen)1, (ftnlen)1)) { |
| 222 |
kplus1 = *k + 1; |
| 223 |
if (*incx == 1) { |
| 224 |
i__1 = *n; |
| 225 |
for (j = 1; j <= i__1; ++j) { |
| 226 |
if (x[j] != 0.) { |
| 227 |
temp = x[j]; |
| 228 |
l = kplus1 - j; |
| 229 |
/* Computing MAX */ |
| 230 |
i__2 = 1, i__3 = j - *k; |
| 231 |
i__4 = j - 1; |
| 232 |
for (i__ = max(i__2,i__3); i__ <= i__4; ++i__) { |
| 233 |
x[i__] += temp * a[l + i__ + j * a_dim1]; |
| 234 |
/* L10: */ |
| 235 |
} |
| 236 |
if (nounit) { |
| 237 |
x[j] *= a[kplus1 + j * a_dim1]; |
| 238 |
} |
| 239 |
} |
| 240 |
/* L20: */ |
| 241 |
} |
| 242 |
} else { |
| 243 |
jx = kx; |
| 244 |
i__1 = *n; |
| 245 |
for (j = 1; j <= i__1; ++j) { |
| 246 |
if (x[jx] != 0.) { |
| 247 |
temp = x[jx]; |
| 248 |
ix = kx; |
| 249 |
l = kplus1 - j; |
| 250 |
/* Computing MAX */ |
| 251 |
i__4 = 1, i__2 = j - *k; |
| 252 |
i__3 = j - 1; |
| 253 |
for (i__ = max(i__4,i__2); i__ <= i__3; ++i__) { |
| 254 |
x[ix] += temp * a[l + i__ + j * a_dim1]; |
| 255 |
ix += *incx; |
| 256 |
/* L30: */ |
| 257 |
} |
| 258 |
if (nounit) { |
| 259 |
x[jx] *= a[kplus1 + j * a_dim1]; |
| 260 |
} |
| 261 |
} |
| 262 |
jx += *incx; |
| 263 |
if (j > *k) { |
| 264 |
kx += *incx; |
| 265 |
} |
| 266 |
/* L40: */ |
| 267 |
} |
| 268 |
} |
| 269 |
} else { |
| 270 |
if (*incx == 1) { |
| 271 |
for (j = *n; j >= 1; --j) { |
| 272 |
if (x[j] != 0.) { |
| 273 |
temp = x[j]; |
| 274 |
l = 1 - j; |
| 275 |
/* Computing MIN */ |
| 276 |
i__1 = *n, i__3 = j + *k; |
| 277 |
i__4 = j + 1; |
| 278 |
for (i__ = min(i__1,i__3); i__ >= i__4; --i__) { |
| 279 |
x[i__] += temp * a[l + i__ + j * a_dim1]; |
| 280 |
/* L50: */ |
| 281 |
} |
| 282 |
if (nounit) { |
| 283 |
x[j] *= a[j * a_dim1 + 1]; |
| 284 |
} |
| 285 |
} |
| 286 |
/* L60: */ |
| 287 |
} |
| 288 |
} else { |
| 289 |
kx += (*n - 1) * *incx; |
| 290 |
jx = kx; |
| 291 |
for (j = *n; j >= 1; --j) { |
| 292 |
if (x[jx] != 0.) { |
| 293 |
temp = x[jx]; |
| 294 |
ix = kx; |
| 295 |
l = 1 - j; |
| 296 |
/* Computing MIN */ |
| 297 |
i__4 = *n, i__1 = j + *k; |
| 298 |
i__3 = j + 1; |
| 299 |
for (i__ = min(i__4,i__1); i__ >= i__3; --i__) { |
| 300 |
x[ix] += temp * a[l + i__ + j * a_dim1]; |
| 301 |
ix -= *incx; |
| 302 |
/* L70: */ |
| 303 |
} |
| 304 |
if (nounit) { |
| 305 |
x[jx] *= a[j * a_dim1 + 1]; |
| 306 |
} |
| 307 |
} |
| 308 |
jx -= *incx; |
| 309 |
if (*n - j >= *k) { |
| 310 |
kx -= *incx; |
| 311 |
} |
| 312 |
/* L80: */ |
| 313 |
} |
| 314 |
} |
| 315 |
} |
| 316 |
} else { |
| 317 |
|
| 318 |
/* Form x := A'*x. */ |
| 319 |
|
| 320 |
if (lsame_(uplo, "U", (ftnlen)1, (ftnlen)1)) { |
| 321 |
kplus1 = *k + 1; |
| 322 |
if (*incx == 1) { |
| 323 |
for (j = *n; j >= 1; --j) { |
| 324 |
temp = x[j]; |
| 325 |
l = kplus1 - j; |
| 326 |
if (nounit) { |
| 327 |
temp *= a[kplus1 + j * a_dim1]; |
| 328 |
} |
| 329 |
/* Computing MAX */ |
| 330 |
i__4 = 1, i__1 = j - *k; |
| 331 |
i__3 = max(i__4,i__1); |
| 332 |
for (i__ = j - 1; i__ >= i__3; --i__) { |
| 333 |
temp += a[l + i__ + j * a_dim1] * x[i__]; |
| 334 |
/* L90: */ |
| 335 |
} |
| 336 |
x[j] = temp; |
| 337 |
/* L100: */ |
| 338 |
} |
| 339 |
} else { |
| 340 |
kx += (*n - 1) * *incx; |
| 341 |
jx = kx; |
| 342 |
for (j = *n; j >= 1; --j) { |
| 343 |
temp = x[jx]; |
| 344 |
kx -= *incx; |
| 345 |
ix = kx; |
| 346 |
l = kplus1 - j; |
| 347 |
if (nounit) { |
| 348 |
temp *= a[kplus1 + j * a_dim1]; |
| 349 |
} |
| 350 |
/* Computing MAX */ |
| 351 |
i__4 = 1, i__1 = j - *k; |
| 352 |
i__3 = max(i__4,i__1); |
| 353 |
for (i__ = j - 1; i__ >= i__3; --i__) { |
| 354 |
temp += a[l + i__ + j * a_dim1] * x[ix]; |
| 355 |
ix -= *incx; |
| 356 |
/* L110: */ |
| 357 |
} |
| 358 |
x[jx] = temp; |
| 359 |
jx -= *incx; |
| 360 |
/* L120: */ |
| 361 |
} |
| 362 |
} |
| 363 |
} else { |
| 364 |
if (*incx == 1) { |
| 365 |
i__3 = *n; |
| 366 |
for (j = 1; j <= i__3; ++j) { |
| 367 |
temp = x[j]; |
| 368 |
l = 1 - j; |
| 369 |
if (nounit) { |
| 370 |
temp *= a[j * a_dim1 + 1]; |
| 371 |
} |
| 372 |
/* Computing MIN */ |
| 373 |
i__1 = *n, i__2 = j + *k; |
| 374 |
i__4 = min(i__1,i__2); |
| 375 |
for (i__ = j + 1; i__ <= i__4; ++i__) { |
| 376 |
temp += a[l + i__ + j * a_dim1] * x[i__]; |
| 377 |
/* L130: */ |
| 378 |
} |
| 379 |
x[j] = temp; |
| 380 |
/* L140: */ |
| 381 |
} |
| 382 |
} else { |
| 383 |
jx = kx; |
| 384 |
i__3 = *n; |
| 385 |
for (j = 1; j <= i__3; ++j) { |
| 386 |
temp = x[jx]; |
| 387 |
kx += *incx; |
| 388 |
ix = kx; |
| 389 |
l = 1 - j; |
| 390 |
if (nounit) { |
| 391 |
temp *= a[j * a_dim1 + 1]; |
| 392 |
} |
| 393 |
/* Computing MIN */ |
| 394 |
i__1 = *n, i__2 = j + *k; |
| 395 |
i__4 = min(i__1,i__2); |
| 396 |
for (i__ = j + 1; i__ <= i__4; ++i__) { |
| 397 |
temp += a[l + i__ + j * a_dim1] * x[ix]; |
| 398 |
ix += *incx; |
| 399 |
/* L150: */ |
| 400 |
} |
| 401 |
x[jx] = temp; |
| 402 |
jx += *incx; |
| 403 |
/* L160: */ |
| 404 |
} |
| 405 |
} |
| 406 |
} |
| 407 |
} |
| 408 |
|
| 409 |
return 0; |
| 410 |
|
| 411 |
/* End of DTBMV . */ |
| 412 |
|
| 413 |
} /* dtbmv_ */ |
| 414 |
|