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 integer c__3 = 3;
00019 static integer c__1 = 1;
00020 static doublereal c_b11 = 1.;
00021 static doublereal c_b13 = 0.;
00022
00023 int dlagge_(integer *m, integer *n, integer *kl, integer *ku,
00024 doublereal *d__, doublereal *a, integer *lda, integer *iseed,
00025 doublereal *work, integer *info)
00026 {
00027
00028 integer a_dim1, a_offset, i__1, i__2, i__3;
00029 doublereal d__1;
00030
00031
00032 double d_sign(doublereal *, doublereal *);
00033
00034
00035 integer i__, j;
00036 doublereal wa, wb, wn, tau;
00037 extern int dger_(integer *, integer *, doublereal *,
00038 doublereal *, integer *, doublereal *, integer *, doublereal *,
00039 integer *);
00040 extern doublereal dnrm2_(integer *, doublereal *, integer *);
00041 extern int dscal_(integer *, doublereal *, doublereal *,
00042 integer *), dgemv_(char *, integer *, integer *, doublereal *,
00043 doublereal *, integer *, doublereal *, integer *, doublereal *,
00044 doublereal *, integer *), xerbla_(char *, integer *), dlarnv_(integer *, integer *, integer *, doublereal *);
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 --d__;
00120 a_dim1 = *lda;
00121 a_offset = 1 + a_dim1;
00122 a -= a_offset;
00123 --iseed;
00124 --work;
00125
00126
00127 *info = 0;
00128 if (*m < 0) {
00129 *info = -1;
00130 } else if (*n < 0) {
00131 *info = -2;
00132 } else if (*kl < 0 || *kl > *m - 1) {
00133 *info = -3;
00134 } else if (*ku < 0 || *ku > *n - 1) {
00135 *info = -4;
00136 } else if (*lda < max(1,*m)) {
00137 *info = -7;
00138 }
00139 if (*info < 0) {
00140 i__1 = -(*info);
00141 xerbla_("DLAGGE", &i__1);
00142 return 0;
00143 }
00144
00145
00146
00147 i__1 = *n;
00148 for (j = 1; j <= i__1; ++j) {
00149 i__2 = *m;
00150 for (i__ = 1; i__ <= i__2; ++i__) {
00151 a[i__ + j * a_dim1] = 0.;
00152
00153 }
00154
00155 }
00156 i__1 = min(*m,*n);
00157 for (i__ = 1; i__ <= i__1; ++i__) {
00158 a[i__ + i__ * a_dim1] = d__[i__];
00159
00160 }
00161
00162
00163
00164 for (i__ = min(*m,*n); i__ >= 1; --i__) {
00165 if (i__ < *m) {
00166
00167
00168
00169 i__1 = *m - i__ + 1;
00170 dlarnv_(&c__3, &iseed[1], &i__1, &work[1]);
00171 i__1 = *m - i__ + 1;
00172 wn = dnrm2_(&i__1, &work[1], &c__1);
00173 wa = d_sign(&wn, &work[1]);
00174 if (wn == 0.) {
00175 tau = 0.;
00176 } else {
00177 wb = work[1] + wa;
00178 i__1 = *m - i__;
00179 d__1 = 1. / wb;
00180 dscal_(&i__1, &d__1, &work[2], &c__1);
00181 work[1] = 1.;
00182 tau = wb / wa;
00183 }
00184
00185
00186
00187 i__1 = *m - i__ + 1;
00188 i__2 = *n - i__ + 1;
00189 dgemv_("Transpose", &i__1, &i__2, &c_b11, &a[i__ + i__ * a_dim1],
00190 lda, &work[1], &c__1, &c_b13, &work[*m + 1], &c__1);
00191 i__1 = *m - i__ + 1;
00192 i__2 = *n - i__ + 1;
00193 d__1 = -tau;
00194 dger_(&i__1, &i__2, &d__1, &work[1], &c__1, &work[*m + 1], &c__1,
00195 &a[i__ + i__ * a_dim1], lda);
00196 }
00197 if (i__ < *n) {
00198
00199
00200
00201 i__1 = *n - i__ + 1;
00202 dlarnv_(&c__3, &iseed[1], &i__1, &work[1]);
00203 i__1 = *n - i__ + 1;
00204 wn = dnrm2_(&i__1, &work[1], &c__1);
00205 wa = d_sign(&wn, &work[1]);
00206 if (wn == 0.) {
00207 tau = 0.;
00208 } else {
00209 wb = work[1] + wa;
00210 i__1 = *n - i__;
00211 d__1 = 1. / wb;
00212 dscal_(&i__1, &d__1, &work[2], &c__1);
00213 work[1] = 1.;
00214 tau = wb / wa;
00215 }
00216
00217
00218
00219 i__1 = *m - i__ + 1;
00220 i__2 = *n - i__ + 1;
00221 dgemv_("No transpose", &i__1, &i__2, &c_b11, &a[i__ + i__ *
00222 a_dim1], lda, &work[1], &c__1, &c_b13, &work[*n + 1], &
00223 c__1);
00224 i__1 = *m - i__ + 1;
00225 i__2 = *n - i__ + 1;
00226 d__1 = -tau;
00227 dger_(&i__1, &i__2, &d__1, &work[*n + 1], &c__1, &work[1], &c__1,
00228 &a[i__ + i__ * a_dim1], lda);
00229 }
00230
00231 }
00232
00233
00234
00235
00236
00237 i__2 = *m - 1 - *kl, i__3 = *n - 1 - *ku;
00238 i__1 = max(i__2,i__3);
00239 for (i__ = 1; i__ <= i__1; ++i__) {
00240 if (*kl <= *ku) {
00241
00242
00243
00244
00245 i__2 = *m - 1 - *kl;
00246 if (i__ <= min(i__2,*n)) {
00247
00248
00249
00250 i__2 = *m - *kl - i__ + 1;
00251 wn = dnrm2_(&i__2, &a[*kl + i__ + i__ * a_dim1], &c__1);
00252 wa = d_sign(&wn, &a[*kl + i__ + i__ * a_dim1]);
00253 if (wn == 0.) {
00254 tau = 0.;
00255 } else {
00256 wb = a[*kl + i__ + i__ * a_dim1] + wa;
00257 i__2 = *m - *kl - i__;
00258 d__1 = 1. / wb;
00259 dscal_(&i__2, &d__1, &a[*kl + i__ + 1 + i__ * a_dim1], &
00260 c__1);
00261 a[*kl + i__ + i__ * a_dim1] = 1.;
00262 tau = wb / wa;
00263 }
00264
00265
00266
00267 i__2 = *m - *kl - i__ + 1;
00268 i__3 = *n - i__;
00269 dgemv_("Transpose", &i__2, &i__3, &c_b11, &a[*kl + i__ + (i__
00270 + 1) * a_dim1], lda, &a[*kl + i__ + i__ * a_dim1], &
00271 c__1, &c_b13, &work[1], &c__1);
00272 i__2 = *m - *kl - i__ + 1;
00273 i__3 = *n - i__;
00274 d__1 = -tau;
00275 dger_(&i__2, &i__3, &d__1, &a[*kl + i__ + i__ * a_dim1], &
00276 c__1, &work[1], &c__1, &a[*kl + i__ + (i__ + 1) *
00277 a_dim1], lda);
00278 a[*kl + i__ + i__ * a_dim1] = -wa;
00279 }
00280
00281
00282 i__2 = *n - 1 - *ku;
00283 if (i__ <= min(i__2,*m)) {
00284
00285
00286
00287 i__2 = *n - *ku - i__ + 1;
00288 wn = dnrm2_(&i__2, &a[i__ + (*ku + i__) * a_dim1], lda);
00289 wa = d_sign(&wn, &a[i__ + (*ku + i__) * a_dim1]);
00290 if (wn == 0.) {
00291 tau = 0.;
00292 } else {
00293 wb = a[i__ + (*ku + i__) * a_dim1] + wa;
00294 i__2 = *n - *ku - i__;
00295 d__1 = 1. / wb;
00296 dscal_(&i__2, &d__1, &a[i__ + (*ku + i__ + 1) * a_dim1],
00297 lda);
00298 a[i__ + (*ku + i__) * a_dim1] = 1.;
00299 tau = wb / wa;
00300 }
00301
00302
00303
00304 i__2 = *m - i__;
00305 i__3 = *n - *ku - i__ + 1;
00306 dgemv_("No transpose", &i__2, &i__3, &c_b11, &a[i__ + 1 + (*
00307 ku + i__) * a_dim1], lda, &a[i__ + (*ku + i__) *
00308 a_dim1], lda, &c_b13, &work[1], &c__1);
00309 i__2 = *m - i__;
00310 i__3 = *n - *ku - i__ + 1;
00311 d__1 = -tau;
00312 dger_(&i__2, &i__3, &d__1, &work[1], &c__1, &a[i__ + (*ku +
00313 i__) * a_dim1], lda, &a[i__ + 1 + (*ku + i__) *
00314 a_dim1], lda);
00315 a[i__ + (*ku + i__) * a_dim1] = -wa;
00316 }
00317 } else {
00318
00319
00320
00321
00322
00323 i__2 = *n - 1 - *ku;
00324 if (i__ <= min(i__2,*m)) {
00325
00326
00327
00328 i__2 = *n - *ku - i__ + 1;
00329 wn = dnrm2_(&i__2, &a[i__ + (*ku + i__) * a_dim1], lda);
00330 wa = d_sign(&wn, &a[i__ + (*ku + i__) * a_dim1]);
00331 if (wn == 0.) {
00332 tau = 0.;
00333 } else {
00334 wb = a[i__ + (*ku + i__) * a_dim1] + wa;
00335 i__2 = *n - *ku - i__;
00336 d__1 = 1. / wb;
00337 dscal_(&i__2, &d__1, &a[i__ + (*ku + i__ + 1) * a_dim1],
00338 lda);
00339 a[i__ + (*ku + i__) * a_dim1] = 1.;
00340 tau = wb / wa;
00341 }
00342
00343
00344
00345 i__2 = *m - i__;
00346 i__3 = *n - *ku - i__ + 1;
00347 dgemv_("No transpose", &i__2, &i__3, &c_b11, &a[i__ + 1 + (*
00348 ku + i__) * a_dim1], lda, &a[i__ + (*ku + i__) *
00349 a_dim1], lda, &c_b13, &work[1], &c__1);
00350 i__2 = *m - i__;
00351 i__3 = *n - *ku - i__ + 1;
00352 d__1 = -tau;
00353 dger_(&i__2, &i__3, &d__1, &work[1], &c__1, &a[i__ + (*ku +
00354 i__) * a_dim1], lda, &a[i__ + 1 + (*ku + i__) *
00355 a_dim1], lda);
00356 a[i__ + (*ku + i__) * a_dim1] = -wa;
00357 }
00358
00359
00360 i__2 = *m - 1 - *kl;
00361 if (i__ <= min(i__2,*n)) {
00362
00363
00364
00365 i__2 = *m - *kl - i__ + 1;
00366 wn = dnrm2_(&i__2, &a[*kl + i__ + i__ * a_dim1], &c__1);
00367 wa = d_sign(&wn, &a[*kl + i__ + i__ * a_dim1]);
00368 if (wn == 0.) {
00369 tau = 0.;
00370 } else {
00371 wb = a[*kl + i__ + i__ * a_dim1] + wa;
00372 i__2 = *m - *kl - i__;
00373 d__1 = 1. / wb;
00374 dscal_(&i__2, &d__1, &a[*kl + i__ + 1 + i__ * a_dim1], &
00375 c__1);
00376 a[*kl + i__ + i__ * a_dim1] = 1.;
00377 tau = wb / wa;
00378 }
00379
00380
00381
00382 i__2 = *m - *kl - i__ + 1;
00383 i__3 = *n - i__;
00384 dgemv_("Transpose", &i__2, &i__3, &c_b11, &a[*kl + i__ + (i__
00385 + 1) * a_dim1], lda, &a[*kl + i__ + i__ * a_dim1], &
00386 c__1, &c_b13, &work[1], &c__1);
00387 i__2 = *m - *kl - i__ + 1;
00388 i__3 = *n - i__;
00389 d__1 = -tau;
00390 dger_(&i__2, &i__3, &d__1, &a[*kl + i__ + i__ * a_dim1], &
00391 c__1, &work[1], &c__1, &a[*kl + i__ + (i__ + 1) *
00392 a_dim1], lda);
00393 a[*kl + i__ + i__ * a_dim1] = -wa;
00394 }
00395 }
00396
00397 i__2 = *m;
00398 for (j = *kl + i__ + 1; j <= i__2; ++j) {
00399 a[j + i__ * a_dim1] = 0.;
00400
00401 }
00402
00403 i__2 = *n;
00404 for (j = *ku + i__ + 1; j <= i__2; ++j) {
00405 a[i__ + j * a_dim1] = 0.;
00406
00407 }
00408
00409 }
00410 return 0;
00411
00412
00413
00414 }