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