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_b7 = 1.f;
00019 static real c_b8 = 0.f;
00020 static integer c__2 = 2;
00021
00022 int slalsa_(integer *icompq, integer *smlsiz, integer *n,
00023 integer *nrhs, real *b, integer *ldb, real *bx, integer *ldbx, real *
00024 u, integer *ldu, real *vt, integer *k, real *difl, real *difr, real *
00025 z__, real *poles, integer *givptr, integer *givcol, integer *ldgcol,
00026 integer *perm, real *givnum, real *c__, real *s, real *work, integer *
00027 iwork, integer *info)
00028 {
00029
00030 integer givcol_dim1, givcol_offset, perm_dim1, perm_offset, b_dim1,
00031 b_offset, bx_dim1, bx_offset, difl_dim1, difl_offset, difr_dim1,
00032 difr_offset, givnum_dim1, givnum_offset, poles_dim1, poles_offset,
00033 u_dim1, u_offset, vt_dim1, vt_offset, z_dim1, z_offset, i__1,
00034 i__2;
00035
00036
00037 integer pow_ii(integer *, integer *);
00038
00039
00040 integer i__, j, i1, ic, lf, nd, ll, nl, nr, im1, nlf, nrf, lvl, ndb1,
00041 nlp1, lvl2, nrp1, nlvl, sqre, inode, ndiml;
00042 extern int sgemm_(char *, char *, integer *, integer *,
00043 integer *, real *, real *, integer *, real *, integer *, real *,
00044 real *, integer *);
00045 integer ndimr;
00046 extern int scopy_(integer *, real *, integer *, real *,
00047 integer *), slals0_(integer *, integer *, integer *, integer *,
00048 integer *, real *, integer *, real *, integer *, integer *,
00049 integer *, integer *, integer *, real *, integer *, real *, real *
00050 , real *, real *, integer *, real *, real *, real *, integer *),
00051 xerbla_(char *, integer *), slasdt_(integer *, integer *,
00052 integer *, integer *, integer *, integer *, integer *);
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 b_dim1 = *ldb;
00212 b_offset = 1 + b_dim1;
00213 b -= b_offset;
00214 bx_dim1 = *ldbx;
00215 bx_offset = 1 + bx_dim1;
00216 bx -= bx_offset;
00217 givnum_dim1 = *ldu;
00218 givnum_offset = 1 + givnum_dim1;
00219 givnum -= givnum_offset;
00220 poles_dim1 = *ldu;
00221 poles_offset = 1 + poles_dim1;
00222 poles -= poles_offset;
00223 z_dim1 = *ldu;
00224 z_offset = 1 + z_dim1;
00225 z__ -= z_offset;
00226 difr_dim1 = *ldu;
00227 difr_offset = 1 + difr_dim1;
00228 difr -= difr_offset;
00229 difl_dim1 = *ldu;
00230 difl_offset = 1 + difl_dim1;
00231 difl -= difl_offset;
00232 vt_dim1 = *ldu;
00233 vt_offset = 1 + vt_dim1;
00234 vt -= vt_offset;
00235 u_dim1 = *ldu;
00236 u_offset = 1 + u_dim1;
00237 u -= u_offset;
00238 --k;
00239 --givptr;
00240 perm_dim1 = *ldgcol;
00241 perm_offset = 1 + perm_dim1;
00242 perm -= perm_offset;
00243 givcol_dim1 = *ldgcol;
00244 givcol_offset = 1 + givcol_dim1;
00245 givcol -= givcol_offset;
00246 --c__;
00247 --s;
00248 --work;
00249 --iwork;
00250
00251
00252 *info = 0;
00253
00254 if (*icompq < 0 || *icompq > 1) {
00255 *info = -1;
00256 } else if (*smlsiz < 3) {
00257 *info = -2;
00258 } else if (*n < *smlsiz) {
00259 *info = -3;
00260 } else if (*nrhs < 1) {
00261 *info = -4;
00262 } else if (*ldb < *n) {
00263 *info = -6;
00264 } else if (*ldbx < *n) {
00265 *info = -8;
00266 } else if (*ldu < *n) {
00267 *info = -10;
00268 } else if (*ldgcol < *n) {
00269 *info = -19;
00270 }
00271 if (*info != 0) {
00272 i__1 = -(*info);
00273 xerbla_("SLALSA", &i__1);
00274 return 0;
00275 }
00276
00277
00278
00279 inode = 1;
00280 ndiml = inode + *n;
00281 ndimr = ndiml + *n;
00282
00283 slasdt_(n, &nlvl, &nd, &iwork[inode], &iwork[ndiml], &iwork[ndimr],
00284 smlsiz);
00285
00286
00287
00288
00289 if (*icompq == 1) {
00290 goto L50;
00291 }
00292
00293
00294
00295
00296
00297
00298 ndb1 = (nd + 1) / 2;
00299 i__1 = nd;
00300 for (i__ = ndb1; i__ <= i__1; ++i__) {
00301
00302
00303
00304
00305
00306
00307
00308 i1 = i__ - 1;
00309 ic = iwork[inode + i1];
00310 nl = iwork[ndiml + i1];
00311 nr = iwork[ndimr + i1];
00312 nlf = ic - nl;
00313 nrf = ic + 1;
00314 sgemm_("T", "N", &nl, nrhs, &nl, &c_b7, &u[nlf + u_dim1], ldu, &b[nlf
00315 + b_dim1], ldb, &c_b8, &bx[nlf + bx_dim1], ldbx);
00316 sgemm_("T", "N", &nr, nrhs, &nr, &c_b7, &u[nrf + u_dim1], ldu, &b[nrf
00317 + b_dim1], ldb, &c_b8, &bx[nrf + bx_dim1], ldbx);
00318
00319 }
00320
00321
00322
00323
00324 i__1 = nd;
00325 for (i__ = 1; i__ <= i__1; ++i__) {
00326 ic = iwork[inode + i__ - 1];
00327 scopy_(nrhs, &b[ic + b_dim1], ldb, &bx[ic + bx_dim1], ldbx);
00328
00329 }
00330
00331
00332
00333
00334 j = pow_ii(&c__2, &nlvl);
00335 sqre = 0;
00336
00337 for (lvl = nlvl; lvl >= 1; --lvl) {
00338 lvl2 = (lvl << 1) - 1;
00339
00340
00341
00342
00343 if (lvl == 1) {
00344 lf = 1;
00345 ll = 1;
00346 } else {
00347 i__1 = lvl - 1;
00348 lf = pow_ii(&c__2, &i__1);
00349 ll = (lf << 1) - 1;
00350 }
00351 i__1 = ll;
00352 for (i__ = lf; i__ <= i__1; ++i__) {
00353 im1 = i__ - 1;
00354 ic = iwork[inode + im1];
00355 nl = iwork[ndiml + im1];
00356 nr = iwork[ndimr + im1];
00357 nlf = ic - nl;
00358 nrf = ic + 1;
00359 --j;
00360 slals0_(icompq, &nl, &nr, &sqre, nrhs, &bx[nlf + bx_dim1], ldbx, &
00361 b[nlf + b_dim1], ldb, &perm[nlf + lvl * perm_dim1], &
00362 givptr[j], &givcol[nlf + lvl2 * givcol_dim1], ldgcol, &
00363 givnum[nlf + lvl2 * givnum_dim1], ldu, &poles[nlf + lvl2 *
00364 poles_dim1], &difl[nlf + lvl * difl_dim1], &difr[nlf +
00365 lvl2 * difr_dim1], &z__[nlf + lvl * z_dim1], &k[j], &c__[
00366 j], &s[j], &work[1], info);
00367
00368 }
00369
00370 }
00371 goto L90;
00372
00373
00374
00375 L50:
00376
00377
00378
00379
00380 j = 0;
00381 i__1 = nlvl;
00382 for (lvl = 1; lvl <= i__1; ++lvl) {
00383 lvl2 = (lvl << 1) - 1;
00384
00385
00386
00387
00388 if (lvl == 1) {
00389 lf = 1;
00390 ll = 1;
00391 } else {
00392 i__2 = lvl - 1;
00393 lf = pow_ii(&c__2, &i__2);
00394 ll = (lf << 1) - 1;
00395 }
00396 i__2 = lf;
00397 for (i__ = ll; i__ >= i__2; --i__) {
00398 im1 = i__ - 1;
00399 ic = iwork[inode + im1];
00400 nl = iwork[ndiml + im1];
00401 nr = iwork[ndimr + im1];
00402 nlf = ic - nl;
00403 nrf = ic + 1;
00404 if (i__ == ll) {
00405 sqre = 0;
00406 } else {
00407 sqre = 1;
00408 }
00409 ++j;
00410 slals0_(icompq, &nl, &nr, &sqre, nrhs, &b[nlf + b_dim1], ldb, &bx[
00411 nlf + bx_dim1], ldbx, &perm[nlf + lvl * perm_dim1], &
00412 givptr[j], &givcol[nlf + lvl2 * givcol_dim1], ldgcol, &
00413 givnum[nlf + lvl2 * givnum_dim1], ldu, &poles[nlf + lvl2 *
00414 poles_dim1], &difl[nlf + lvl * difl_dim1], &difr[nlf +
00415 lvl2 * difr_dim1], &z__[nlf + lvl * z_dim1], &k[j], &c__[
00416 j], &s[j], &work[1], info);
00417
00418 }
00419
00420 }
00421
00422
00423
00424
00425
00426 ndb1 = (nd + 1) / 2;
00427 i__1 = nd;
00428 for (i__ = ndb1; i__ <= i__1; ++i__) {
00429 i1 = i__ - 1;
00430 ic = iwork[inode + i1];
00431 nl = iwork[ndiml + i1];
00432 nr = iwork[ndimr + i1];
00433 nlp1 = nl + 1;
00434 if (i__ == nd) {
00435 nrp1 = nr;
00436 } else {
00437 nrp1 = nr + 1;
00438 }
00439 nlf = ic - nl;
00440 nrf = ic + 1;
00441 sgemm_("T", "N", &nlp1, nrhs, &nlp1, &c_b7, &vt[nlf + vt_dim1], ldu, &
00442 b[nlf + b_dim1], ldb, &c_b8, &bx[nlf + bx_dim1], ldbx);
00443 sgemm_("T", "N", &nrp1, nrhs, &nrp1, &c_b7, &vt[nrf + vt_dim1], ldu, &
00444 b[nrf + b_dim1], ldb, &c_b8, &bx[nrf + bx_dim1], ldbx);
00445
00446 }
00447
00448 L90:
00449
00450 return 0;
00451
00452
00453
00454 }