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 complex c_b1 = {0.f,0.f};
00019 static complex c_b2 = {1.f,0.f};
00020 static integer c__1 = 1;
00021
00022 int clatrd_(char *uplo, integer *n, integer *nb, complex *a,
00023 integer *lda, real *e, complex *tau, complex *w, integer *ldw)
00024 {
00025
00026 integer a_dim1, a_offset, w_dim1, w_offset, i__1, i__2, i__3;
00027 real r__1;
00028 complex q__1, q__2, q__3, q__4;
00029
00030
00031 integer i__, iw;
00032 complex alpha;
00033 extern int cscal_(integer *, complex *, complex *,
00034 integer *);
00035 extern VOID cdotc_(complex *, integer *, complex *, integer
00036 *, complex *, integer *);
00037 extern int cgemv_(char *, integer *, integer *, complex *
00038 , complex *, integer *, complex *, integer *, complex *, complex *
00039 , integer *), chemv_(char *, integer *, complex *,
00040 complex *, integer *, complex *, integer *, complex *, complex *,
00041 integer *);
00042 extern logical lsame_(char *, char *);
00043 extern int caxpy_(integer *, complex *, complex *,
00044 integer *, complex *, integer *), clarfg_(integer *, complex *,
00045 complex *, integer *, complex *), clacgv_(integer *, complex *,
00046 integer *);
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 a_dim1 = *lda;
00197 a_offset = 1 + a_dim1;
00198 a -= a_offset;
00199 --e;
00200 --tau;
00201 w_dim1 = *ldw;
00202 w_offset = 1 + w_dim1;
00203 w -= w_offset;
00204
00205
00206 if (*n <= 0) {
00207 return 0;
00208 }
00209
00210 if (lsame_(uplo, "U")) {
00211
00212
00213
00214 i__1 = *n - *nb + 1;
00215 for (i__ = *n; i__ >= i__1; --i__) {
00216 iw = i__ - *n + *nb;
00217 if (i__ < *n) {
00218
00219
00220
00221 i__2 = i__ + i__ * a_dim1;
00222 i__3 = i__ + i__ * a_dim1;
00223 r__1 = a[i__3].r;
00224 a[i__2].r = r__1, a[i__2].i = 0.f;
00225 i__2 = *n - i__;
00226 clacgv_(&i__2, &w[i__ + (iw + 1) * w_dim1], ldw);
00227 i__2 = *n - i__;
00228 q__1.r = -1.f, q__1.i = -0.f;
00229 cgemv_("No transpose", &i__, &i__2, &q__1, &a[(i__ + 1) *
00230 a_dim1 + 1], lda, &w[i__ + (iw + 1) * w_dim1], ldw, &
00231 c_b2, &a[i__ * a_dim1 + 1], &c__1);
00232 i__2 = *n - i__;
00233 clacgv_(&i__2, &w[i__ + (iw + 1) * w_dim1], ldw);
00234 i__2 = *n - i__;
00235 clacgv_(&i__2, &a[i__ + (i__ + 1) * a_dim1], lda);
00236 i__2 = *n - i__;
00237 q__1.r = -1.f, q__1.i = -0.f;
00238 cgemv_("No transpose", &i__, &i__2, &q__1, &w[(iw + 1) *
00239 w_dim1 + 1], ldw, &a[i__ + (i__ + 1) * a_dim1], lda, &
00240 c_b2, &a[i__ * a_dim1 + 1], &c__1);
00241 i__2 = *n - i__;
00242 clacgv_(&i__2, &a[i__ + (i__ + 1) * a_dim1], lda);
00243 i__2 = i__ + i__ * a_dim1;
00244 i__3 = i__ + i__ * a_dim1;
00245 r__1 = a[i__3].r;
00246 a[i__2].r = r__1, a[i__2].i = 0.f;
00247 }
00248 if (i__ > 1) {
00249
00250
00251
00252
00253 i__2 = i__ - 1 + i__ * a_dim1;
00254 alpha.r = a[i__2].r, alpha.i = a[i__2].i;
00255 i__2 = i__ - 1;
00256 clarfg_(&i__2, &alpha, &a[i__ * a_dim1 + 1], &c__1, &tau[i__
00257 - 1]);
00258 i__2 = i__ - 1;
00259 e[i__2] = alpha.r;
00260 i__2 = i__ - 1 + i__ * a_dim1;
00261 a[i__2].r = 1.f, a[i__2].i = 0.f;
00262
00263
00264
00265 i__2 = i__ - 1;
00266 chemv_("Upper", &i__2, &c_b2, &a[a_offset], lda, &a[i__ *
00267 a_dim1 + 1], &c__1, &c_b1, &w[iw * w_dim1 + 1], &c__1);
00268 if (i__ < *n) {
00269 i__2 = i__ - 1;
00270 i__3 = *n - i__;
00271 cgemv_("Conjugate transpose", &i__2, &i__3, &c_b2, &w[(iw
00272 + 1) * w_dim1 + 1], ldw, &a[i__ * a_dim1 + 1], &
00273 c__1, &c_b1, &w[i__ + 1 + iw * w_dim1], &c__1);
00274 i__2 = i__ - 1;
00275 i__3 = *n - i__;
00276 q__1.r = -1.f, q__1.i = -0.f;
00277 cgemv_("No transpose", &i__2, &i__3, &q__1, &a[(i__ + 1) *
00278 a_dim1 + 1], lda, &w[i__ + 1 + iw * w_dim1], &
00279 c__1, &c_b2, &w[iw * w_dim1 + 1], &c__1);
00280 i__2 = i__ - 1;
00281 i__3 = *n - i__;
00282 cgemv_("Conjugate transpose", &i__2, &i__3, &c_b2, &a[(
00283 i__ + 1) * a_dim1 + 1], lda, &a[i__ * a_dim1 + 1],
00284 &c__1, &c_b1, &w[i__ + 1 + iw * w_dim1], &c__1);
00285 i__2 = i__ - 1;
00286 i__3 = *n - i__;
00287 q__1.r = -1.f, q__1.i = -0.f;
00288 cgemv_("No transpose", &i__2, &i__3, &q__1, &w[(iw + 1) *
00289 w_dim1 + 1], ldw, &w[i__ + 1 + iw * w_dim1], &
00290 c__1, &c_b2, &w[iw * w_dim1 + 1], &c__1);
00291 }
00292 i__2 = i__ - 1;
00293 cscal_(&i__2, &tau[i__ - 1], &w[iw * w_dim1 + 1], &c__1);
00294 q__3.r = -.5f, q__3.i = -0.f;
00295 i__2 = i__ - 1;
00296 q__2.r = q__3.r * tau[i__2].r - q__3.i * tau[i__2].i, q__2.i =
00297 q__3.r * tau[i__2].i + q__3.i * tau[i__2].r;
00298 i__3 = i__ - 1;
00299 cdotc_(&q__4, &i__3, &w[iw * w_dim1 + 1], &c__1, &a[i__ *
00300 a_dim1 + 1], &c__1);
00301 q__1.r = q__2.r * q__4.r - q__2.i * q__4.i, q__1.i = q__2.r *
00302 q__4.i + q__2.i * q__4.r;
00303 alpha.r = q__1.r, alpha.i = q__1.i;
00304 i__2 = i__ - 1;
00305 caxpy_(&i__2, &alpha, &a[i__ * a_dim1 + 1], &c__1, &w[iw *
00306 w_dim1 + 1], &c__1);
00307 }
00308
00309
00310 }
00311 } else {
00312
00313
00314
00315 i__1 = *nb;
00316 for (i__ = 1; i__ <= i__1; ++i__) {
00317
00318
00319
00320 i__2 = i__ + i__ * a_dim1;
00321 i__3 = i__ + i__ * a_dim1;
00322 r__1 = a[i__3].r;
00323 a[i__2].r = r__1, a[i__2].i = 0.f;
00324 i__2 = i__ - 1;
00325 clacgv_(&i__2, &w[i__ + w_dim1], ldw);
00326 i__2 = *n - i__ + 1;
00327 i__3 = i__ - 1;
00328 q__1.r = -1.f, q__1.i = -0.f;
00329 cgemv_("No transpose", &i__2, &i__3, &q__1, &a[i__ + a_dim1], lda,
00330 &w[i__ + w_dim1], ldw, &c_b2, &a[i__ + i__ * a_dim1], &
00331 c__1);
00332 i__2 = i__ - 1;
00333 clacgv_(&i__2, &w[i__ + w_dim1], ldw);
00334 i__2 = i__ - 1;
00335 clacgv_(&i__2, &a[i__ + a_dim1], lda);
00336 i__2 = *n - i__ + 1;
00337 i__3 = i__ - 1;
00338 q__1.r = -1.f, q__1.i = -0.f;
00339 cgemv_("No transpose", &i__2, &i__3, &q__1, &w[i__ + w_dim1], ldw,
00340 &a[i__ + a_dim1], lda, &c_b2, &a[i__ + i__ * a_dim1], &
00341 c__1);
00342 i__2 = i__ - 1;
00343 clacgv_(&i__2, &a[i__ + a_dim1], lda);
00344 i__2 = i__ + i__ * a_dim1;
00345 i__3 = i__ + i__ * a_dim1;
00346 r__1 = a[i__3].r;
00347 a[i__2].r = r__1, a[i__2].i = 0.f;
00348 if (i__ < *n) {
00349
00350
00351
00352
00353 i__2 = i__ + 1 + i__ * a_dim1;
00354 alpha.r = a[i__2].r, alpha.i = a[i__2].i;
00355 i__2 = *n - i__;
00356
00357 i__3 = i__ + 2;
00358 clarfg_(&i__2, &alpha, &a[min(i__3, *n)+ i__ * a_dim1], &c__1,
00359 &tau[i__]);
00360 i__2 = i__;
00361 e[i__2] = alpha.r;
00362 i__2 = i__ + 1 + i__ * a_dim1;
00363 a[i__2].r = 1.f, a[i__2].i = 0.f;
00364
00365
00366
00367 i__2 = *n - i__;
00368 chemv_("Lower", &i__2, &c_b2, &a[i__ + 1 + (i__ + 1) * a_dim1]
00369 , lda, &a[i__ + 1 + i__ * a_dim1], &c__1, &c_b1, &w[
00370 i__ + 1 + i__ * w_dim1], &c__1);
00371 i__2 = *n - i__;
00372 i__3 = i__ - 1;
00373 cgemv_("Conjugate transpose", &i__2, &i__3, &c_b2, &w[i__ + 1
00374 + w_dim1], ldw, &a[i__ + 1 + i__ * a_dim1], &c__1, &
00375 c_b1, &w[i__ * w_dim1 + 1], &c__1);
00376 i__2 = *n - i__;
00377 i__3 = i__ - 1;
00378 q__1.r = -1.f, q__1.i = -0.f;
00379 cgemv_("No transpose", &i__2, &i__3, &q__1, &a[i__ + 1 +
00380 a_dim1], lda, &w[i__ * w_dim1 + 1], &c__1, &c_b2, &w[
00381 i__ + 1 + i__ * w_dim1], &c__1);
00382 i__2 = *n - i__;
00383 i__3 = i__ - 1;
00384 cgemv_("Conjugate transpose", &i__2, &i__3, &c_b2, &a[i__ + 1
00385 + a_dim1], lda, &a[i__ + 1 + i__ * a_dim1], &c__1, &
00386 c_b1, &w[i__ * w_dim1 + 1], &c__1);
00387 i__2 = *n - i__;
00388 i__3 = i__ - 1;
00389 q__1.r = -1.f, q__1.i = -0.f;
00390 cgemv_("No transpose", &i__2, &i__3, &q__1, &w[i__ + 1 +
00391 w_dim1], ldw, &w[i__ * w_dim1 + 1], &c__1, &c_b2, &w[
00392 i__ + 1 + i__ * w_dim1], &c__1);
00393 i__2 = *n - i__;
00394 cscal_(&i__2, &tau[i__], &w[i__ + 1 + i__ * w_dim1], &c__1);
00395 q__3.r = -.5f, q__3.i = -0.f;
00396 i__2 = i__;
00397 q__2.r = q__3.r * tau[i__2].r - q__3.i * tau[i__2].i, q__2.i =
00398 q__3.r * tau[i__2].i + q__3.i * tau[i__2].r;
00399 i__3 = *n - i__;
00400 cdotc_(&q__4, &i__3, &w[i__ + 1 + i__ * w_dim1], &c__1, &a[
00401 i__ + 1 + i__ * a_dim1], &c__1);
00402 q__1.r = q__2.r * q__4.r - q__2.i * q__4.i, q__1.i = q__2.r *
00403 q__4.i + q__2.i * q__4.r;
00404 alpha.r = q__1.r, alpha.i = q__1.i;
00405 i__2 = *n - i__;
00406 caxpy_(&i__2, &alpha, &a[i__ + 1 + i__ * a_dim1], &c__1, &w[
00407 i__ + 1 + i__ * w_dim1], &c__1);
00408 }
00409
00410
00411 }
00412 }
00413
00414 return 0;
00415
00416
00417
00418 }