00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #include "f2c.h"
00014 #include "blaswrap.h"
00015
00016 int chemv_(char *uplo, integer *n, complex *alpha, complex *
00017 a, integer *lda, complex *x, integer *incx, complex *beta, complex *y,
00018 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, ix, iy, jx, jy, kx, ky, info;
00030 complex temp1, temp2;
00031 extern logical lsame_(char *, char *);
00032 extern int xerbla_(char *, integer *);
00033
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 a_dim1 = *lda;
00145 a_offset = 1 + a_dim1;
00146 a -= a_offset;
00147 --x;
00148 --y;
00149
00150
00151 info = 0;
00152 if (! lsame_(uplo, "U") && ! lsame_(uplo, "L")) {
00153 info = 1;
00154 } else if (*n < 0) {
00155 info = 2;
00156 } else if (*lda < max(1,*n)) {
00157 info = 5;
00158 } else if (*incx == 0) {
00159 info = 7;
00160 } else if (*incy == 0) {
00161 info = 10;
00162 }
00163 if (info != 0) {
00164 xerbla_("CHEMV ", &info);
00165 return 0;
00166 }
00167
00168
00169
00170 if (*n == 0 || alpha->r == 0.f && alpha->i == 0.f && (beta->r == 1.f &&
00171 beta->i == 0.f)) {
00172 return 0;
00173 }
00174
00175
00176
00177 if (*incx > 0) {
00178 kx = 1;
00179 } else {
00180 kx = 1 - (*n - 1) * *incx;
00181 }
00182 if (*incy > 0) {
00183 ky = 1;
00184 } else {
00185 ky = 1 - (*n - 1) * *incy;
00186 }
00187
00188
00189
00190
00191
00192
00193
00194 if (beta->r != 1.f || beta->i != 0.f) {
00195 if (*incy == 1) {
00196 if (beta->r == 0.f && beta->i == 0.f) {
00197 i__1 = *n;
00198 for (i__ = 1; i__ <= i__1; ++i__) {
00199 i__2 = i__;
00200 y[i__2].r = 0.f, y[i__2].i = 0.f;
00201
00202 }
00203 } else {
00204 i__1 = *n;
00205 for (i__ = 1; i__ <= i__1; ++i__) {
00206 i__2 = i__;
00207 i__3 = i__;
00208 q__1.r = beta->r * y[i__3].r - beta->i * y[i__3].i,
00209 q__1.i = beta->r * y[i__3].i + beta->i * y[i__3]
00210 .r;
00211 y[i__2].r = q__1.r, y[i__2].i = q__1.i;
00212
00213 }
00214 }
00215 } else {
00216 iy = ky;
00217 if (beta->r == 0.f && beta->i == 0.f) {
00218 i__1 = *n;
00219 for (i__ = 1; i__ <= i__1; ++i__) {
00220 i__2 = iy;
00221 y[i__2].r = 0.f, y[i__2].i = 0.f;
00222 iy += *incy;
00223
00224 }
00225 } else {
00226 i__1 = *n;
00227 for (i__ = 1; i__ <= i__1; ++i__) {
00228 i__2 = iy;
00229 i__3 = iy;
00230 q__1.r = beta->r * y[i__3].r - beta->i * y[i__3].i,
00231 q__1.i = beta->r * y[i__3].i + beta->i * y[i__3]
00232 .r;
00233 y[i__2].r = q__1.r, y[i__2].i = q__1.i;
00234 iy += *incy;
00235
00236 }
00237 }
00238 }
00239 }
00240 if (alpha->r == 0.f && alpha->i == 0.f) {
00241 return 0;
00242 }
00243 if (lsame_(uplo, "U")) {
00244
00245
00246
00247 if (*incx == 1 && *incy == 1) {
00248 i__1 = *n;
00249 for (j = 1; j <= i__1; ++j) {
00250 i__2 = j;
00251 q__1.r = alpha->r * x[i__2].r - alpha->i * x[i__2].i, q__1.i =
00252 alpha->r * x[i__2].i + alpha->i * x[i__2].r;
00253 temp1.r = q__1.r, temp1.i = q__1.i;
00254 temp2.r = 0.f, temp2.i = 0.f;
00255 i__2 = j - 1;
00256 for (i__ = 1; i__ <= i__2; ++i__) {
00257 i__3 = i__;
00258 i__4 = i__;
00259 i__5 = i__ + j * a_dim1;
00260 q__2.r = temp1.r * a[i__5].r - temp1.i * a[i__5].i,
00261 q__2.i = temp1.r * a[i__5].i + temp1.i * a[i__5]
00262 .r;
00263 q__1.r = y[i__4].r + q__2.r, q__1.i = y[i__4].i + q__2.i;
00264 y[i__3].r = q__1.r, y[i__3].i = q__1.i;
00265 r_cnjg(&q__3, &a[i__ + j * a_dim1]);
00266 i__3 = i__;
00267 q__2.r = q__3.r * x[i__3].r - q__3.i * x[i__3].i, q__2.i =
00268 q__3.r * x[i__3].i + q__3.i * x[i__3].r;
00269 q__1.r = temp2.r + q__2.r, q__1.i = temp2.i + q__2.i;
00270 temp2.r = q__1.r, temp2.i = q__1.i;
00271
00272 }
00273 i__2 = j;
00274 i__3 = j;
00275 i__4 = j + j * a_dim1;
00276 r__1 = a[i__4].r;
00277 q__3.r = r__1 * temp1.r, q__3.i = r__1 * temp1.i;
00278 q__2.r = y[i__3].r + q__3.r, q__2.i = y[i__3].i + q__3.i;
00279 q__4.r = alpha->r * temp2.r - alpha->i * temp2.i, q__4.i =
00280 alpha->r * temp2.i + alpha->i * temp2.r;
00281 q__1.r = q__2.r + q__4.r, q__1.i = q__2.i + q__4.i;
00282 y[i__2].r = q__1.r, y[i__2].i = q__1.i;
00283
00284 }
00285 } else {
00286 jx = kx;
00287 jy = ky;
00288 i__1 = *n;
00289 for (j = 1; j <= i__1; ++j) {
00290 i__2 = jx;
00291 q__1.r = alpha->r * x[i__2].r - alpha->i * x[i__2].i, q__1.i =
00292 alpha->r * x[i__2].i + alpha->i * x[i__2].r;
00293 temp1.r = q__1.r, temp1.i = q__1.i;
00294 temp2.r = 0.f, temp2.i = 0.f;
00295 ix = kx;
00296 iy = ky;
00297 i__2 = j - 1;
00298 for (i__ = 1; i__ <= i__2; ++i__) {
00299 i__3 = iy;
00300 i__4 = iy;
00301 i__5 = i__ + j * a_dim1;
00302 q__2.r = temp1.r * a[i__5].r - temp1.i * a[i__5].i,
00303 q__2.i = temp1.r * a[i__5].i + temp1.i * a[i__5]
00304 .r;
00305 q__1.r = y[i__4].r + q__2.r, q__1.i = y[i__4].i + q__2.i;
00306 y[i__3].r = q__1.r, y[i__3].i = q__1.i;
00307 r_cnjg(&q__3, &a[i__ + j * a_dim1]);
00308 i__3 = ix;
00309 q__2.r = q__3.r * x[i__3].r - q__3.i * x[i__3].i, q__2.i =
00310 q__3.r * x[i__3].i + q__3.i * x[i__3].r;
00311 q__1.r = temp2.r + q__2.r, q__1.i = temp2.i + q__2.i;
00312 temp2.r = q__1.r, temp2.i = q__1.i;
00313 ix += *incx;
00314 iy += *incy;
00315
00316 }
00317 i__2 = jy;
00318 i__3 = jy;
00319 i__4 = j + j * a_dim1;
00320 r__1 = a[i__4].r;
00321 q__3.r = r__1 * temp1.r, q__3.i = r__1 * temp1.i;
00322 q__2.r = y[i__3].r + q__3.r, q__2.i = y[i__3].i + q__3.i;
00323 q__4.r = alpha->r * temp2.r - alpha->i * temp2.i, q__4.i =
00324 alpha->r * temp2.i + alpha->i * temp2.r;
00325 q__1.r = q__2.r + q__4.r, q__1.i = q__2.i + q__4.i;
00326 y[i__2].r = q__1.r, y[i__2].i = q__1.i;
00327 jx += *incx;
00328 jy += *incy;
00329
00330 }
00331 }
00332 } else {
00333
00334
00335
00336 if (*incx == 1 && *incy == 1) {
00337 i__1 = *n;
00338 for (j = 1; j <= i__1; ++j) {
00339 i__2 = j;
00340 q__1.r = alpha->r * x[i__2].r - alpha->i * x[i__2].i, q__1.i =
00341 alpha->r * x[i__2].i + alpha->i * x[i__2].r;
00342 temp1.r = q__1.r, temp1.i = q__1.i;
00343 temp2.r = 0.f, temp2.i = 0.f;
00344 i__2 = j;
00345 i__3 = j;
00346 i__4 = j + j * a_dim1;
00347 r__1 = a[i__4].r;
00348 q__2.r = r__1 * temp1.r, q__2.i = r__1 * temp1.i;
00349 q__1.r = y[i__3].r + q__2.r, q__1.i = y[i__3].i + q__2.i;
00350 y[i__2].r = q__1.r, y[i__2].i = q__1.i;
00351 i__2 = *n;
00352 for (i__ = j + 1; i__ <= i__2; ++i__) {
00353 i__3 = i__;
00354 i__4 = i__;
00355 i__5 = i__ + j * a_dim1;
00356 q__2.r = temp1.r * a[i__5].r - temp1.i * a[i__5].i,
00357 q__2.i = temp1.r * a[i__5].i + temp1.i * a[i__5]
00358 .r;
00359 q__1.r = y[i__4].r + q__2.r, q__1.i = y[i__4].i + q__2.i;
00360 y[i__3].r = q__1.r, y[i__3].i = q__1.i;
00361 r_cnjg(&q__3, &a[i__ + j * a_dim1]);
00362 i__3 = i__;
00363 q__2.r = q__3.r * x[i__3].r - q__3.i * x[i__3].i, q__2.i =
00364 q__3.r * x[i__3].i + q__3.i * x[i__3].r;
00365 q__1.r = temp2.r + q__2.r, q__1.i = temp2.i + q__2.i;
00366 temp2.r = q__1.r, temp2.i = q__1.i;
00367
00368 }
00369 i__2 = j;
00370 i__3 = j;
00371 q__2.r = alpha->r * temp2.r - alpha->i * temp2.i, q__2.i =
00372 alpha->r * temp2.i + alpha->i * temp2.r;
00373 q__1.r = y[i__3].r + q__2.r, q__1.i = y[i__3].i + q__2.i;
00374 y[i__2].r = q__1.r, y[i__2].i = q__1.i;
00375
00376 }
00377 } else {
00378 jx = kx;
00379 jy = ky;
00380 i__1 = *n;
00381 for (j = 1; j <= i__1; ++j) {
00382 i__2 = jx;
00383 q__1.r = alpha->r * x[i__2].r - alpha->i * x[i__2].i, q__1.i =
00384 alpha->r * x[i__2].i + alpha->i * x[i__2].r;
00385 temp1.r = q__1.r, temp1.i = q__1.i;
00386 temp2.r = 0.f, temp2.i = 0.f;
00387 i__2 = jy;
00388 i__3 = jy;
00389 i__4 = j + j * a_dim1;
00390 r__1 = a[i__4].r;
00391 q__2.r = r__1 * temp1.r, q__2.i = r__1 * temp1.i;
00392 q__1.r = y[i__3].r + q__2.r, q__1.i = y[i__3].i + q__2.i;
00393 y[i__2].r = q__1.r, y[i__2].i = q__1.i;
00394 ix = jx;
00395 iy = jy;
00396 i__2 = *n;
00397 for (i__ = j + 1; i__ <= i__2; ++i__) {
00398 ix += *incx;
00399 iy += *incy;
00400 i__3 = iy;
00401 i__4 = iy;
00402 i__5 = 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__4].r + q__2.r, q__1.i = y[i__4].i + q__2.i;
00407 y[i__3].r = q__1.r, y[i__3].i = q__1.i;
00408 r_cnjg(&q__3, &a[i__ + j * a_dim1]);
00409 i__3 = ix;
00410 q__2.r = q__3.r * x[i__3].r - q__3.i * x[i__3].i, q__2.i =
00411 q__3.r * x[i__3].i + q__3.i * x[i__3].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__2 = jy;
00417 i__3 = jy;
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__3].r + q__2.r, q__1.i = y[i__3].i + q__2.i;
00421 y[i__2].r = q__1.r, y[i__2].i = q__1.i;
00422 jx += *incx;
00423 jy += *incy;
00424
00425 }
00426 }
00427 }
00428
00429 return 0;
00430
00431
00432
00433 }