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