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