194{
195
196 integer a_dim1, a_offset, i__1, i__2, i__3;
197
198 integer i__, j, nb, kk, nx, iws;
199 extern logical lsame_(
char *,
char *);
202 extern
203 int ssytd2_fla(
char *,
integer *,
real *,
integer *,
real *,
real *,
real *,
integer *), ssyr2k_(
char *,
char * ,
integer *,
integer *,
real *,
real *,
integer *,
real *,
integer *,
real *,
real *,
integer *), xerbla_(
char *,
integer *);
205 extern
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231 a_dim1 = *lda;
232 a_offset = 1 + a_dim1;
233 a -= a_offset;
234 --d__;
235 --e;
236 --tau;
237 --work;
238
239 *info = 0;
240 upper = lsame_(uplo, "U");
241 lquery = *lwork == -1;
242 if (! upper && ! lsame_(uplo, "L"))
243 {
244 *info = -1;
245 }
246 else if (*n < 0)
247 {
248 *info = -2;
249 }
250 else if (*lda < max(1,*n))
251 {
252 *info = -4;
253 }
254 else if (*lwork < 1 && ! lquery)
255 {
256 *info = -9;
257 }
258 if (*info == 0)
259 {
260
261 nb = ilaenv_(&c__1, "SSYTRD", uplo, n, &c_n1, &c_n1, &c_n1);
262 lwkopt = *n * nb;
263 work[1] = (
real) lwkopt;
264 }
265 if (*info != 0)
266 {
267 i__1 = -(*info);
268 xerbla_("SSYTRD", &i__1);
269 return 0;
270 }
271 else if (lquery)
272 {
273 return 0;
274 }
275
276 if (*n == 0)
277 {
278 work[1] = 1.f;
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, "SSYTRD", 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, "SSYTRD", 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 slatrd_(uplo, &i__3, &nb, &a[a_offset], lda, &e[1], &tau[1], & work[1], &ldwork);
336
337
338 i__3 = i__ - 1;
339 ssyr2k_(uplo, "No transpose", &i__3, &nb, &c_b22, &a[i__ * a_dim1 + 1], lda, &work[1], &ldwork, &c_b23, &a[a_offset], lda);
340
341
342 i__3 = i__ + nb - 1;
343 for (j = i__;
344 j <= i__3;
345 ++j)
346 {
347 a[j - 1 + j * a_dim1] = e[j - 1];
348 d__[j] = a[j + j * a_dim1];
349
350 }
351
352 }
353
354 ssytd2_fla(uplo, &kk, &a[a_offset], lda, &d__[1], &e[1], &tau[1], &iinfo);
355 }
356 else
357 {
358
359 i__2 = *n - nx;
360 i__1 = nb;
361 for (i__ = 1;
362 i__1 < 0 ? i__ >= i__2 : i__ <= i__2;
363 i__ += i__1)
364 {
365
366
367
368 i__3 = *n - i__ + 1;
369 slatrd_(uplo, &i__3, &nb, &a[i__ + i__ * a_dim1], lda, &e[i__], & tau[i__], &work[1], &ldwork);
370
371
372 i__3 = *n - i__ - nb + 1;
373 ssyr2k_(uplo, "No transpose", &i__3, &nb, &c_b22, &a[i__ + nb + i__ * a_dim1], lda, &work[nb + 1], &ldwork, &c_b23, &a[ i__ + nb + (i__ + nb) * a_dim1], lda);
374
375
376 i__3 = i__ + nb - 1;
377 for (j = i__;
378 j <= i__3;
379 ++j)
380 {
381 a[j + 1 + j * a_dim1] = e[j];
382 d__[j] = a[j + j * a_dim1];
383
384 }
385
386 }
387
388 i__1 = *n - i__ + 1;
389 ssytd2_fla(uplo, &i__1, &a[i__ + i__ * a_dim1], lda, &d__[i__], &e[i__], &tau[i__], &iinfo);
390 }
391 work[1] = (
real) lwkopt;
392 return 0;
393
394}
int integer
Definition FLA_f2c.h:25
int logical
Definition FLA_f2c.h:36
float real
Definition FLA_f2c.h:30
int ssytd2_fla(char *uplo, integer *n, real *a, integer *lda, real *d__, real *e, real *tau, integer *info)
Definition ssytd2.c:169