00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #include "f2c.h"
00014 #include "blaswrap.h"
00015
00016 int zhemv_(char *uplo, integer *n, doublecomplex *alpha,
00017 doublecomplex *a, integer *lda, doublecomplex *x, integer *incx,
00018 doublecomplex *beta, doublecomplex *y, integer *incy)
00019 {
00020
00021 integer a_dim1, a_offset, i__1, i__2, i__3, i__4, i__5;
00022 doublereal d__1;
00023 doublecomplex z__1, z__2, z__3, z__4;
00024
00025
00026 void d_cnjg(doublecomplex *, doublecomplex *);
00027
00028
00029 integer i__, j, ix, iy, jx, jy, kx, ky, info;
00030 doublecomplex 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_("ZHEMV ", &info);
00165 return 0;
00166 }
00167
00168
00169
00170 if (*n == 0 || alpha->r == 0. && alpha->i == 0. && (beta->r == 1. &&
00171 beta->i == 0.)) {
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. || beta->i != 0.) {
00195 if (*incy == 1) {
00196 if (beta->r == 0. && beta->i == 0.) {
00197 i__1 = *n;
00198 for (i__ = 1; i__ <= i__1; ++i__) {
00199 i__2 = i__;
00200 y[i__2].r = 0., y[i__2].i = 0.;
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 z__1.r = beta->r * y[i__3].r - beta->i * y[i__3].i,
00209 z__1.i = beta->r * y[i__3].i + beta->i * y[i__3]
00210 .r;
00211 y[i__2].r = z__1.r, y[i__2].i = z__1.i;
00212
00213 }
00214 }
00215 } else {
00216 iy = ky;
00217 if (beta->r == 0. && beta->i == 0.) {
00218 i__1 = *n;
00219 for (i__ = 1; i__ <= i__1; ++i__) {
00220 i__2 = iy;
00221 y[i__2].r = 0., y[i__2].i = 0.;
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 z__1.r = beta->r * y[i__3].r - beta->i * y[i__3].i,
00231 z__1.i = beta->r * y[i__3].i + beta->i * y[i__3]
00232 .r;
00233 y[i__2].r = z__1.r, y[i__2].i = z__1.i;
00234 iy += *incy;
00235
00236 }
00237 }
00238 }
00239 }
00240 if (alpha->r == 0. && alpha->i == 0.) {
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 z__1.r = alpha->r * x[i__2].r - alpha->i * x[i__2].i, z__1.i =
00252 alpha->r * x[i__2].i + alpha->i * x[i__2].r;
00253 temp1.r = z__1.r, temp1.i = z__1.i;
00254 temp2.r = 0., temp2.i = 0.;
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 z__2.r = temp1.r * a[i__5].r - temp1.i * a[i__5].i,
00261 z__2.i = temp1.r * a[i__5].i + temp1.i * a[i__5]
00262 .r;
00263 z__1.r = y[i__4].r + z__2.r, z__1.i = y[i__4].i + z__2.i;
00264 y[i__3].r = z__1.r, y[i__3].i = z__1.i;
00265 d_cnjg(&z__3, &a[i__ + j * a_dim1]);
00266 i__3 = i__;
00267 z__2.r = z__3.r * x[i__3].r - z__3.i * x[i__3].i, z__2.i =
00268 z__3.r * x[i__3].i + z__3.i * x[i__3].r;
00269 z__1.r = temp2.r + z__2.r, z__1.i = temp2.i + z__2.i;
00270 temp2.r = z__1.r, temp2.i = z__1.i;
00271
00272 }
00273 i__2 = j;
00274 i__3 = j;
00275 i__4 = j + j * a_dim1;
00276 d__1 = a[i__4].r;
00277 z__3.r = d__1 * temp1.r, z__3.i = d__1 * temp1.i;
00278 z__2.r = y[i__3].r + z__3.r, z__2.i = y[i__3].i + z__3.i;
00279 z__4.r = alpha->r * temp2.r - alpha->i * temp2.i, z__4.i =
00280 alpha->r * temp2.i + alpha->i * temp2.r;
00281 z__1.r = z__2.r + z__4.r, z__1.i = z__2.i + z__4.i;
00282 y[i__2].r = z__1.r, y[i__2].i = z__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 z__1.r = alpha->r * x[i__2].r - alpha->i * x[i__2].i, z__1.i =
00292 alpha->r * x[i__2].i + alpha->i * x[i__2].r;
00293 temp1.r = z__1.r, temp1.i = z__1.i;
00294 temp2.r = 0., temp2.i = 0.;
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 z__2.r = temp1.r * a[i__5].r - temp1.i * a[i__5].i,
00303 z__2.i = temp1.r * a[i__5].i + temp1.i * a[i__5]
00304 .r;
00305 z__1.r = y[i__4].r + z__2.r, z__1.i = y[i__4].i + z__2.i;
00306 y[i__3].r = z__1.r, y[i__3].i = z__1.i;
00307 d_cnjg(&z__3, &a[i__ + j * a_dim1]);
00308 i__3 = ix;
00309 z__2.r = z__3.r * x[i__3].r - z__3.i * x[i__3].i, z__2.i =
00310 z__3.r * x[i__3].i + z__3.i * x[i__3].r;
00311 z__1.r = temp2.r + z__2.r, z__1.i = temp2.i + z__2.i;
00312 temp2.r = z__1.r, temp2.i = z__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 d__1 = a[i__4].r;
00321 z__3.r = d__1 * temp1.r, z__3.i = d__1 * temp1.i;
00322 z__2.r = y[i__3].r + z__3.r, z__2.i = y[i__3].i + z__3.i;
00323 z__4.r = alpha->r * temp2.r - alpha->i * temp2.i, z__4.i =
00324 alpha->r * temp2.i + alpha->i * temp2.r;
00325 z__1.r = z__2.r + z__4.r, z__1.i = z__2.i + z__4.i;
00326 y[i__2].r = z__1.r, y[i__2].i = z__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 z__1.r = alpha->r * x[i__2].r - alpha->i * x[i__2].i, z__1.i =
00341 alpha->r * x[i__2].i + alpha->i * x[i__2].r;
00342 temp1.r = z__1.r, temp1.i = z__1.i;
00343 temp2.r = 0., temp2.i = 0.;
00344 i__2 = j;
00345 i__3 = j;
00346 i__4 = j + j * a_dim1;
00347 d__1 = a[i__4].r;
00348 z__2.r = d__1 * temp1.r, z__2.i = d__1 * temp1.i;
00349 z__1.r = y[i__3].r + z__2.r, z__1.i = y[i__3].i + z__2.i;
00350 y[i__2].r = z__1.r, y[i__2].i = z__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 z__2.r = temp1.r * a[i__5].r - temp1.i * a[i__5].i,
00357 z__2.i = temp1.r * a[i__5].i + temp1.i * a[i__5]
00358 .r;
00359 z__1.r = y[i__4].r + z__2.r, z__1.i = y[i__4].i + z__2.i;
00360 y[i__3].r = z__1.r, y[i__3].i = z__1.i;
00361 d_cnjg(&z__3, &a[i__ + j * a_dim1]);
00362 i__3 = i__;
00363 z__2.r = z__3.r * x[i__3].r - z__3.i * x[i__3].i, z__2.i =
00364 z__3.r * x[i__3].i + z__3.i * x[i__3].r;
00365 z__1.r = temp2.r + z__2.r, z__1.i = temp2.i + z__2.i;
00366 temp2.r = z__1.r, temp2.i = z__1.i;
00367
00368 }
00369 i__2 = j;
00370 i__3 = j;
00371 z__2.r = alpha->r * temp2.r - alpha->i * temp2.i, z__2.i =
00372 alpha->r * temp2.i + alpha->i * temp2.r;
00373 z__1.r = y[i__3].r + z__2.r, z__1.i = y[i__3].i + z__2.i;
00374 y[i__2].r = z__1.r, y[i__2].i = z__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 z__1.r = alpha->r * x[i__2].r - alpha->i * x[i__2].i, z__1.i =
00384 alpha->r * x[i__2].i + alpha->i * x[i__2].r;
00385 temp1.r = z__1.r, temp1.i = z__1.i;
00386 temp2.r = 0., temp2.i = 0.;
00387 i__2 = jy;
00388 i__3 = jy;
00389 i__4 = j + j * a_dim1;
00390 d__1 = a[i__4].r;
00391 z__2.r = d__1 * temp1.r, z__2.i = d__1 * temp1.i;
00392 z__1.r = y[i__3].r + z__2.r, z__1.i = y[i__3].i + z__2.i;
00393 y[i__2].r = z__1.r, y[i__2].i = z__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 z__2.r = temp1.r * a[i__5].r - temp1.i * a[i__5].i,
00404 z__2.i = temp1.r * a[i__5].i + temp1.i * a[i__5]
00405 .r;
00406 z__1.r = y[i__4].r + z__2.r, z__1.i = y[i__4].i + z__2.i;
00407 y[i__3].r = z__1.r, y[i__3].i = z__1.i;
00408 d_cnjg(&z__3, &a[i__ + j * a_dim1]);
00409 i__3 = ix;
00410 z__2.r = z__3.r * x[i__3].r - z__3.i * x[i__3].i, z__2.i =
00411 z__3.r * x[i__3].i + z__3.i * x[i__3].r;
00412 z__1.r = temp2.r + z__2.r, z__1.i = temp2.i + z__2.i;
00413 temp2.r = z__1.r, temp2.i = z__1.i;
00414
00415 }
00416 i__2 = jy;
00417 i__3 = jy;
00418 z__2.r = alpha->r * temp2.r - alpha->i * temp2.i, z__2.i =
00419 alpha->r * temp2.i + alpha->i * temp2.r;
00420 z__1.r = y[i__3].r + z__2.r, z__1.i = y[i__3].i + z__2.i;
00421 y[i__2].r = z__1.r, y[i__2].i = z__1.i;
00422 jx += *incx;
00423 jy += *incy;
00424
00425 }
00426 }
00427 }
00428
00429 return 0;
00430
00431
00432
00433 }