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