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_b2 = {1.,0.};
00019 static integer c__1 = 1;
00020 static integer c_n1 = -1;
00021 static integer c__3 = 3;
00022 static integer c__2 = 2;
00023 static integer c__65 = 65;
00024
00025 int zgehrd_(integer *n, integer *ilo, integer *ihi,
00026 doublecomplex *a, integer *lda, doublecomplex *tau, doublecomplex *
00027 work, integer *lwork, integer *info)
00028 {
00029
00030 integer a_dim1, a_offset, i__1, i__2, i__3, i__4;
00031 doublecomplex z__1;
00032
00033
00034 integer i__, j;
00035 doublecomplex t[4160] ;
00036 integer ib;
00037 doublecomplex ei;
00038 integer nb, nh, nx, iws, nbmin, iinfo;
00039 extern int zgemm_(char *, char *, integer *, integer *,
00040 integer *, doublecomplex *, doublecomplex *, integer *,
00041 doublecomplex *, integer *, doublecomplex *, doublecomplex *,
00042 integer *), ztrmm_(char *, char *, char *, char *,
00043 integer *, integer *, doublecomplex *, doublecomplex *, integer *
00044 , doublecomplex *, integer *),
00045 zaxpy_(integer *, doublecomplex *, doublecomplex *, integer *,
00046 doublecomplex *, integer *), zgehd2_(integer *, integer *,
00047 integer *, doublecomplex *, integer *, doublecomplex *,
00048 doublecomplex *, integer *), zlahr2_(integer *, integer *,
00049 integer *, doublecomplex *, integer *, doublecomplex *,
00050 doublecomplex *, integer *, doublecomplex *, integer *), xerbla_(
00051 char *, integer *);
00052 extern integer ilaenv_(integer *, char *, char *, integer *, integer *,
00053 integer *, integer *);
00054 extern int zlarfb_(char *, char *, char *, char *,
00055 integer *, integer *, integer *, doublecomplex *, integer *,
00056 doublecomplex *, integer *, doublecomplex *, integer *,
00057 doublecomplex *, integer *);
00058 integer ldwork, lwkopt;
00059 logical lquery;
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 a_dim1 = *lda;
00181 a_offset = 1 + a_dim1;
00182 a -= a_offset;
00183 --tau;
00184 --work;
00185
00186
00187 *info = 0;
00188
00189 i__1 = 64, i__2 = ilaenv_(&c__1, "ZGEHRD", " ", n, ilo, ihi, &c_n1);
00190 nb = min(i__1,i__2);
00191 lwkopt = *n * nb;
00192 work[1].r = (doublereal) lwkopt, work[1].i = 0.;
00193 lquery = *lwork == -1;
00194 if (*n < 0) {
00195 *info = -1;
00196 } else if (*ilo < 1 || *ilo > max(1,*n)) {
00197 *info = -2;
00198 } else if (*ihi < min(*ilo,*n) || *ihi > *n) {
00199 *info = -3;
00200 } else if (*lda < max(1,*n)) {
00201 *info = -5;
00202 } else if (*lwork < max(1,*n) && ! lquery) {
00203 *info = -8;
00204 }
00205 if (*info != 0) {
00206 i__1 = -(*info);
00207 xerbla_("ZGEHRD", &i__1);
00208 return 0;
00209 } else if (lquery) {
00210 return 0;
00211 }
00212
00213
00214
00215 i__1 = *ilo - 1;
00216 for (i__ = 1; i__ <= i__1; ++i__) {
00217 i__2 = i__;
00218 tau[i__2].r = 0., tau[i__2].i = 0.;
00219
00220 }
00221 i__1 = *n - 1;
00222 for (i__ = max(1,*ihi); i__ <= i__1; ++i__) {
00223 i__2 = i__;
00224 tau[i__2].r = 0., tau[i__2].i = 0.;
00225
00226 }
00227
00228
00229
00230 nh = *ihi - *ilo + 1;
00231 if (nh <= 1) {
00232 work[1].r = 1., work[1].i = 0.;
00233 return 0;
00234 }
00235
00236
00237
00238
00239 i__1 = 64, i__2 = ilaenv_(&c__1, "ZGEHRD", " ", n, ilo, ihi, &c_n1);
00240 nb = min(i__1,i__2);
00241 nbmin = 2;
00242 iws = 1;
00243 if (nb > 1 && nb < nh) {
00244
00245
00246
00247
00248
00249 i__1 = nb, i__2 = ilaenv_(&c__3, "ZGEHRD", " ", n, ilo, ihi, &c_n1);
00250 nx = max(i__1,i__2);
00251 if (nx < nh) {
00252
00253
00254
00255 iws = *n * nb;
00256 if (*lwork < iws) {
00257
00258
00259
00260
00261
00262
00263 i__1 = 2, i__2 = ilaenv_(&c__2, "ZGEHRD", " ", n, ilo, ihi, &
00264 c_n1);
00265 nbmin = max(i__1,i__2);
00266 if (*lwork >= *n * nbmin) {
00267 nb = *lwork / *n;
00268 } else {
00269 nb = 1;
00270 }
00271 }
00272 }
00273 }
00274 ldwork = *n;
00275
00276 if (nb < nbmin || nb >= nh) {
00277
00278
00279
00280 i__ = *ilo;
00281
00282 } else {
00283
00284
00285
00286 i__1 = *ihi - 1 - nx;
00287 i__2 = nb;
00288 for (i__ = *ilo; i__2 < 0 ? i__ >= i__1 : i__ <= i__1; i__ += i__2) {
00289
00290 i__3 = nb, i__4 = *ihi - i__;
00291 ib = min(i__3,i__4);
00292
00293
00294
00295
00296
00297 zlahr2_(ihi, &i__, &ib, &a[i__ * a_dim1 + 1], lda, &tau[i__], t, &
00298 c__65, &work[1], &ldwork);
00299
00300
00301
00302
00303
00304 i__3 = i__ + ib + (i__ + ib - 1) * a_dim1;
00305 ei.r = a[i__3].r, ei.i = a[i__3].i;
00306 i__3 = i__ + ib + (i__ + ib - 1) * a_dim1;
00307 a[i__3].r = 1., a[i__3].i = 0.;
00308 i__3 = *ihi - i__ - ib + 1;
00309 z__1.r = -1., z__1.i = -0.;
00310 zgemm_("No transpose", "Conjugate transpose", ihi, &i__3, &ib, &
00311 z__1, &work[1], &ldwork, &a[i__ + ib + i__ * a_dim1], lda,
00312 &c_b2, &a[(i__ + ib) * a_dim1 + 1], lda);
00313 i__3 = i__ + ib + (i__ + ib - 1) * a_dim1;
00314 a[i__3].r = ei.r, a[i__3].i = ei.i;
00315
00316
00317
00318
00319 i__3 = ib - 1;
00320 ztrmm_("Right", "Lower", "Conjugate transpose", "Unit", &i__, &
00321 i__3, &c_b2, &a[i__ + 1 + i__ * a_dim1], lda, &work[1], &
00322 ldwork);
00323 i__3 = ib - 2;
00324 for (j = 0; j <= i__3; ++j) {
00325 z__1.r = -1., z__1.i = -0.;
00326 zaxpy_(&i__, &z__1, &work[ldwork * j + 1], &c__1, &a[(i__ + j
00327 + 1) * a_dim1 + 1], &c__1);
00328
00329 }
00330
00331
00332
00333
00334 i__3 = *ihi - i__;
00335 i__4 = *n - i__ - ib + 1;
00336 zlarfb_("Left", "Conjugate transpose", "Forward", "Columnwise", &
00337 i__3, &i__4, &ib, &a[i__ + 1 + i__ * a_dim1], lda, t, &
00338 c__65, &a[i__ + 1 + (i__ + ib) * a_dim1], lda, &work[1], &
00339 ldwork);
00340
00341 }
00342 }
00343
00344
00345
00346 zgehd2_(n, &i__, ihi, &a[a_offset], lda, &tau[1], &work[1], &iinfo);
00347 work[1].r = (doublereal) iws, work[1].i = 0.;
00348
00349 return 0;
00350
00351
00352
00353 }