00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #include "f2c.h"
00014 #include "blaswrap.h"
00015
00016 int chbmv_(char *uplo, integer *n, integer *k, complex *
00017 alpha, complex *a, integer *lda, complex *x, integer *incx, complex *
00018 beta, complex *y, integer *incy)
00019 {
00020
00021 integer a_dim1, a_offset, i__1, i__2, i__3, i__4, i__5;
00022 real r__1;
00023 complex q__1, q__2, q__3, q__4;
00024
00025
00026 void r_cnjg(complex *, complex *);
00027
00028
00029 integer i__, j, l, ix, iy, jx, jy, kx, ky, info;
00030 complex temp1, temp2;
00031 extern logical lsame_(char *, char *);
00032 integer kplus1;
00033 extern int xerbla_(char *, integer *);
00034
00035
00036
00037
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
00173
00174
00175
00176 a_dim1 = *lda;
00177 a_offset = 1 + a_dim1;
00178 a -= a_offset;
00179 --x;
00180 --y;
00181
00182
00183 info = 0;
00184 if (! lsame_(uplo, "U") && ! lsame_(uplo, "L")) {
00185 info = 1;
00186 } else if (*n < 0) {
00187 info = 2;
00188 } else if (*k < 0) {
00189 info = 3;
00190 } else if (*lda < *k + 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_("CHBMV ", &info);
00199 return 0;
00200 }
00201
00202
00203
00204 if (*n == 0 || alpha->r == 0.f && alpha->i == 0.f && (beta->r == 1.f &&
00205 beta->i == 0.f)) {
00206 return 0;
00207 }
00208
00209
00210
00211 if (*incx > 0) {
00212 kx = 1;
00213 } else {
00214 kx = 1 - (*n - 1) * *incx;
00215 }
00216 if (*incy > 0) {
00217 ky = 1;
00218 } else {
00219 ky = 1 - (*n - 1) * *incy;
00220 }
00221
00222
00223
00224
00225
00226
00227 if (beta->r != 1.f || beta->i != 0.f) {
00228 if (*incy == 1) {
00229 if (beta->r == 0.f && beta->i == 0.f) {
00230 i__1 = *n;
00231 for (i__ = 1; i__ <= i__1; ++i__) {
00232 i__2 = i__;
00233 y[i__2].r = 0.f, y[i__2].i = 0.f;
00234
00235 }
00236 } else {
00237 i__1 = *n;
00238 for (i__ = 1; i__ <= i__1; ++i__) {
00239 i__2 = i__;
00240 i__3 = i__;
00241 q__1.r = beta->r * y[i__3].r - beta->i * y[i__3].i,
00242 q__1.i = beta->r * y[i__3].i + beta->i * y[i__3]
00243 .r;
00244 y[i__2].r = q__1.r, y[i__2].i = q__1.i;
00245
00246 }
00247 }
00248 } else {
00249 iy = ky;
00250 if (beta->r == 0.f && beta->i == 0.f) {
00251 i__1 = *n;
00252 for (i__ = 1; i__ <= i__1; ++i__) {
00253 i__2 = iy;
00254 y[i__2].r = 0.f, y[i__2].i = 0.f;
00255 iy += *incy;
00256
00257 }
00258 } else {
00259 i__1 = *n;
00260 for (i__ = 1; i__ <= i__1; ++i__) {
00261 i__2 = iy;
00262 i__3 = iy;
00263 q__1.r = beta->r * y[i__3].r - beta->i * y[i__3].i,
00264 q__1.i = beta->r * y[i__3].i + beta->i * y[i__3]
00265 .r;
00266 y[i__2].r = q__1.r, y[i__2].i = q__1.i;
00267 iy += *incy;
00268
00269 }
00270 }
00271 }
00272 }
00273 if (alpha->r == 0.f && alpha->i == 0.f) {
00274 return 0;
00275 }
00276 if (lsame_(uplo, "U")) {
00277
00278
00279
00280 kplus1 = *k + 1;
00281 if (*incx == 1 && *incy == 1) {
00282 i__1 = *n;
00283 for (j = 1; j <= i__1; ++j) {
00284 i__2 = j;
00285 q__1.r = alpha->r * x[i__2].r - alpha->i * x[i__2].i, q__1.i =
00286 alpha->r * x[i__2].i + alpha->i * x[i__2].r;
00287 temp1.r = q__1.r, temp1.i = q__1.i;
00288 temp2.r = 0.f, temp2.i = 0.f;
00289 l = kplus1 - j;
00290
00291 i__2 = 1, i__3 = j - *k;
00292 i__4 = j - 1;
00293 for (i__ = max(i__2,i__3); i__ <= i__4; ++i__) {
00294 i__2 = i__;
00295 i__3 = i__;
00296 i__5 = l + i__ + j * a_dim1;
00297 q__2.r = temp1.r * a[i__5].r - temp1.i * a[i__5].i,
00298 q__2.i = temp1.r * a[i__5].i + temp1.i * a[i__5]
00299 .r;
00300 q__1.r = y[i__3].r + q__2.r, q__1.i = y[i__3].i + q__2.i;
00301 y[i__2].r = q__1.r, y[i__2].i = q__1.i;
00302 r_cnjg(&q__3, &a[l + i__ + j * a_dim1]);
00303 i__2 = i__;
00304 q__2.r = q__3.r * x[i__2].r - q__3.i * x[i__2].i, q__2.i =
00305 q__3.r * x[i__2].i + q__3.i * x[i__2].r;
00306 q__1.r = temp2.r + q__2.r, q__1.i = temp2.i + q__2.i;
00307 temp2.r = q__1.r, temp2.i = q__1.i;
00308
00309 }
00310 i__4 = j;
00311 i__2 = j;
00312 i__3 = kplus1 + j * a_dim1;
00313 r__1 = a[i__3].r;
00314 q__3.r = r__1 * temp1.r, q__3.i = r__1 * temp1.i;
00315 q__2.r = y[i__2].r + q__3.r, q__2.i = y[i__2].i + q__3.i;
00316 q__4.r = alpha->r * temp2.r - alpha->i * temp2.i, q__4.i =
00317 alpha->r * temp2.i + alpha->i * temp2.r;
00318 q__1.r = q__2.r + q__4.r, q__1.i = q__2.i + q__4.i;
00319 y[i__4].r = q__1.r, y[i__4].i = q__1.i;
00320
00321 }
00322 } else {
00323 jx = kx;
00324 jy = ky;
00325 i__1 = *n;
00326 for (j = 1; j <= i__1; ++j) {
00327 i__4 = jx;
00328 q__1.r = alpha->r * x[i__4].r - alpha->i * x[i__4].i, q__1.i =
00329 alpha->r * x[i__4].i + alpha->i * x[i__4].r;
00330 temp1.r = q__1.r, temp1.i = q__1.i;
00331 temp2.r = 0.f, temp2.i = 0.f;
00332 ix = kx;
00333 iy = ky;
00334 l = kplus1 - j;
00335
00336 i__4 = 1, i__2 = j - *k;
00337 i__3 = j - 1;
00338 for (i__ = max(i__4,i__2); i__ <= i__3; ++i__) {
00339 i__4 = iy;
00340 i__2 = iy;
00341 i__5 = l + i__ + j * a_dim1;
00342 q__2.r = temp1.r * a[i__5].r - temp1.i * a[i__5].i,
00343 q__2.i = temp1.r * a[i__5].i + temp1.i * a[i__5]
00344 .r;
00345 q__1.r = y[i__2].r + q__2.r, q__1.i = y[i__2].i + q__2.i;
00346 y[i__4].r = q__1.r, y[i__4].i = q__1.i;
00347 r_cnjg(&q__3, &a[l + i__ + j * a_dim1]);
00348 i__4 = ix;
00349 q__2.r = q__3.r * x[i__4].r - q__3.i * x[i__4].i, q__2.i =
00350 q__3.r * x[i__4].i + q__3.i * x[i__4].r;
00351 q__1.r = temp2.r + q__2.r, q__1.i = temp2.i + q__2.i;
00352 temp2.r = q__1.r, temp2.i = q__1.i;
00353 ix += *incx;
00354 iy += *incy;
00355
00356 }
00357 i__3 = jy;
00358 i__4 = jy;
00359 i__2 = kplus1 + j * a_dim1;
00360 r__1 = a[i__2].r;
00361 q__3.r = r__1 * temp1.r, q__3.i = r__1 * temp1.i;
00362 q__2.r = y[i__4].r + q__3.r, q__2.i = y[i__4].i + q__3.i;
00363 q__4.r = alpha->r * temp2.r - alpha->i * temp2.i, q__4.i =
00364 alpha->r * temp2.i + alpha->i * temp2.r;
00365 q__1.r = q__2.r + q__4.r, q__1.i = q__2.i + q__4.i;
00366 y[i__3].r = q__1.r, y[i__3].i = q__1.i;
00367 jx += *incx;
00368 jy += *incy;
00369 if (j > *k) {
00370 kx += *incx;
00371 ky += *incy;
00372 }
00373
00374 }
00375 }
00376 } else {
00377
00378
00379
00380 if (*incx == 1 && *incy == 1) {
00381 i__1 = *n;
00382 for (j = 1; j <= i__1; ++j) {
00383 i__3 = j;
00384 q__1.r = alpha->r * x[i__3].r - alpha->i * x[i__3].i, q__1.i =
00385 alpha->r * x[i__3].i + alpha->i * x[i__3].r;
00386 temp1.r = q__1.r, temp1.i = q__1.i;
00387 temp2.r = 0.f, temp2.i = 0.f;
00388 i__3 = j;
00389 i__4 = j;
00390 i__2 = j * a_dim1 + 1;
00391 r__1 = a[i__2].r;
00392 q__2.r = r__1 * temp1.r, q__2.i = r__1 * temp1.i;
00393 q__1.r = y[i__4].r + q__2.r, q__1.i = y[i__4].i + q__2.i;
00394 y[i__3].r = q__1.r, y[i__3].i = q__1.i;
00395 l = 1 - j;
00396
00397 i__4 = *n, i__2 = j + *k;
00398 i__3 = min(i__4,i__2);
00399 for (i__ = j + 1; i__ <= i__3; ++i__) {
00400 i__4 = i__;
00401 i__2 = i__;
00402 i__5 = l + i__ + j * a_dim1;
00403 q__2.r = temp1.r * a[i__5].r - temp1.i * a[i__5].i,
00404 q__2.i = temp1.r * a[i__5].i + temp1.i * a[i__5]
00405 .r;
00406 q__1.r = y[i__2].r + q__2.r, q__1.i = y[i__2].i + q__2.i;
00407 y[i__4].r = q__1.r, y[i__4].i = q__1.i;
00408 r_cnjg(&q__3, &a[l + i__ + j * a_dim1]);
00409 i__4 = i__;
00410 q__2.r = q__3.r * x[i__4].r - q__3.i * x[i__4].i, q__2.i =
00411 q__3.r * x[i__4].i + q__3.i * x[i__4].r;
00412 q__1.r = temp2.r + q__2.r, q__1.i = temp2.i + q__2.i;
00413 temp2.r = q__1.r, temp2.i = q__1.i;
00414
00415 }
00416 i__3 = j;
00417 i__4 = j;
00418 q__2.r = alpha->r * temp2.r - alpha->i * temp2.i, q__2.i =
00419 alpha->r * temp2.i + alpha->i * temp2.r;
00420 q__1.r = y[i__4].r + q__2.r, q__1.i = y[i__4].i + q__2.i;
00421 y[i__3].r = q__1.r, y[i__3].i = q__1.i;
00422
00423 }
00424 } else {
00425 jx = kx;
00426 jy = ky;
00427 i__1 = *n;
00428 for (j = 1; j <= i__1; ++j) {
00429 i__3 = jx;
00430 q__1.r = alpha->r * x[i__3].r - alpha->i * x[i__3].i, q__1.i =
00431 alpha->r * x[i__3].i + alpha->i * x[i__3].r;
00432 temp1.r = q__1.r, temp1.i = q__1.i;
00433 temp2.r = 0.f, temp2.i = 0.f;
00434 i__3 = jy;
00435 i__4 = jy;
00436 i__2 = j * a_dim1 + 1;
00437 r__1 = a[i__2].r;
00438 q__2.r = r__1 * temp1.r, q__2.i = r__1 * temp1.i;
00439 q__1.r = y[i__4].r + q__2.r, q__1.i = y[i__4].i + q__2.i;
00440 y[i__3].r = q__1.r, y[i__3].i = q__1.i;
00441 l = 1 - j;
00442 ix = jx;
00443 iy = jy;
00444
00445 i__4 = *n, i__2 = j + *k;
00446 i__3 = min(i__4,i__2);
00447 for (i__ = j + 1; i__ <= i__3; ++i__) {
00448 ix += *incx;
00449 iy += *incy;
00450 i__4 = iy;
00451 i__2 = iy;
00452 i__5 = l + i__ + j * a_dim1;
00453 q__2.r = temp1.r * a[i__5].r - temp1.i * a[i__5].i,
00454 q__2.i = temp1.r * a[i__5].i + temp1.i * a[i__5]
00455 .r;
00456 q__1.r = y[i__2].r + q__2.r, q__1.i = y[i__2].i + q__2.i;
00457 y[i__4].r = q__1.r, y[i__4].i = q__1.i;
00458 r_cnjg(&q__3, &a[l + i__ + j * a_dim1]);
00459 i__4 = ix;
00460 q__2.r = q__3.r * x[i__4].r - q__3.i * x[i__4].i, q__2.i =
00461 q__3.r * x[i__4].i + q__3.i * x[i__4].r;
00462 q__1.r = temp2.r + q__2.r, q__1.i = temp2.i + q__2.i;
00463 temp2.r = q__1.r, temp2.i = q__1.i;
00464
00465 }
00466 i__3 = jy;
00467 i__4 = jy;
00468 q__2.r = alpha->r * temp2.r - alpha->i * temp2.i, q__2.i =
00469 alpha->r * temp2.i + alpha->i * temp2.r;
00470 q__1.r = y[i__4].r + q__2.r, q__1.i = y[i__4].i + q__2.i;
00471 y[i__3].r = q__1.r, y[i__3].i = q__1.i;
00472 jx += *incx;
00473 jy += *incy;
00474
00475 }
00476 }
00477 }
00478
00479 return 0;
00480
00481
00482
00483 }