00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #include "f2c.h"
00014 #include "blaswrap.h"
00015
00016 int zla_gbamv__(integer *trans, integer *m, integer *n,
00017 integer *kl, integer *ku, doublereal *alpha, doublecomplex *ab,
00018 integer *ldab, doublecomplex *x, integer *incx, doublereal *beta,
00019 doublereal *y, integer *incy)
00020 {
00021
00022 integer ab_dim1, ab_offset, i__1, i__2, i__3, i__4;
00023 doublereal d__1, d__2;
00024
00025
00026 double d_imag(doublecomplex *), d_sign(doublereal *, doublereal *);
00027
00028
00029 extern integer ilatrans_(char *);
00030 integer i__, j;
00031 logical symb_zero__;
00032 integer kd, iy, jx, kx, ky, info;
00033 doublereal temp;
00034 integer lenx, leny;
00035 doublereal safe1;
00036 extern doublereal dlamch_(char *);
00037 extern int xerbla_(char *, integer *);
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172 ab_dim1 = *ldab;
00173 ab_offset = 1 + ab_dim1;
00174 ab -= ab_offset;
00175 --x;
00176 --y;
00177
00178
00179 info = 0;
00180 if (! (*trans == ilatrans_("N") || *trans == ilatrans_("T") || *trans == ilatrans_("C"))) {
00181 info = 1;
00182 } else if (*m < 0) {
00183 info = 2;
00184 } else if (*n < 0) {
00185 info = 3;
00186 } else if (*kl < 0) {
00187 info = 4;
00188 } else if (*ku < 0) {
00189 info = 5;
00190 } else if (*ldab < *kl + *ku + 1) {
00191 info = 6;
00192 } else if (*incx == 0) {
00193 info = 8;
00194 } else if (*incy == 0) {
00195 info = 11;
00196 }
00197 if (info != 0) {
00198 xerbla_("ZLA_GBAMV ", &info);
00199 return 0;
00200 }
00201
00202
00203
00204 if (*m == 0 || *n == 0 || *alpha == 0. && *beta == 1.) {
00205 return 0;
00206 }
00207
00208
00209
00210
00211 if (*trans == ilatrans_("N")) {
00212 lenx = *n;
00213 leny = *m;
00214 } else {
00215 lenx = *m;
00216 leny = *n;
00217 }
00218 if (*incx > 0) {
00219 kx = 1;
00220 } else {
00221 kx = 1 - (lenx - 1) * *incx;
00222 }
00223 if (*incy > 0) {
00224 ky = 1;
00225 } else {
00226 ky = 1 - (leny - 1) * *incy;
00227 }
00228
00229
00230
00231
00232 safe1 = dlamch_("Safe minimum");
00233 safe1 = (*n + 1) * safe1;
00234
00235
00236
00237
00238
00239
00240
00241 kd = *ku + 1;
00242 iy = ky;
00243 if (*incx == 1) {
00244 i__1 = leny;
00245 for (i__ = 1; i__ <= i__1; ++i__) {
00246 if (*beta == 0.) {
00247 symb_zero__ = TRUE_;
00248 y[iy] = 0.;
00249 } else if (y[iy] == 0.) {
00250 symb_zero__ = TRUE_;
00251 } else {
00252 symb_zero__ = FALSE_;
00253 y[iy] = *beta * (d__1 = y[iy], abs(d__1));
00254 }
00255 if (*alpha != 0.) {
00256
00257 i__2 = i__ - *ku;
00258
00259 i__4 = i__ + *kl;
00260 i__3 = min(i__4,lenx);
00261 for (j = max(i__2,1); j <= i__3; ++j) {
00262 if (*trans == ilatrans_("N")) {
00263 i__2 = kd + i__ - j + j * ab_dim1;
00264 temp = (d__1 = ab[i__2].r, abs(d__1)) + (d__2 =
00265 d_imag(&ab[kd + i__ - j + j * ab_dim1]), abs(
00266 d__2));
00267 } else {
00268 i__2 = j + (kd + i__ - j) * ab_dim1;
00269 temp = (d__1 = ab[i__2].r, abs(d__1)) + (d__2 =
00270 d_imag(&ab[j + (kd + i__ - j) * ab_dim1]),
00271 abs(d__2));
00272 }
00273 i__2 = j;
00274 symb_zero__ = symb_zero__ && (x[i__2].r == 0. && x[i__2]
00275 .i == 0. || temp == 0.);
00276 i__2 = j;
00277 y[iy] += *alpha * ((d__1 = x[i__2].r, abs(d__1)) + (d__2 =
00278 d_imag(&x[j]), abs(d__2))) * temp;
00279 }
00280 }
00281 if (! symb_zero__) {
00282 y[iy] += d_sign(&safe1, &y[iy]);
00283 }
00284 iy += *incy;
00285 }
00286 } else {
00287 i__1 = leny;
00288 for (i__ = 1; i__ <= i__1; ++i__) {
00289 if (*beta == 0.) {
00290 symb_zero__ = TRUE_;
00291 y[iy] = 0.;
00292 } else if (y[iy] == 0.) {
00293 symb_zero__ = TRUE_;
00294 } else {
00295 symb_zero__ = FALSE_;
00296 y[iy] = *beta * (d__1 = y[iy], abs(d__1));
00297 }
00298 if (*alpha != 0.) {
00299 jx = kx;
00300
00301 i__3 = i__ - *ku;
00302
00303 i__4 = i__ + *kl;
00304 i__2 = min(i__4,lenx);
00305 for (j = max(i__3,1); j <= i__2; ++j) {
00306 if (*trans == ilatrans_("N")) {
00307 i__3 = kd + i__ - j + j * ab_dim1;
00308 temp = (d__1 = ab[i__3].r, abs(d__1)) + (d__2 =
00309 d_imag(&ab[kd + i__ - j + j * ab_dim1]), abs(
00310 d__2));
00311 } else {
00312 i__3 = j + (kd + i__ - j) * ab_dim1;
00313 temp = (d__1 = ab[i__3].r, abs(d__1)) + (d__2 =
00314 d_imag(&ab[j + (kd + i__ - j) * ab_dim1]),
00315 abs(d__2));
00316 }
00317 i__3 = jx;
00318 symb_zero__ = symb_zero__ && (x[i__3].r == 0. && x[i__3]
00319 .i == 0. || temp == 0.);
00320 i__3 = jx;
00321 y[iy] += *alpha * ((d__1 = x[i__3].r, abs(d__1)) + (d__2 =
00322 d_imag(&x[jx]), abs(d__2))) * temp;
00323 jx += *incx;
00324 }
00325 }
00326 if (! symb_zero__) {
00327 y[iy] += d_sign(&safe1, &y[iy]);
00328 }
00329 iy += *incy;
00330 }
00331 }
00332
00333 return 0;
00334
00335
00336
00337 }