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