193{
194
195 integer a_dim1, a_offset, i__1, i__2, i__3, i__4, i__5;
197
198 integer i__, j, nb, kk, nx, iws;
199 extern logical lsame_(
char *,
char *);
202 extern
203 int chetd2_fla(
char *,
integer *,
complex *,
integer *,
real *,
real *,
complex *,
integer *), cher2k_(
char *,
char *,
integer *,
integer *,
complex *,
complex *,
integer *,
complex *,
integer *,
real *,
complex *,
integer *), clatrd_(
char *,
integer *,
integer *,
complex *,
integer *,
real *,
complex *,
complex *,
integer *), xerbla_(
char *,
integer *);
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229 a_dim1 = *lda;
230 a_offset = 1 + a_dim1;
231 a -= a_offset;
232 --d__;
233 --e;
234 --tau;
235 --work;
236
237 *info = 0;
238 upper = lsame_(uplo, "U");
239 lquery = *lwork == -1;
240 if (! upper && ! lsame_(uplo, "L"))
241 {
242 *info = -1;
243 }
244 else if (*n < 0)
245 {
246 *info = -2;
247 }
248 else if (*lda < max(1,*n))
249 {
250 *info = -4;
251 }
252 else if (*lwork < 1 && ! lquery)
253 {
254 *info = -9;
255 }
256 if (*info == 0)
257 {
258
259 nb = ilaenv_(&c__1, "CHETRD", uplo, n, &c_n1, &c_n1, &c_n1);
260 lwkopt = *n * nb;
261 work[1].
r = (
real) lwkopt;
263 }
264 if (*info != 0)
265 {
266 i__1 = -(*info);
267 xerbla_("CHETRD", &i__1);
268 return 0;
269 }
270 else if (lquery)
271 {
272 return 0;
273 }
274
275 if (*n == 0)
276 {
279 return 0;
280 }
281 nx = *n;
282 iws = 1;
283 if (nb > 1 && nb < *n)
284 {
285
286
287
288 i__1 = nb;
289 i__2 = ilaenv_(&c__3, "CHETRD", uplo, n, &c_n1, &c_n1, & c_n1);
290 nx = max(i__1,i__2);
291 if (nx < *n)
292 {
293
294 ldwork = *n;
295 iws = ldwork * nb;
296 if (*lwork < iws)
297 {
298
299
300
301
302 i__1 = *lwork / ldwork;
303 nb = max(i__1,1);
304 nbmin = ilaenv_(&c__2, "CHETRD", uplo, n, &c_n1, &c_n1, &c_n1);
305 if (nb < nbmin)
306 {
307 nx = *n;
308 }
309 }
310 }
311 else
312 {
313 nx = *n;
314 }
315 }
316 else
317 {
318 nb = 1;
319 }
320 if (upper)
321 {
322
323
324 kk = *n - (*n - nx + nb - 1) / nb * nb;
325 i__1 = kk + 1;
326 i__2 = -nb;
327 for (i__ = *n - nb + 1;
328 i__2 < 0 ? i__ >= i__1 : i__ <= i__1;
329 i__ += i__2)
330 {
331
332
333
334 i__3 = i__ + nb - 1;
335 clatrd_(uplo, &i__3, &nb, &a[a_offset], lda, &e[1], &tau[1], & work[1], &ldwork);
336
337
338 i__3 = i__ - 1;
341 cher2k_(uplo, "No transpose", &i__3, &nb, &q__1, &a[i__ * a_dim1 + 1], lda, &work[1], &ldwork, &c_b23, &a[a_offset], lda);
342
343
344 i__3 = i__ + nb - 1;
345 for (j = i__;
346 j <= i__3;
347 ++j)
348 {
349 i__4 = j - 1 + j * a_dim1;
350 i__5 = j - 1;
353 i__4 = j;
354 i__5 = j + j * a_dim1;
355 d__[i__4] = a[i__5].
r;
356
357 }
358
359 }
360
361 chetd2_fla(uplo, &kk, &a[a_offset], lda, &d__[1], &e[1], &tau[1], &iinfo);
362 }
363 else
364 {
365
366 i__2 = *n - nx;
367 i__1 = nb;
368 for (i__ = 1;
369 i__1 < 0 ? i__ >= i__2 : i__ <= i__2;
370 i__ += i__1)
371 {
372
373
374
375 i__3 = *n - i__ + 1;
376 clatrd_(uplo, &i__3, &nb, &a[i__ + i__ * a_dim1], lda, &e[i__], & tau[i__], &work[1], &ldwork);
377
378
379 i__3 = *n - i__ - nb + 1;
382 cher2k_(uplo, "No transpose", &i__3, &nb, &q__1, &a[i__ + nb + i__ * a_dim1], lda, &work[nb + 1], &ldwork, &c_b23, &a[ i__ + nb + (i__ + nb) * a_dim1], lda);
383
384
385 i__3 = i__ + nb - 1;
386 for (j = i__;
387 j <= i__3;
388 ++j)
389 {
390 i__4 = j + 1 + j * a_dim1;
391 i__5 = j;
394 i__4 = j;
395 i__5 = j + j * a_dim1;
396 d__[i__4] = a[i__5].
r;
397
398 }
399
400 }
401
402 i__1 = *n - i__ + 1;
403 chetd2_fla(uplo, &i__1, &a[i__ + i__ * a_dim1], lda, &d__[i__], &e[i__], &tau[i__], &iinfo);
404 }
405 work[1].
r = (
real) lwkopt;
407 return 0;
408
409}
int integer
Definition FLA_f2c.h:25
int logical
Definition FLA_f2c.h:36
float real
Definition FLA_f2c.h:30
int chetd2_fla(char *uplo, integer *n, complex *a, integer *lda, real *d__, real *e, complex *tau, integer *info)
Definition chetd2.c:174
real r
Definition FLA_f2c.h:32
real i
Definition FLA_f2c.h:32