Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #include "f2c.h"
00014 #include "blaswrap.h"
00015
00016 int ssyr2k_(char *uplo, char *trans, integer *n, integer *k,
00017 real *alpha, real *a, integer *lda, real *b, integer *ldb, real *beta,
00018 real *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;
00023
00024
00025 integer i__, j, l, info;
00026 real temp1, temp2;
00027 extern logical lsame_(char *, char *);
00028 integer nrowa;
00029 logical upper;
00030 extern int xerbla_(char *, integer *);
00031
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
00177
00178 a_dim1 = *lda;
00179 a_offset = 1 + a_dim1;
00180 a -= a_offset;
00181 b_dim1 = *ldb;
00182 b_offset = 1 + b_dim1;
00183 b -= b_offset;
00184 c_dim1 = *ldc;
00185 c_offset = 1 + c_dim1;
00186 c__ -= c_offset;
00187
00188
00189 if (lsame_(trans, "N")) {
00190 nrowa = *n;
00191 } else {
00192 nrowa = *k;
00193 }
00194 upper = lsame_(uplo, "U");
00195
00196 info = 0;
00197 if (! upper && ! lsame_(uplo, "L")) {
00198 info = 1;
00199 } else if (! lsame_(trans, "N") && ! lsame_(trans,
00200 "T") && ! lsame_(trans, "C")) {
00201 info = 2;
00202 } else if (*n < 0) {
00203 info = 3;
00204 } else if (*k < 0) {
00205 info = 4;
00206 } else if (*lda < max(1,nrowa)) {
00207 info = 7;
00208 } else if (*ldb < max(1,nrowa)) {
00209 info = 9;
00210 } else if (*ldc < max(1,*n)) {
00211 info = 12;
00212 }
00213 if (info != 0) {
00214 xerbla_("SSYR2K", &info);
00215 return 0;
00216 }
00217
00218
00219
00220 if (*n == 0 || (*alpha == 0.f || *k == 0) && *beta == 1.f) {
00221 return 0;
00222 }
00223
00224
00225
00226 if (*alpha == 0.f) {
00227 if (upper) {
00228 if (*beta == 0.f) {
00229 i__1 = *n;
00230 for (j = 1; j <= i__1; ++j) {
00231 i__2 = j;
00232 for (i__ = 1; i__ <= i__2; ++i__) {
00233 c__[i__ + j * c_dim1] = 0.f;
00234
00235 }
00236
00237 }
00238 } else {
00239 i__1 = *n;
00240 for (j = 1; j <= i__1; ++j) {
00241 i__2 = j;
00242 for (i__ = 1; i__ <= i__2; ++i__) {
00243 c__[i__ + j * c_dim1] = *beta * c__[i__ + j * c_dim1];
00244
00245 }
00246
00247 }
00248 }
00249 } else {
00250 if (*beta == 0.f) {
00251 i__1 = *n;
00252 for (j = 1; j <= i__1; ++j) {
00253 i__2 = *n;
00254 for (i__ = j; i__ <= i__2; ++i__) {
00255 c__[i__ + j * c_dim1] = 0.f;
00256
00257 }
00258
00259 }
00260 } else {
00261 i__1 = *n;
00262 for (j = 1; j <= i__1; ++j) {
00263 i__2 = *n;
00264 for (i__ = j; i__ <= i__2; ++i__) {
00265 c__[i__ + j * c_dim1] = *beta * c__[i__ + j * c_dim1];
00266
00267 }
00268
00269 }
00270 }
00271 }
00272 return 0;
00273 }
00274
00275
00276
00277 if (lsame_(trans, "N")) {
00278
00279
00280
00281 if (upper) {
00282 i__1 = *n;
00283 for (j = 1; j <= i__1; ++j) {
00284 if (*beta == 0.f) {
00285 i__2 = j;
00286 for (i__ = 1; i__ <= i__2; ++i__) {
00287 c__[i__ + j * c_dim1] = 0.f;
00288
00289 }
00290 } else if (*beta != 1.f) {
00291 i__2 = j;
00292 for (i__ = 1; i__ <= i__2; ++i__) {
00293 c__[i__ + j * c_dim1] = *beta * c__[i__ + j * c_dim1];
00294
00295 }
00296 }
00297 i__2 = *k;
00298 for (l = 1; l <= i__2; ++l) {
00299 if (a[j + l * a_dim1] != 0.f || b[j + l * b_dim1] != 0.f)
00300 {
00301 temp1 = *alpha * b[j + l * b_dim1];
00302 temp2 = *alpha * a[j + l * a_dim1];
00303 i__3 = j;
00304 for (i__ = 1; i__ <= i__3; ++i__) {
00305 c__[i__ + j * c_dim1] = c__[i__ + j * c_dim1] + a[
00306 i__ + l * a_dim1] * temp1 + b[i__ + l *
00307 b_dim1] * temp2;
00308
00309 }
00310 }
00311
00312 }
00313
00314 }
00315 } else {
00316 i__1 = *n;
00317 for (j = 1; j <= i__1; ++j) {
00318 if (*beta == 0.f) {
00319 i__2 = *n;
00320 for (i__ = j; i__ <= i__2; ++i__) {
00321 c__[i__ + j * c_dim1] = 0.f;
00322
00323 }
00324 } else if (*beta != 1.f) {
00325 i__2 = *n;
00326 for (i__ = j; i__ <= i__2; ++i__) {
00327 c__[i__ + j * c_dim1] = *beta * c__[i__ + j * c_dim1];
00328
00329 }
00330 }
00331 i__2 = *k;
00332 for (l = 1; l <= i__2; ++l) {
00333 if (a[j + l * a_dim1] != 0.f || b[j + l * b_dim1] != 0.f)
00334 {
00335 temp1 = *alpha * b[j + l * b_dim1];
00336 temp2 = *alpha * a[j + l * a_dim1];
00337 i__3 = *n;
00338 for (i__ = j; i__ <= i__3; ++i__) {
00339 c__[i__ + j * c_dim1] = c__[i__ + j * c_dim1] + a[
00340 i__ + l * a_dim1] * temp1 + b[i__ + l *
00341 b_dim1] * temp2;
00342
00343 }
00344 }
00345
00346 }
00347
00348 }
00349 }
00350 } else {
00351
00352
00353
00354 if (upper) {
00355 i__1 = *n;
00356 for (j = 1; j <= i__1; ++j) {
00357 i__2 = j;
00358 for (i__ = 1; i__ <= i__2; ++i__) {
00359 temp1 = 0.f;
00360 temp2 = 0.f;
00361 i__3 = *k;
00362 for (l = 1; l <= i__3; ++l) {
00363 temp1 += a[l + i__ * a_dim1] * b[l + j * b_dim1];
00364 temp2 += b[l + i__ * b_dim1] * a[l + j * a_dim1];
00365
00366 }
00367 if (*beta == 0.f) {
00368 c__[i__ + j * c_dim1] = *alpha * temp1 + *alpha *
00369 temp2;
00370 } else {
00371 c__[i__ + j * c_dim1] = *beta * c__[i__ + j * c_dim1]
00372 + *alpha * temp1 + *alpha * temp2;
00373 }
00374
00375 }
00376
00377 }
00378 } else {
00379 i__1 = *n;
00380 for (j = 1; j <= i__1; ++j) {
00381 i__2 = *n;
00382 for (i__ = j; i__ <= i__2; ++i__) {
00383 temp1 = 0.f;
00384 temp2 = 0.f;
00385 i__3 = *k;
00386 for (l = 1; l <= i__3; ++l) {
00387 temp1 += a[l + i__ * a_dim1] * b[l + j * b_dim1];
00388 temp2 += b[l + i__ * b_dim1] * a[l + j * a_dim1];
00389
00390 }
00391 if (*beta == 0.f) {
00392 c__[i__ + j * c_dim1] = *alpha * temp1 + *alpha *
00393 temp2;
00394 } else {
00395 c__[i__ + j * c_dim1] = *beta * c__[i__ + j * c_dim1]
00396 + *alpha * temp1 + *alpha * temp2;
00397 }
00398
00399 }
00400
00401 }
00402 }
00403 }
00404
00405 return 0;
00406
00407
00408
00409 }