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