00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #include "f2c.h"
00014 #include "blaswrap.h"
00015
00016 int cla_syamv__(integer *uplo, integer *n, real *alpha,
00017 complex *a, integer *lda, complex *x, integer *incx, real *beta, real
00018 *y, integer *incy)
00019 {
00020
00021 integer a_dim1, a_offset, i__1, i__2, i__3;
00022 real r__1, r__2;
00023
00024
00025 double r_imag(complex *), r_sign(real *, real *);
00026
00027
00028 integer i__, j;
00029 logical symb_zero__;
00030 integer iy, jx, kx, ky, info;
00031 real temp, safe1;
00032 extern doublereal slamch_(char *);
00033 extern int xerbla_(char *, integer *);
00034 extern integer ilauplo_(char *);
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 a_dim1 = *lda;
00165 a_offset = 1 + a_dim1;
00166 a -= a_offset;
00167 --x;
00168 --y;
00169
00170
00171 info = 0;
00172 if (*uplo != ilauplo_("U") && *uplo != ilauplo_("L")
00173 ) {
00174 info = 1;
00175 } else if (*n < 0) {
00176 info = 2;
00177 } else if (*lda < max(1,*n)) {
00178 info = 5;
00179 } else if (*incx == 0) {
00180 info = 7;
00181 } else if (*incy == 0) {
00182 info = 10;
00183 }
00184 if (info != 0) {
00185 xerbla_("SSYMV ", &info);
00186 return 0;
00187 }
00188
00189
00190
00191 if (*n == 0 || *alpha == 0.f && *beta == 1.f) {
00192 return 0;
00193 }
00194
00195
00196
00197 if (*incx > 0) {
00198 kx = 1;
00199 } else {
00200 kx = 1 - (*n - 1) * *incx;
00201 }
00202 if (*incy > 0) {
00203 ky = 1;
00204 } else {
00205 ky = 1 - (*n - 1) * *incy;
00206 }
00207
00208
00209
00210
00211 safe1 = slamch_("Safe minimum");
00212 safe1 = (*n + 1) * safe1;
00213
00214
00215
00216
00217
00218
00219
00220 iy = ky;
00221 if (*incx == 1) {
00222 i__1 = *n;
00223 for (i__ = 1; i__ <= i__1; ++i__) {
00224 if (*beta == 0.f) {
00225 symb_zero__ = TRUE_;
00226 y[iy] = 0.f;
00227 } else if (y[iy] == 0.f) {
00228 symb_zero__ = TRUE_;
00229 } else {
00230 symb_zero__ = FALSE_;
00231 y[iy] = *beta * (r__1 = y[iy], dabs(r__1));
00232 }
00233 if (*alpha != 0.f) {
00234 i__2 = *n;
00235 for (j = 1; j <= i__2; ++j) {
00236 if (*uplo == ilauplo_("U")) {
00237 if (i__ <= j) {
00238 i__3 = i__ + j * a_dim1;
00239 temp = (r__1 = a[i__3].r, dabs(r__1)) + (r__2 =
00240 r_imag(&a[i__ + j * a_dim1]), dabs(r__2));
00241 } else {
00242 i__3 = j + i__ * a_dim1;
00243 temp = (r__1 = a[i__3].r, dabs(r__1)) + (r__2 =
00244 r_imag(&a[j + i__ * a_dim1]), dabs(r__2));
00245 }
00246 } else {
00247 if (i__ >= j) {
00248 i__3 = i__ + j * a_dim1;
00249 temp = (r__1 = a[i__3].r, dabs(r__1)) + (r__2 =
00250 r_imag(&a[i__ + j * a_dim1]), dabs(r__2));
00251 } else {
00252 i__3 = j + i__ * a_dim1;
00253 temp = (r__1 = a[i__3].r, dabs(r__1)) + (r__2 =
00254 r_imag(&a[j + i__ * a_dim1]), dabs(r__2));
00255 }
00256 }
00257 i__3 = j;
00258 symb_zero__ = symb_zero__ && (x[i__3].r == 0.f && x[i__3]
00259 .i == 0.f || temp == 0.f);
00260 i__3 = j;
00261 y[iy] += *alpha * ((r__1 = x[i__3].r, dabs(r__1)) + (r__2
00262 = r_imag(&x[j]), dabs(r__2))) * temp;
00263 }
00264 }
00265 if (! symb_zero__) {
00266 y[iy] += r_sign(&safe1, &y[iy]);
00267 }
00268 iy += *incy;
00269 }
00270 } else {
00271 i__1 = *n;
00272 for (i__ = 1; i__ <= i__1; ++i__) {
00273 if (*beta == 0.f) {
00274 symb_zero__ = TRUE_;
00275 y[iy] = 0.f;
00276 } else if (y[iy] == 0.f) {
00277 symb_zero__ = TRUE_;
00278 } else {
00279 symb_zero__ = FALSE_;
00280 y[iy] = *beta * (r__1 = y[iy], dabs(r__1));
00281 }
00282 jx = kx;
00283 if (*alpha != 0.f) {
00284 i__2 = *n;
00285 for (j = 1; j <= i__2; ++j) {
00286 if (*uplo == ilauplo_("U")) {
00287 if (i__ <= j) {
00288 i__3 = i__ + j * a_dim1;
00289 temp = (r__1 = a[i__3].r, dabs(r__1)) + (r__2 =
00290 r_imag(&a[i__ + j * a_dim1]), dabs(r__2));
00291 } else {
00292 i__3 = j + i__ * a_dim1;
00293 temp = (r__1 = a[i__3].r, dabs(r__1)) + (r__2 =
00294 r_imag(&a[j + i__ * a_dim1]), dabs(r__2));
00295 }
00296 } else {
00297 if (i__ >= j) {
00298 i__3 = i__ + j * a_dim1;
00299 temp = (r__1 = a[i__3].r, dabs(r__1)) + (r__2 =
00300 r_imag(&a[i__ + j * a_dim1]), dabs(r__2));
00301 } else {
00302 i__3 = j + i__ * a_dim1;
00303 temp = (r__1 = a[i__3].r, dabs(r__1)) + (r__2 =
00304 r_imag(&a[j + i__ * a_dim1]), dabs(r__2));
00305 }
00306 }
00307 i__3 = j;
00308 symb_zero__ = symb_zero__ && (x[i__3].r == 0.f && x[i__3]
00309 .i == 0.f || temp == 0.f);
00310 i__3 = jx;
00311 y[iy] += *alpha * ((r__1 = x[i__3].r, dabs(r__1)) + (r__2
00312 = r_imag(&x[jx]), dabs(r__2))) * temp;
00313 jx += *incx;
00314 }
00315 }
00316 if (! symb_zero__) {
00317 y[iy] += r_sign(&safe1, &y[iy]);
00318 }
00319 iy += *incy;
00320 }
00321 }
00322
00323 return 0;
00324
00325
00326
00327 }