| 1 |
/* ./src_f77/dgbmv.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 dgbmv_(char *trans, integer *m, integer *n, integer *kl, |
| 9 |
integer *ku, doublereal *alpha, doublereal *a, integer *lda, |
| 10 |
doublereal *x, integer *incx, doublereal *beta, doublereal *y, |
| 11 |
integer *incy, ftnlen trans_len) |
| 12 |
{ |
| 13 |
/* System generated locals */ |
| 14 |
integer a_dim1, a_offset, i__1, i__2, i__3, i__4, i__5, i__6; |
| 15 |
|
| 16 |
/* Local variables */ |
| 17 |
static integer i__, j, k, ix, iy, jx, jy, kx, ky, kup1, info; |
| 18 |
static doublereal temp; |
| 19 |
static integer lenx, leny; |
| 20 |
extern logical lsame_(char *, char *, ftnlen, ftnlen); |
| 21 |
extern /* Subroutine */ int xerbla_(char *, integer *, ftnlen); |
| 22 |
|
| 23 |
/* .. Scalar Arguments .. */ |
| 24 |
/* .. Array Arguments .. */ |
| 25 |
/* .. */ |
| 26 |
|
| 27 |
/* Purpose */ |
| 28 |
/* ======= */ |
| 29 |
|
| 30 |
/* DGBMV performs one of the matrix-vector operations */ |
| 31 |
|
| 32 |
/* y := alpha*A*x + beta*y, or y := alpha*A'*x + beta*y, */ |
| 33 |
|
| 34 |
/* where alpha and beta are scalars, x and y are vectors and A is an */ |
| 35 |
/* m by n band matrix, with kl sub-diagonals and ku super-diagonals. */ |
| 36 |
|
| 37 |
/* Parameters */ |
| 38 |
/* ========== */ |
| 39 |
|
| 40 |
/* TRANS - CHARACTER*1. */ |
| 41 |
/* On entry, TRANS specifies the operation to be performed as */ |
| 42 |
/* follows: */ |
| 43 |
|
| 44 |
/* TRANS = 'N' or 'n' y := alpha*A*x + beta*y. */ |
| 45 |
|
| 46 |
/* TRANS = 'T' or 't' y := alpha*A'*x + beta*y. */ |
| 47 |
|
| 48 |
/* TRANS = 'C' or 'c' y := alpha*A'*x + beta*y. */ |
| 49 |
|
| 50 |
/* Unchanged on exit. */ |
| 51 |
|
| 52 |
/* M - INTEGER. */ |
| 53 |
/* On entry, M specifies the number of rows of the matrix A. */ |
| 54 |
/* M must be at least zero. */ |
| 55 |
/* Unchanged on exit. */ |
| 56 |
|
| 57 |
/* N - INTEGER. */ |
| 58 |
/* On entry, N specifies the number of columns of the matrix A. */ |
| 59 |
/* N must be at least zero. */ |
| 60 |
/* Unchanged on exit. */ |
| 61 |
|
| 62 |
/* KL - INTEGER. */ |
| 63 |
/* On entry, KL specifies the number of sub-diagonals of the */ |
| 64 |
/* matrix A. KL must satisfy 0 .le. KL. */ |
| 65 |
/* Unchanged on exit. */ |
| 66 |
|
| 67 |
/* KU - INTEGER. */ |
| 68 |
/* On entry, KU specifies the number of super-diagonals of the */ |
| 69 |
/* matrix A. KU must satisfy 0 .le. KU. */ |
| 70 |
/* Unchanged on exit. */ |
| 71 |
|
| 72 |
/* ALPHA - DOUBLE PRECISION. */ |
| 73 |
/* On entry, ALPHA specifies the scalar alpha. */ |
| 74 |
/* Unchanged on exit. */ |
| 75 |
|
| 76 |
/* A - DOUBLE PRECISION array of DIMENSION ( LDA, n ). */ |
| 77 |
/* Before entry, the leading ( kl + ku + 1 ) by n part of the */ |
| 78 |
/* array A must contain the matrix of coefficients, supplied */ |
| 79 |
/* column by column, with the leading diagonal of the matrix in */ |
| 80 |
/* row ( ku + 1 ) of the array, the first super-diagonal */ |
| 81 |
/* starting at position 2 in row ku, the first sub-diagonal */ |
| 82 |
/* starting at position 1 in row ( ku + 2 ), and so on. */ |
| 83 |
/* Elements in the array A that do not correspond to elements */ |
| 84 |
/* in the band matrix (such as the top left ku by ku triangle) */ |
| 85 |
/* are not referenced. */ |
| 86 |
/* The following program segment will transfer a band matrix */ |
| 87 |
/* from conventional full matrix storage to band storage: */ |
| 88 |
|
| 89 |
/* DO 20, J = 1, N */ |
| 90 |
/* K = KU + 1 - J */ |
| 91 |
/* DO 10, I = MAX( 1, J - KU ), MIN( M, J + KL ) */ |
| 92 |
/* A( K + I, J ) = matrix( I, J ) */ |
| 93 |
/* 10 CONTINUE */ |
| 94 |
/* 20 CONTINUE */ |
| 95 |
|
| 96 |
/* Unchanged on exit. */ |
| 97 |
|
| 98 |
/* LDA - INTEGER. */ |
| 99 |
/* On entry, LDA specifies the first dimension of A as declared */ |
| 100 |
/* in the calling (sub) program. LDA must be at least */ |
| 101 |
/* ( kl + ku + 1 ). */ |
| 102 |
/* Unchanged on exit. */ |
| 103 |
|
| 104 |
/* X - DOUBLE PRECISION array of DIMENSION at least */ |
| 105 |
/* ( 1 + ( n - 1 )*abs( INCX ) ) when TRANS = 'N' or 'n' */ |
| 106 |
/* and at least */ |
| 107 |
/* ( 1 + ( m - 1 )*abs( INCX ) ) otherwise. */ |
| 108 |
/* Before entry, the incremented array X must contain the */ |
| 109 |
/* vector x. */ |
| 110 |
/* Unchanged on exit. */ |
| 111 |
|
| 112 |
/* INCX - INTEGER. */ |
| 113 |
/* On entry, INCX specifies the increment for the elements of */ |
| 114 |
/* X. INCX must not be zero. */ |
| 115 |
/* Unchanged on exit. */ |
| 116 |
|
| 117 |
/* BETA - DOUBLE PRECISION. */ |
| 118 |
/* On entry, BETA specifies the scalar beta. When BETA is */ |
| 119 |
/* supplied as zero then Y need not be set on input. */ |
| 120 |
/* Unchanged on exit. */ |
| 121 |
|
| 122 |
/* Y - DOUBLE PRECISION array of DIMENSION at least */ |
| 123 |
/* ( 1 + ( m - 1 )*abs( INCY ) ) when TRANS = 'N' or 'n' */ |
| 124 |
/* and at least */ |
| 125 |
/* ( 1 + ( n - 1 )*abs( INCY ) ) otherwise. */ |
| 126 |
/* Before entry, the incremented array Y must contain the */ |
| 127 |
/* vector y. On exit, Y is overwritten by the updated vector y. */ |
| 128 |
|
| 129 |
/* INCY - INTEGER. */ |
| 130 |
/* On entry, INCY specifies the increment for the elements of */ |
| 131 |
/* Y. INCY must not be zero. */ |
| 132 |
/* Unchanged on exit. */ |
| 133 |
|
| 134 |
|
| 135 |
/* Level 2 Blas routine. */ |
| 136 |
|
| 137 |
/* -- Written on 22-October-1986. */ |
| 138 |
/* Jack Dongarra, Argonne National Lab. */ |
| 139 |
/* Jeremy Du Croz, Nag Central Office. */ |
| 140 |
/* Sven Hammarling, Nag Central Office. */ |
| 141 |
/* Richard Hanson, Sandia National Labs. */ |
| 142 |
|
| 143 |
/* .. Parameters .. */ |
| 144 |
/* .. Local Scalars .. */ |
| 145 |
/* .. External Functions .. */ |
| 146 |
/* .. External Subroutines .. */ |
| 147 |
/* .. Intrinsic Functions .. */ |
| 148 |
/* .. */ |
| 149 |
/* .. Executable Statements .. */ |
| 150 |
|
| 151 |
/* Test the input parameters. */ |
| 152 |
|
| 153 |
/* Parameter adjustments */ |
| 154 |
a_dim1 = *lda; |
| 155 |
a_offset = 1 + a_dim1; |
| 156 |
a -= a_offset; |
| 157 |
--x; |
| 158 |
--y; |
| 159 |
|
| 160 |
/* Function Body */ |
| 161 |
info = 0; |
| 162 |
if (! lsame_(trans, "N", (ftnlen)1, (ftnlen)1) && ! lsame_(trans, "T", ( |
| 163 |
ftnlen)1, (ftnlen)1) && ! lsame_(trans, "C", (ftnlen)1, (ftnlen)1) |
| 164 |
) { |
| 165 |
info = 1; |
| 166 |
} else if (*m < 0) { |
| 167 |
info = 2; |
| 168 |
} else if (*n < 0) { |
| 169 |
info = 3; |
| 170 |
} else if (*kl < 0) { |
| 171 |
info = 4; |
| 172 |
} else if (*ku < 0) { |
| 173 |
info = 5; |
| 174 |
} else if (*lda < *kl + *ku + 1) { |
| 175 |
info = 8; |
| 176 |
} else if (*incx == 0) { |
| 177 |
info = 10; |
| 178 |
} else if (*incy == 0) { |
| 179 |
info = 13; |
| 180 |
} |
| 181 |
if (info != 0) { |
| 182 |
xerbla_("DGBMV ", &info, (ftnlen)6); |
| 183 |
return 0; |
| 184 |
} |
| 185 |
|
| 186 |
/* Quick return if possible. */ |
| 187 |
|
| 188 |
if (*m == 0 || *n == 0 || *alpha == 0. && *beta == 1.) { |
| 189 |
return 0; |
| 190 |
} |
| 191 |
|
| 192 |
/* Set LENX and LENY, the lengths of the vectors x and y, and set */ |
| 193 |
/* up the start points in X and Y. */ |
| 194 |
|
| 195 |
if (lsame_(trans, "N", (ftnlen)1, (ftnlen)1)) { |
| 196 |
lenx = *n; |
| 197 |
leny = *m; |
| 198 |
} else { |
| 199 |
lenx = *m; |
| 200 |
leny = *n; |
| 201 |
} |
| 202 |
if (*incx > 0) { |
| 203 |
kx = 1; |
| 204 |
} else { |
| 205 |
kx = 1 - (lenx - 1) * *incx; |
| 206 |
} |
| 207 |
if (*incy > 0) { |
| 208 |
ky = 1; |
| 209 |
} else { |
| 210 |
ky = 1 - (leny - 1) * *incy; |
| 211 |
} |
| 212 |
|
| 213 |
/* Start the operations. In this version the elements of A are */ |
| 214 |
/* accessed sequentially with one pass through the band part of A. */ |
| 215 |
|
| 216 |
/* First form y := beta*y. */ |
| 217 |
|
| 218 |
if (*beta != 1.) { |
| 219 |
if (*incy == 1) { |
| 220 |
if (*beta == 0.) { |
| 221 |
i__1 = leny; |
| 222 |
for (i__ = 1; i__ <= i__1; ++i__) { |
| 223 |
y[i__] = 0.; |
| 224 |
/* L10: */ |
| 225 |
} |
| 226 |
} else { |
| 227 |
i__1 = leny; |
| 228 |
for (i__ = 1; i__ <= i__1; ++i__) { |
| 229 |
y[i__] = *beta * y[i__]; |
| 230 |
/* L20: */ |
| 231 |
} |
| 232 |
} |
| 233 |
} else { |
| 234 |
iy = ky; |
| 235 |
if (*beta == 0.) { |
| 236 |
i__1 = leny; |
| 237 |
for (i__ = 1; i__ <= i__1; ++i__) { |
| 238 |
y[iy] = 0.; |
| 239 |
iy += *incy; |
| 240 |
/* L30: */ |
| 241 |
} |
| 242 |
} else { |
| 243 |
i__1 = leny; |
| 244 |
for (i__ = 1; i__ <= i__1; ++i__) { |
| 245 |
y[iy] = *beta * y[iy]; |
| 246 |
iy += *incy; |
| 247 |
/* L40: */ |
| 248 |
} |
| 249 |
} |
| 250 |
} |
| 251 |
} |
| 252 |
if (*alpha == 0.) { |
| 253 |
return 0; |
| 254 |
} |
| 255 |
kup1 = *ku + 1; |
| 256 |
if (lsame_(trans, "N", (ftnlen)1, (ftnlen)1)) { |
| 257 |
|
| 258 |
/* Form y := alpha*A*x + y. */ |
| 259 |
|
| 260 |
jx = kx; |
| 261 |
if (*incy == 1) { |
| 262 |
i__1 = *n; |
| 263 |
for (j = 1; j <= i__1; ++j) { |
| 264 |
if (x[jx] != 0.) { |
| 265 |
temp = *alpha * x[jx]; |
| 266 |
k = kup1 - j; |
| 267 |
/* Computing MAX */ |
| 268 |
i__2 = 1, i__3 = j - *ku; |
| 269 |
/* Computing MIN */ |
| 270 |
i__5 = *m, i__6 = j + *kl; |
| 271 |
i__4 = min(i__5,i__6); |
| 272 |
for (i__ = max(i__2,i__3); i__ <= i__4; ++i__) { |
| 273 |
y[i__] += temp * a[k + i__ + j * a_dim1]; |
| 274 |
/* L50: */ |
| 275 |
} |
| 276 |
} |
| 277 |
jx += *incx; |
| 278 |
/* L60: */ |
| 279 |
} |
| 280 |
} else { |
| 281 |
i__1 = *n; |
| 282 |
for (j = 1; j <= i__1; ++j) { |
| 283 |
if (x[jx] != 0.) { |
| 284 |
temp = *alpha * x[jx]; |
| 285 |
iy = ky; |
| 286 |
k = kup1 - j; |
| 287 |
/* Computing MAX */ |
| 288 |
i__4 = 1, i__2 = j - *ku; |
| 289 |
/* Computing MIN */ |
| 290 |
i__5 = *m, i__6 = j + *kl; |
| 291 |
i__3 = min(i__5,i__6); |
| 292 |
for (i__ = max(i__4,i__2); i__ <= i__3; ++i__) { |
| 293 |
y[iy] += temp * a[k + i__ + j * a_dim1]; |
| 294 |
iy += *incy; |
| 295 |
/* L70: */ |
| 296 |
} |
| 297 |
} |
| 298 |
jx += *incx; |
| 299 |
if (j > *ku) { |
| 300 |
ky += *incy; |
| 301 |
} |
| 302 |
/* L80: */ |
| 303 |
} |
| 304 |
} |
| 305 |
} else { |
| 306 |
|
| 307 |
/* Form y := alpha*A'*x + y. */ |
| 308 |
|
| 309 |
jy = ky; |
| 310 |
if (*incx == 1) { |
| 311 |
i__1 = *n; |
| 312 |
for (j = 1; j <= i__1; ++j) { |
| 313 |
temp = 0.; |
| 314 |
k = kup1 - j; |
| 315 |
/* Computing MAX */ |
| 316 |
i__3 = 1, i__4 = j - *ku; |
| 317 |
/* Computing MIN */ |
| 318 |
i__5 = *m, i__6 = j + *kl; |
| 319 |
i__2 = min(i__5,i__6); |
| 320 |
for (i__ = max(i__3,i__4); i__ <= i__2; ++i__) { |
| 321 |
temp += a[k + i__ + j * a_dim1] * x[i__]; |
| 322 |
/* L90: */ |
| 323 |
} |
| 324 |
y[jy] += *alpha * temp; |
| 325 |
jy += *incy; |
| 326 |
/* L100: */ |
| 327 |
} |
| 328 |
} else { |
| 329 |
i__1 = *n; |
| 330 |
for (j = 1; j <= i__1; ++j) { |
| 331 |
temp = 0.; |
| 332 |
ix = kx; |
| 333 |
k = kup1 - j; |
| 334 |
/* Computing MAX */ |
| 335 |
i__2 = 1, i__3 = j - *ku; |
| 336 |
/* Computing MIN */ |
| 337 |
i__5 = *m, i__6 = j + *kl; |
| 338 |
i__4 = min(i__5,i__6); |
| 339 |
for (i__ = max(i__2,i__3); i__ <= i__4; ++i__) { |
| 340 |
temp += a[k + i__ + j * a_dim1] * x[ix]; |
| 341 |
ix += *incx; |
| 342 |
/* L110: */ |
| 343 |
} |
| 344 |
y[jy] += *alpha * temp; |
| 345 |
jy += *incy; |
| 346 |
if (j > *ku) { |
| 347 |
kx += *incx; |
| 348 |
} |
| 349 |
/* L120: */ |
| 350 |
} |
| 351 |
} |
| 352 |
} |
| 353 |
|
| 354 |
return 0; |
| 355 |
|
| 356 |
/* End of DGBMV . */ |
| 357 |
|
| 358 |
} /* dgbmv_ */ |
| 359 |
|