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 <types/simple.h>
43 F77_FUNC(dsyr2,DSYR2)(const char * uplo,
53 int kx,ky,ix,iy,jx,jy,j,i;
55 const char ch=toupper(*uplo);
61 float alpha = *alpha__;
64 if(n<=0 || fabs(alpha)<GMX_DOUBLE_MIN || incx==0 || incy==0 ||
65 (ch != 'U' && ch != 'L'))
68 jx = jy = kx = ky = 0;
70 /* init start points for non-unit increments */
71 if(incx!=1 || incy!=1) {
75 kx = 1 - (n - 1)*(incx);
79 ky = 1 - (n - 1)*(incy);
86 /* Data in upper part of A */
87 if(incx==1 && incy==1) {
88 /* Unit increments for both x and y */
90 if( fabs(x[j-1])>GMX_DOUBLE_MIN || fabs(y[j-1])>GMX_DOUBLE_MIN ) {
91 temp1 = alpha * y[j-1];
92 temp2 = alpha * x[j-1];
94 a[(j-1)*(lda)+(i-1)] += x[i-1]*temp1 + y[i-1]*temp2;
99 /* non-unit increments */
102 if( fabs(x[jx-1])>GMX_DOUBLE_MIN || fabs(y[jy-1])>GMX_DOUBLE_MIN ) {
103 temp1 = alpha * y[jy-1];
104 temp2 = alpha * x[jx-1];
108 a[(j-1)*(lda)+(i-1)] += x[ix-1]*temp1 + y[iy-1]*temp2;
118 /* Data in lower part of A */
119 if(incx==1 && incy==1) {
120 /* Unit increments for both x and y */
122 if( fabs(x[j-1])>GMX_DOUBLE_MIN || fabs(y[j-1])>GMX_DOUBLE_MIN ) {
123 temp1 = alpha * y[j-1];
124 temp2 = alpha * x[j-1];
126 a[(j-1)*(lda)+(i-1)] += x[i-1]*temp1 + y[i-1]*temp2;
131 /* non-unit increments */
134 if( fabs(x[jx-1])>GMX_DOUBLE_MIN || fabs(y[jy-1])>GMX_DOUBLE_MIN ) {
135 temp1 = alpha * y[jy-1];
136 temp2 = alpha * x[jx-1];
140 a[(j-1)*(lda)+(i-1)] += x[ix-1]*temp1 + y[iy-1]*temp2;