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 dsyr2k_(char *uplo, char *trans, integer *n, integer *k,
00017 doublereal *alpha, doublereal *a, integer *lda, doublereal *b,
00018 integer *ldb, doublereal *beta, doublereal *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 doublereal 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_("DSYR2K", &info);
00215 return 0;
00216 }
00217
00218
00219
00220 if (*n == 0 || (*alpha == 0. || *k == 0) && *beta == 1.) {
00221 return 0;
00222 }
00223
00224
00225
00226 if (*alpha == 0.) {
00227 if (upper) {
00228 if (*beta == 0.) {
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.;
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.) {
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.;
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.) {
00285 i__2 = j;
00286 for (i__ = 1; i__ <= i__2; ++i__) {
00287 c__[i__ + j * c_dim1] = 0.;
00288
00289 }
00290 } else if (*beta != 1.) {
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. || b[j + l * b_dim1] != 0.) {
00300 temp1 = *alpha * b[j + l * b_dim1];
00301 temp2 = *alpha * a[j + l * a_dim1];
00302 i__3 = j;
00303 for (i__ = 1; i__ <= i__3; ++i__) {
00304 c__[i__ + j * c_dim1] = c__[i__ + j * c_dim1] + a[
00305 i__ + l * a_dim1] * temp1 + b[i__ + l *
00306 b_dim1] * temp2;
00307
00308 }
00309 }
00310
00311 }
00312
00313 }
00314 } else {
00315 i__1 = *n;
00316 for (j = 1; j <= i__1; ++j) {
00317 if (*beta == 0.) {
00318 i__2 = *n;
00319 for (i__ = j; i__ <= i__2; ++i__) {
00320 c__[i__ + j * c_dim1] = 0.;
00321
00322 }
00323 } else if (*beta != 1.) {
00324 i__2 = *n;
00325 for (i__ = j; i__ <= i__2; ++i__) {
00326 c__[i__ + j * c_dim1] = *beta * c__[i__ + j * c_dim1];
00327
00328 }
00329 }
00330 i__2 = *k;
00331 for (l = 1; l <= i__2; ++l) {
00332 if (a[j + l * a_dim1] != 0. || b[j + l * b_dim1] != 0.) {
00333 temp1 = *alpha * b[j + l * b_dim1];
00334 temp2 = *alpha * a[j + l * a_dim1];
00335 i__3 = *n;
00336 for (i__ = j; i__ <= i__3; ++i__) {
00337 c__[i__ + j * c_dim1] = c__[i__ + j * c_dim1] + a[
00338 i__ + l * a_dim1] * temp1 + b[i__ + l *
00339 b_dim1] * temp2;
00340
00341 }
00342 }
00343
00344 }
00345
00346 }
00347 }
00348 } else {
00349
00350
00351
00352 if (upper) {
00353 i__1 = *n;
00354 for (j = 1; j <= i__1; ++j) {
00355 i__2 = j;
00356 for (i__ = 1; i__ <= i__2; ++i__) {
00357 temp1 = 0.;
00358 temp2 = 0.;
00359 i__3 = *k;
00360 for (l = 1; l <= i__3; ++l) {
00361 temp1 += a[l + i__ * a_dim1] * b[l + j * b_dim1];
00362 temp2 += b[l + i__ * b_dim1] * a[l + j * a_dim1];
00363
00364 }
00365 if (*beta == 0.) {
00366 c__[i__ + j * c_dim1] = *alpha * temp1 + *alpha *
00367 temp2;
00368 } else {
00369 c__[i__ + j * c_dim1] = *beta * c__[i__ + j * c_dim1]
00370 + *alpha * temp1 + *alpha * temp2;
00371 }
00372
00373 }
00374
00375 }
00376 } else {
00377 i__1 = *n;
00378 for (j = 1; j <= i__1; ++j) {
00379 i__2 = *n;
00380 for (i__ = j; i__ <= i__2; ++i__) {
00381 temp1 = 0.;
00382 temp2 = 0.;
00383 i__3 = *k;
00384 for (l = 1; l <= i__3; ++l) {
00385 temp1 += a[l + i__ * a_dim1] * b[l + j * b_dim1];
00386 temp2 += b[l + i__ * b_dim1] * a[l + j * a_dim1];
00387
00388 }
00389 if (*beta == 0.) {
00390 c__[i__ + j * c_dim1] = *alpha * temp1 + *alpha *
00391 temp2;
00392 } else {
00393 c__[i__ + j * c_dim1] = *beta * c__[i__ + j * c_dim1]
00394 + *alpha * temp1 + *alpha * temp2;
00395 }
00396
00397 }
00398
00399 }
00400 }
00401 }
00402
00403 return 0;
00404
00405
00406
00407 }