|
libflame
revision_anchor
|
Functions | |
| int | dsytrd_fla (char *uplo, integer *n, doublereal *a, integer *lda, doublereal *d__, doublereal *e, doublereal *tau, doublereal *work, integer *lwork, integer *info) |
| int dsytrd_fla | ( | char * | uplo, |
| integer * | n, | ||
| doublereal * | a, | ||
| integer * | lda, | ||
| doublereal * | d__, | ||
| doublereal * | e, | ||
| doublereal * | tau, | ||
| doublereal * | work, | ||
| integer * | lwork, | ||
| integer * | info | ||
| ) |
References dsytd2_fla().
{
/* System generated locals */
integer a_dim1, a_offset, i__1, i__2, i__3;
/* Local variables */
integer i__, j, nb, kk, nx, iws;
extern logical lsame_(char *, char *);
integer nbmin, iinfo;
logical upper;
extern /* Subroutine */
int dsytd2_fla(char *, integer *, doublereal *, integer *, doublereal *, doublereal *, doublereal *, integer *), dsyr2k_(char *, char *, integer *, integer *, doublereal *, doublereal *, integer *, doublereal *, integer *, doublereal *, doublereal *, integer *), dlatrd_(char *, integer *, integer *, doublereal *, integer *, doublereal *, doublereal *, doublereal *, integer *), xerbla_(char *, integer *);
extern integer ilaenv_(integer *, char *, char *, integer *, integer *, integer *, integer *);
integer ldwork, lwkopt;
logical lquery;
/* -- LAPACK computational routine (version 3.4.0) -- */
/* -- LAPACK is a software package provided by Univ. of Tennessee, -- */
/* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- */
/* November 2011 */
/* .. Scalar Arguments .. */
/* .. */
/* .. Array Arguments .. */
/* .. */
/* ===================================================================== */
/* .. Parameters .. */
/* .. */
/* .. Local Scalars .. */
/* .. */
/* .. External Subroutines .. */
/* .. */
/* .. Intrinsic Functions .. */
/* .. */
/* .. External Functions .. */
/* .. */
/* .. Executable Statements .. */
/* Test the input parameters */
/* Parameter adjustments */
a_dim1 = *lda;
a_offset = 1 + a_dim1;
a -= a_offset;
--d__;
--e;
--tau;
--work;
/* Function Body */
*info = 0;
upper = lsame_(uplo, "U");
lquery = *lwork == -1;
if (! upper && ! lsame_(uplo, "L"))
{
*info = -1;
}
else if (*n < 0)
{
*info = -2;
}
else if (*lda < max(1,*n))
{
*info = -4;
}
else if (*lwork < 1 && ! lquery)
{
*info = -9;
}
if (*info == 0)
{
/* Determine the block size. */
nb = ilaenv_(&c__1, "DSYTRD", uplo, n, &c_n1, &c_n1, &c_n1);
lwkopt = *n * nb;
work[1] = (doublereal) lwkopt;
}
if (*info != 0)
{
i__1 = -(*info);
xerbla_("DSYTRD", &i__1);
return 0;
}
else if (lquery)
{
return 0;
}
/* Quick return if possible */
if (*n == 0)
{
work[1] = 1.;
return 0;
}
nx = *n;
iws = 1;
if (nb > 1 && nb < *n)
{
/* Determine when to cross over from blocked to unblocked code */
/* (last block is always handled by unblocked code). */
/* Computing MAX */
i__1 = nb;
i__2 = ilaenv_(&c__3, "DSYTRD", uplo, n, &c_n1, &c_n1, & c_n1); // , expr subst
nx = max(i__1,i__2);
if (nx < *n)
{
/* Determine if workspace is large enough for blocked code. */
ldwork = *n;
iws = ldwork * nb;
if (*lwork < iws)
{
/* Not enough workspace to use optimal NB: determine the */
/* minimum value of NB, and reduce NB or force use of */
/* unblocked code by setting NX = N. */
/* Computing MAX */
i__1 = *lwork / ldwork;
nb = max(i__1,1);
nbmin = ilaenv_(&c__2, "DSYTRD", uplo, n, &c_n1, &c_n1, &c_n1);
if (nb < nbmin)
{
nx = *n;
}
}
}
else
{
nx = *n;
}
}
else
{
nb = 1;
}
if (upper)
{
/* Reduce the upper triangle of A. */
/* Columns 1:kk are handled by the unblocked method. */
kk = *n - (*n - nx + nb - 1) / nb * nb;
i__1 = kk + 1;
i__2 = -nb;
for (i__ = *n - nb + 1;
i__2 < 0 ? i__ >= i__1 : i__ <= i__1;
i__ += i__2)
{
/* Reduce columns i:i+nb-1 to tridiagonal form and form the */
/* matrix W which is needed to update the unreduced part of */
/* the matrix */
i__3 = i__ + nb - 1;
dlatrd_(uplo, &i__3, &nb, &a[a_offset], lda, &e[1], &tau[1], & work[1], &ldwork);
/* Update the unreduced submatrix A(1:i-1,1:i-1), using an */
/* update of the form: A := A - V*W**T - W*V**T */
i__3 = i__ - 1;
dsyr2k_(uplo, "No transpose", &i__3, &nb, &c_b22, &a[i__ * a_dim1 + 1], lda, &work[1], &ldwork, &c_b23, &a[a_offset], lda);
/* Copy superdiagonal elements back into A, and diagonal */
/* elements into D */
i__3 = i__ + nb - 1;
for (j = i__;
j <= i__3;
++j)
{
a[j - 1 + j * a_dim1] = e[j - 1];
d__[j] = a[j + j * a_dim1];
/* L10: */
}
/* L20: */
}
/* Use unblocked code to reduce the last or only block */
dsytd2_fla(uplo, &kk, &a[a_offset], lda, &d__[1], &e[1], &tau[1], &iinfo);
}
else
{
/* Reduce the lower triangle of A */
i__2 = *n - nx;
i__1 = nb;
for (i__ = 1;
i__1 < 0 ? i__ >= i__2 : i__ <= i__2;
i__ += i__1)
{
/* Reduce columns i:i+nb-1 to tridiagonal form and form the */
/* matrix W which is needed to update the unreduced part of */
/* the matrix */
i__3 = *n - i__ + 1;
dlatrd_(uplo, &i__3, &nb, &a[i__ + i__ * a_dim1], lda, &e[i__], & tau[i__], &work[1], &ldwork);
/* Update the unreduced submatrix A(i+ib:n,i+ib:n), using */
/* an update of the form: A := A - V*W**T - W*V**T */
i__3 = *n - i__ - nb + 1;
dsyr2k_(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);
/* Copy subdiagonal elements back into A, and diagonal */
/* elements into D */
i__3 = i__ + nb - 1;
for (j = i__;
j <= i__3;
++j)
{
a[j + 1 + j * a_dim1] = e[j];
d__[j] = a[j + j * a_dim1];
/* L30: */
}
/* L40: */
}
/* Use unblocked code to reduce the last or only block */
i__1 = *n - i__ + 1;
dsytd2_fla(uplo, &i__1, &a[i__ + i__ * a_dim1], lda, &d__[i__], &e[i__], &tau[i__], &iinfo);
}
work[1] = (doublereal) lwkopt;
return 0;
/* End of DSYTRD */
}
1.7.6.1