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 dsyrk_(char *uplo, char *trans, integer *n, integer *k,
00017 doublereal *alpha, doublereal *a, integer *lda, doublereal *beta,
00018 doublereal *c__, integer *ldc)
00019 {
00020
00021 integer a_dim1, a_offset, c_dim1, c_offset, i__1, i__2, i__3;
00022
00023
00024 integer i__, j, l, info;
00025 doublereal temp;
00026 extern logical lsame_(char *, char *);
00027 integer nrowa;
00028 logical upper;
00029 extern int xerbla_(char *, integer *);
00030
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 a_dim1 = *lda;
00159 a_offset = 1 + a_dim1;
00160 a -= a_offset;
00161 c_dim1 = *ldc;
00162 c_offset = 1 + c_dim1;
00163 c__ -= c_offset;
00164
00165
00166 if (lsame_(trans, "N")) {
00167 nrowa = *n;
00168 } else {
00169 nrowa = *k;
00170 }
00171 upper = lsame_(uplo, "U");
00172
00173 info = 0;
00174 if (! upper && ! lsame_(uplo, "L")) {
00175 info = 1;
00176 } else if (! lsame_(trans, "N") && ! lsame_(trans,
00177 "T") && ! lsame_(trans, "C")) {
00178 info = 2;
00179 } else if (*n < 0) {
00180 info = 3;
00181 } else if (*k < 0) {
00182 info = 4;
00183 } else if (*lda < max(1,nrowa)) {
00184 info = 7;
00185 } else if (*ldc < max(1,*n)) {
00186 info = 10;
00187 }
00188 if (info != 0) {
00189 xerbla_("DSYRK ", &info);
00190 return 0;
00191 }
00192
00193
00194
00195 if (*n == 0 || (*alpha == 0. || *k == 0) && *beta == 1.) {
00196 return 0;
00197 }
00198
00199
00200
00201 if (*alpha == 0.) {
00202 if (upper) {
00203 if (*beta == 0.) {
00204 i__1 = *n;
00205 for (j = 1; j <= i__1; ++j) {
00206 i__2 = j;
00207 for (i__ = 1; i__ <= i__2; ++i__) {
00208 c__[i__ + j * c_dim1] = 0.;
00209
00210 }
00211
00212 }
00213 } else {
00214 i__1 = *n;
00215 for (j = 1; j <= i__1; ++j) {
00216 i__2 = j;
00217 for (i__ = 1; i__ <= i__2; ++i__) {
00218 c__[i__ + j * c_dim1] = *beta * c__[i__ + j * c_dim1];
00219
00220 }
00221
00222 }
00223 }
00224 } else {
00225 if (*beta == 0.) {
00226 i__1 = *n;
00227 for (j = 1; j <= i__1; ++j) {
00228 i__2 = *n;
00229 for (i__ = j; i__ <= i__2; ++i__) {
00230 c__[i__ + j * c_dim1] = 0.;
00231
00232 }
00233
00234 }
00235 } else {
00236 i__1 = *n;
00237 for (j = 1; j <= i__1; ++j) {
00238 i__2 = *n;
00239 for (i__ = j; i__ <= i__2; ++i__) {
00240 c__[i__ + j * c_dim1] = *beta * c__[i__ + j * c_dim1];
00241
00242 }
00243
00244 }
00245 }
00246 }
00247 return 0;
00248 }
00249
00250
00251
00252 if (lsame_(trans, "N")) {
00253
00254
00255
00256 if (upper) {
00257 i__1 = *n;
00258 for (j = 1; j <= i__1; ++j) {
00259 if (*beta == 0.) {
00260 i__2 = j;
00261 for (i__ = 1; i__ <= i__2; ++i__) {
00262 c__[i__ + j * c_dim1] = 0.;
00263
00264 }
00265 } else if (*beta != 1.) {
00266 i__2 = j;
00267 for (i__ = 1; i__ <= i__2; ++i__) {
00268 c__[i__ + j * c_dim1] = *beta * c__[i__ + j * c_dim1];
00269
00270 }
00271 }
00272 i__2 = *k;
00273 for (l = 1; l <= i__2; ++l) {
00274 if (a[j + l * a_dim1] != 0.) {
00275 temp = *alpha * a[j + l * a_dim1];
00276 i__3 = j;
00277 for (i__ = 1; i__ <= i__3; ++i__) {
00278 c__[i__ + j * c_dim1] += temp * a[i__ + l *
00279 a_dim1];
00280
00281 }
00282 }
00283
00284 }
00285
00286 }
00287 } else {
00288 i__1 = *n;
00289 for (j = 1; j <= i__1; ++j) {
00290 if (*beta == 0.) {
00291 i__2 = *n;
00292 for (i__ = j; i__ <= i__2; ++i__) {
00293 c__[i__ + j * c_dim1] = 0.;
00294
00295 }
00296 } else if (*beta != 1.) {
00297 i__2 = *n;
00298 for (i__ = j; i__ <= i__2; ++i__) {
00299 c__[i__ + j * c_dim1] = *beta * c__[i__ + j * c_dim1];
00300
00301 }
00302 }
00303 i__2 = *k;
00304 for (l = 1; l <= i__2; ++l) {
00305 if (a[j + l * a_dim1] != 0.) {
00306 temp = *alpha * a[j + l * a_dim1];
00307 i__3 = *n;
00308 for (i__ = j; i__ <= i__3; ++i__) {
00309 c__[i__ + j * c_dim1] += temp * a[i__ + l *
00310 a_dim1];
00311
00312 }
00313 }
00314
00315 }
00316
00317 }
00318 }
00319 } else {
00320
00321
00322
00323 if (upper) {
00324 i__1 = *n;
00325 for (j = 1; j <= i__1; ++j) {
00326 i__2 = j;
00327 for (i__ = 1; i__ <= i__2; ++i__) {
00328 temp = 0.;
00329 i__3 = *k;
00330 for (l = 1; l <= i__3; ++l) {
00331 temp += a[l + i__ * a_dim1] * a[l + j * a_dim1];
00332
00333 }
00334 if (*beta == 0.) {
00335 c__[i__ + j * c_dim1] = *alpha * temp;
00336 } else {
00337 c__[i__ + j * c_dim1] = *alpha * temp + *beta * c__[
00338 i__ + j * c_dim1];
00339 }
00340
00341 }
00342
00343 }
00344 } else {
00345 i__1 = *n;
00346 for (j = 1; j <= i__1; ++j) {
00347 i__2 = *n;
00348 for (i__ = j; i__ <= i__2; ++i__) {
00349 temp = 0.;
00350 i__3 = *k;
00351 for (l = 1; l <= i__3; ++l) {
00352 temp += a[l + i__ * a_dim1] * a[l + j * a_dim1];
00353
00354 }
00355 if (*beta == 0.) {
00356 c__[i__ + j * c_dim1] = *alpha * temp;
00357 } else {
00358 c__[i__ + j * c_dim1] = *alpha * temp + *beta * c__[
00359 i__ + j * c_dim1];
00360 }
00361
00362 }
00363
00364 }
00365 }
00366 }
00367
00368 return 0;
00369
00370
00371
00372 }