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