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