2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 2012,2013, by the GROMACS development team, led by
5 * David van der Spoel, Berk Hess, Erik Lindahl, and including many
6 * others, as listed in the AUTHORS file in the top-level source
7 * directory and at http://www.gromacs.org.
9 * GROMACS is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public License
11 * as published by the Free Software Foundation; either version 2.1
12 * of the License, or (at your option) any later version.
14 * GROMACS is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with GROMACS; if not, see
21 * http://www.gnu.org/licenses, or write to the Free Software Foundation,
22 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 * If you want to redistribute modifications to GROMACS, please
25 * consider that scientific software is very special. Version
26 * control is crucial - bugs must be traceable. We will be happy to
27 * consider code for inclusion in the official distribution, but
28 * derived work must not be called official GROMACS. Details are found
29 * in the README & COPYING files - if they are missing, get the
30 * official version at http://www.gromacs.org.
32 * To help us fund GROMACS development, we humbly ask that you cite
33 * the research papers on the package. Check out http://www.gromacs.org.
36 #include "gmx_lapack.h"
37 #include "lapack_limits.h"
40 F77_FUNC(dsytrd,DSYTRD)(const char *uplo, int *n, double *a, int *
41 lda, double *d__, double *e, double *tau, double *
42 work, int *lwork, int *info)
44 /* System generated locals */
45 int a_dim1, a_offset, i__1, i__2, i__3;
48 int i__, j, nb, kk, nx, iws;
57 /* Parameter adjustments */
59 a_offset = 1 + a_dim1;
68 upper = (*uplo=='U' || *uplo=='u');
69 lquery = (*lwork == -1);
71 if (! upper && ! (*uplo=='L' || *uplo=='l')) {
75 } else if (*lda < ((1>*n) ? 1 : *n)) {
77 } else if (*lwork < 1 && ! lquery) {
83 nb = DSYTRD_BLOCKSIZE;
85 work[1] = (double) lwkopt;
99 if (nb > 1 && nb < *n) {
101 nx = DSYTRD_CROSSOVER;
108 i__1 = *lwork / ldwork;
109 nb = (i__1>1) ? i__1 : 1;
110 nbmin = DSYTRD_MINBLOCKSIZE;
124 kk = *n - (*n - nx + nb - 1) / nb * nb;
127 for (i__ = *n - nb + 1; i__2 < 0 ? i__ >= i__1 : i__ <= i__1; i__ +=
131 F77_FUNC(dlatrd,DLATRD)(uplo, &i__3, &nb, &a[a_offset], lda, &e[1], &tau[1], &
135 F77_FUNC(dsyr2k,DSYR2K)(uplo, "No transpose", &i__3, &nb, &c_b22, &a[i__ * a_dim1
136 + 1], lda, &work[1], &ldwork, &c_b23, &a[a_offset], lda);
139 for (j = i__; j <= i__3; ++j) {
140 a[j - 1 + j * a_dim1] = e[j - 1];
141 d__[j] = a[j + j * a_dim1];
147 F77_FUNC(dsytd2,DSYTD2)(uplo, &kk, &a[a_offset], lda, &d__[1], &e[1], &tau[1], &iinfo);
152 for (i__ = 1; i__1 < 0 ? i__ >= i__2 : i__ <= i__2; i__ += i__1) {
156 F77_FUNC(dlatrd,DLATRD)(uplo, &i__3, &nb, &a[i__ + i__ * a_dim1], lda, &e[i__], &
157 tau[i__], &work[1], &ldwork);
159 i__3 = *n - i__ - nb + 1;
160 F77_FUNC(dsyr2k,DSYR2K)(uplo, "No transpose", &i__3, &nb, &c_b22, &a[i__ + nb +
161 i__ * a_dim1], lda, &work[nb + 1], &ldwork, &c_b23, &a[
162 i__ + nb + (i__ + nb) * a_dim1], lda);
166 for (j = i__; j <= i__3; ++j) {
167 a[j + 1 + j * a_dim1] = e[j];
168 d__[j] = a[j + j * a_dim1];
176 F77_FUNC(dsytd2,DSYTD2)(uplo, &i__1, &a[i__ + i__ * a_dim1], lda, &d__[i__], &e[i__],
180 work[1] = (double) lwkopt;