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