2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 2012, 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.
38 #include "gmx_lapack.h"
42 F77_FUNC(dlasdq,DLASDQ)(const char *uplo,
59 const char xuplo=toupper(*uplo);
60 int c_dim1, c_offset, u_dim1, u_offset, vt_dim1, vt_offset, i__1,
75 vt_offset = 1 + vt_dim1;
78 u_offset = 1 + u_dim1;
81 c_offset = 1 + c_dim1;
94 itmp1 = (*n > 1) ? *n : 1;
95 itmp2 = (*nru > 1) ? *nru : 1;
98 } else if (*sqre < 0 || *sqre > 1) {
102 } else if (*ncvt < 0) {
104 } else if (*nru < 0) {
106 } else if (*ncc < 0) {
108 } else if ((*ncvt == 0 && *ldvt < 1) || (*ncvt > 0 && *ldvt < itmp1)) {
110 } else if (*ldu < itmp2) {
112 } else if ((*ncc == 0 && *ldc < 1) || (*ncc > 0 && *ldc < itmp1)) {
122 rotate = *ncvt > 0 || *nru > 0 || *ncc > 0;
126 if (iuplo == 1 && sqre1 == 1) {
128 for (i__ = 1; i__ <= i__1; ++i__) {
129 F77_FUNC(dlartg,DLARTG)(&d__[i__], &e[i__], &cs, &sn, &r__);
131 e[i__] = sn * d__[i__ + 1];
132 d__[i__ + 1] = cs * d__[i__ + 1];
138 F77_FUNC(dlartg,DLARTG)(&d__[*n], &e[*n], &cs, &sn, &r__);
149 F77_FUNC(dlasr,DLASR)("L", "V", "F", &np1, ncvt, &work[1], &work[np1], &vt[
155 for (i__ = 1; i__ <= i__1; ++i__) {
156 F77_FUNC(dlartg,DLARTG)(&d__[i__], &e[i__], &cs, &sn, &r__);
158 e[i__] = sn * d__[i__ + 1];
159 d__[i__ + 1] = cs * d__[i__ + 1];
167 F77_FUNC(dlartg,DLARTG)(&d__[*n], &e[*n], &cs, &sn, &r__);
176 F77_FUNC(dlasr,DLASR)("R", "V", "F", nru, n, &work[1], &work[np1], &u[
179 F77_FUNC(dlasr,DLASR)("R", "V", "F", nru, &np1, &work[1], &work[np1], &u[
185 F77_FUNC(dlasr,DLASR)("L", "V", "F", n, ncc, &work[1], &work[np1], &c__[
188 F77_FUNC(dlasr,DLASR)("L", "V", "F", &np1, ncc, &work[1], &work[np1], &c__[
194 F77_FUNC(dbdsqr,DBDSQR)("U", n, ncvt, nru, ncc, &d__[1], &e[1], &vt[vt_offset], ldvt, &u[
195 u_offset], ldu, &c__[c_offset], ldc, &work[1], info);
198 for (i__ = 1; i__ <= i__1; ++i__) {
203 for (j = i__ + 1; j <= i__2; ++j) {
210 d__[isub] = d__[i__];
213 F77_FUNC(dswap,DSWAP)(ncvt, &vt[isub + vt_dim1], ldvt, &vt[i__ + vt_dim1],
217 F77_FUNC(dswap,DSWAP)(nru, &u[isub * u_dim1 + 1], &c__1, &u[i__ * u_dim1 + 1]
221 F77_FUNC(dswap,DSWAP)(ncc, &c__[isub + c_dim1], ldc, &c__[i__ + c_dim1], ldc)