00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #include "f2c.h"
00014 #include "blaswrap.h"
00015
00016
00017
00018 static real c_b29 = 1.f;
00019 static real c_b30 = 0.f;
00020 static real c_b33 = -1.f;
00021
00022 int slatm5_(integer *prtype, integer *m, integer *n, real *a,
00023 integer *lda, real *b, integer *ldb, real *c__, integer *ldc, real *
00024 d__, integer *ldd, real *e, integer *lde, real *f, integer *ldf, real
00025 *r__, integer *ldr, real *l, integer *ldl, real *alpha, integer *
00026 qblcka, integer *qblckb)
00027 {
00028
00029 integer a_dim1, a_offset, b_dim1, b_offset, c_dim1, c_offset, d_dim1,
00030 d_offset, e_dim1, e_offset, f_dim1, f_offset, l_dim1, l_offset,
00031 r_dim1, r_offset, i__1, i__2;
00032
00033
00034 double sin(doublereal);
00035
00036
00037 integer i__, j, k;
00038 extern int sgemm_(char *, char *, integer *, integer *,
00039 integer *, real *, real *, integer *, real *, integer *, real *,
00040 real *, integer *);
00041 real imeps, reeps;
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
00179
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222 a_dim1 = *lda;
00223 a_offset = 1 + a_dim1;
00224 a -= a_offset;
00225 b_dim1 = *ldb;
00226 b_offset = 1 + b_dim1;
00227 b -= b_offset;
00228 c_dim1 = *ldc;
00229 c_offset = 1 + c_dim1;
00230 c__ -= c_offset;
00231 d_dim1 = *ldd;
00232 d_offset = 1 + d_dim1;
00233 d__ -= d_offset;
00234 e_dim1 = *lde;
00235 e_offset = 1 + e_dim1;
00236 e -= e_offset;
00237 f_dim1 = *ldf;
00238 f_offset = 1 + f_dim1;
00239 f -= f_offset;
00240 r_dim1 = *ldr;
00241 r_offset = 1 + r_dim1;
00242 r__ -= r_offset;
00243 l_dim1 = *ldl;
00244 l_offset = 1 + l_dim1;
00245 l -= l_offset;
00246
00247
00248 if (*prtype == 1) {
00249 i__1 = *m;
00250 for (i__ = 1; i__ <= i__1; ++i__) {
00251 i__2 = *m;
00252 for (j = 1; j <= i__2; ++j) {
00253 if (i__ == j) {
00254 a[i__ + j * a_dim1] = 1.f;
00255 d__[i__ + j * d_dim1] = 1.f;
00256 } else if (i__ == j - 1) {
00257 a[i__ + j * a_dim1] = -1.f;
00258 d__[i__ + j * d_dim1] = 0.f;
00259 } else {
00260 a[i__ + j * a_dim1] = 0.f;
00261 d__[i__ + j * d_dim1] = 0.f;
00262 }
00263
00264 }
00265
00266 }
00267
00268 i__1 = *n;
00269 for (i__ = 1; i__ <= i__1; ++i__) {
00270 i__2 = *n;
00271 for (j = 1; j <= i__2; ++j) {
00272 if (i__ == j) {
00273 b[i__ + j * b_dim1] = 1.f - *alpha;
00274 e[i__ + j * e_dim1] = 1.f;
00275 } else if (i__ == j - 1) {
00276 b[i__ + j * b_dim1] = 1.f;
00277 e[i__ + j * e_dim1] = 0.f;
00278 } else {
00279 b[i__ + j * b_dim1] = 0.f;
00280 e[i__ + j * e_dim1] = 0.f;
00281 }
00282
00283 }
00284
00285 }
00286
00287 i__1 = *m;
00288 for (i__ = 1; i__ <= i__1; ++i__) {
00289 i__2 = *n;
00290 for (j = 1; j <= i__2; ++j) {
00291 r__[i__ + j * r_dim1] = (.5f - sin((real) (i__ / j))) * 20.f;
00292 l[i__ + j * l_dim1] = r__[i__ + j * r_dim1];
00293
00294 }
00295
00296 }
00297
00298 } else if (*prtype == 2 || *prtype == 3) {
00299 i__1 = *m;
00300 for (i__ = 1; i__ <= i__1; ++i__) {
00301 i__2 = *m;
00302 for (j = 1; j <= i__2; ++j) {
00303 if (i__ <= j) {
00304 a[i__ + j * a_dim1] = (.5f - sin((real) i__)) * 2.f;
00305 d__[i__ + j * d_dim1] = (.5f - sin((real) (i__ * j))) *
00306 2.f;
00307 } else {
00308 a[i__ + j * a_dim1] = 0.f;
00309 d__[i__ + j * d_dim1] = 0.f;
00310 }
00311
00312 }
00313
00314 }
00315
00316 i__1 = *n;
00317 for (i__ = 1; i__ <= i__1; ++i__) {
00318 i__2 = *n;
00319 for (j = 1; j <= i__2; ++j) {
00320 if (i__ <= j) {
00321 b[i__ + j * b_dim1] = (.5f - sin((real) (i__ + j))) * 2.f;
00322 e[i__ + j * e_dim1] = (.5f - sin((real) j)) * 2.f;
00323 } else {
00324 b[i__ + j * b_dim1] = 0.f;
00325 e[i__ + j * e_dim1] = 0.f;
00326 }
00327
00328 }
00329
00330 }
00331
00332 i__1 = *m;
00333 for (i__ = 1; i__ <= i__1; ++i__) {
00334 i__2 = *n;
00335 for (j = 1; j <= i__2; ++j) {
00336 r__[i__ + j * r_dim1] = (.5f - sin((real) (i__ * j))) * 20.f;
00337 l[i__ + j * l_dim1] = (.5f - sin((real) (i__ + j))) * 20.f;
00338
00339 }
00340
00341 }
00342
00343 if (*prtype == 3) {
00344 if (*qblcka <= 1) {
00345 *qblcka = 2;
00346 }
00347 i__1 = *m - 1;
00348 i__2 = *qblcka;
00349 for (k = 1; i__2 < 0 ? k >= i__1 : k <= i__1; k += i__2) {
00350 a[k + 1 + (k + 1) * a_dim1] = a[k + k * a_dim1];
00351 a[k + 1 + k * a_dim1] = -sin(a[k + (k + 1) * a_dim1]);
00352
00353 }
00354
00355 if (*qblckb <= 1) {
00356 *qblckb = 2;
00357 }
00358 i__2 = *n - 1;
00359 i__1 = *qblckb;
00360 for (k = 1; i__1 < 0 ? k >= i__2 : k <= i__2; k += i__1) {
00361 b[k + 1 + (k + 1) * b_dim1] = b[k + k * b_dim1];
00362 b[k + 1 + k * b_dim1] = -sin(b[k + (k + 1) * b_dim1]);
00363
00364 }
00365 }
00366
00367 } else if (*prtype == 4) {
00368 i__1 = *m;
00369 for (i__ = 1; i__ <= i__1; ++i__) {
00370 i__2 = *m;
00371 for (j = 1; j <= i__2; ++j) {
00372 a[i__ + j * a_dim1] = (.5f - sin((real) (i__ * j))) * 20.f;
00373 d__[i__ + j * d_dim1] = (.5f - sin((real) (i__ + j))) * 2.f;
00374
00375 }
00376
00377 }
00378
00379 i__1 = *n;
00380 for (i__ = 1; i__ <= i__1; ++i__) {
00381 i__2 = *n;
00382 for (j = 1; j <= i__2; ++j) {
00383 b[i__ + j * b_dim1] = (.5f - sin((real) (i__ + j))) * 20.f;
00384 e[i__ + j * e_dim1] = (.5f - sin((real) (i__ * j))) * 2.f;
00385
00386 }
00387
00388 }
00389
00390 i__1 = *m;
00391 for (i__ = 1; i__ <= i__1; ++i__) {
00392 i__2 = *n;
00393 for (j = 1; j <= i__2; ++j) {
00394 r__[i__ + j * r_dim1] = (.5f - sin((real) (j / i__))) * 20.f;
00395 l[i__ + j * l_dim1] = (.5f - sin((real) (i__ * j))) * 2.f;
00396
00397 }
00398
00399 }
00400
00401 } else if (*prtype >= 5) {
00402 reeps = 20.f / *alpha;
00403 imeps = -1.5f / *alpha;
00404 i__1 = *m;
00405 for (i__ = 1; i__ <= i__1; ++i__) {
00406 i__2 = *n;
00407 for (j = 1; j <= i__2; ++j) {
00408 r__[i__ + j * r_dim1] = (.5f - sin((real) (i__ * j))) * *
00409 alpha / 20.f;
00410 l[i__ + j * l_dim1] = (.5f - sin((real) (i__ + j))) * *alpha /
00411 20.f;
00412
00413 }
00414
00415 }
00416
00417 i__1 = *m;
00418 for (i__ = 1; i__ <= i__1; ++i__) {
00419 d__[i__ + i__ * d_dim1] = 1.f;
00420
00421 }
00422
00423 i__1 = *m;
00424 for (i__ = 1; i__ <= i__1; ++i__) {
00425 if (i__ <= 4) {
00426 a[i__ + i__ * a_dim1] = 1.f;
00427 if (i__ > 2) {
00428 a[i__ + i__ * a_dim1] = reeps + 1.f;
00429 }
00430 if (i__ % 2 != 0 && i__ < *m) {
00431 a[i__ + (i__ + 1) * a_dim1] = imeps;
00432 } else if (i__ > 1) {
00433 a[i__ + (i__ - 1) * a_dim1] = -imeps;
00434 }
00435 } else if (i__ <= 8) {
00436 if (i__ <= 6) {
00437 a[i__ + i__ * a_dim1] = reeps;
00438 } else {
00439 a[i__ + i__ * a_dim1] = -reeps;
00440 }
00441 if (i__ % 2 != 0 && i__ < *m) {
00442 a[i__ + (i__ + 1) * a_dim1] = 1.f;
00443 } else if (i__ > 1) {
00444 a[i__ + (i__ - 1) * a_dim1] = -1.f;
00445 }
00446 } else {
00447 a[i__ + i__ * a_dim1] = 1.f;
00448 if (i__ % 2 != 0 && i__ < *m) {
00449 a[i__ + (i__ + 1) * a_dim1] = imeps * 2;
00450 } else if (i__ > 1) {
00451 a[i__ + (i__ - 1) * a_dim1] = -imeps * 2;
00452 }
00453 }
00454
00455 }
00456
00457 i__1 = *n;
00458 for (i__ = 1; i__ <= i__1; ++i__) {
00459 e[i__ + i__ * e_dim1] = 1.f;
00460 if (i__ <= 4) {
00461 b[i__ + i__ * b_dim1] = -1.f;
00462 if (i__ > 2) {
00463 b[i__ + i__ * b_dim1] = 1.f - reeps;
00464 }
00465 if (i__ % 2 != 0 && i__ < *n) {
00466 b[i__ + (i__ + 1) * b_dim1] = imeps;
00467 } else if (i__ > 1) {
00468 b[i__ + (i__ - 1) * b_dim1] = -imeps;
00469 }
00470 } else if (i__ <= 8) {
00471 if (i__ <= 6) {
00472 b[i__ + i__ * b_dim1] = reeps;
00473 } else {
00474 b[i__ + i__ * b_dim1] = -reeps;
00475 }
00476 if (i__ % 2 != 0 && i__ < *n) {
00477 b[i__ + (i__ + 1) * b_dim1] = imeps + 1.f;
00478 } else if (i__ > 1) {
00479 b[i__ + (i__ - 1) * b_dim1] = -1.f - imeps;
00480 }
00481 } else {
00482 b[i__ + i__ * b_dim1] = 1.f - reeps;
00483 if (i__ % 2 != 0 && i__ < *n) {
00484 b[i__ + (i__ + 1) * b_dim1] = imeps * 2;
00485 } else if (i__ > 1) {
00486 b[i__ + (i__ - 1) * b_dim1] = -imeps * 2;
00487 }
00488 }
00489
00490 }
00491 }
00492
00493
00494
00495 sgemm_("N", "N", m, n, m, &c_b29, &a[a_offset], lda, &r__[r_offset], ldr,
00496 &c_b30, &c__[c_offset], ldc);
00497 sgemm_("N", "N", m, n, n, &c_b33, &l[l_offset], ldl, &b[b_offset], ldb, &
00498 c_b29, &c__[c_offset], ldc);
00499 sgemm_("N", "N", m, n, m, &c_b29, &d__[d_offset], ldd, &r__[r_offset],
00500 ldr, &c_b30, &f[f_offset], ldf);
00501 sgemm_("N", "N", m, n, n, &c_b33, &l[l_offset], ldl, &e[e_offset], lde, &
00502 c_b29, &f[f_offset], ldf);
00503
00504
00505
00506 return 0;
00507 }