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.
37 #include <types/simple.h>
38 #include "gmx_lapack.h"
41 F77_FUNC(slasr,SLASR)(const char *side,
51 /* System generated locals */
52 int a_dim1, a_offset, i__1, i__2;
62 a_offset = 1 + a_dim1;
68 if (*m == 0 || *n == 0) {
71 if (*side=='L' || *side=='l') {
73 if (*pivot=='V' || *pivot=='v') {
74 if (*direct=='F' || *direct=='f') {
76 for (j = 1; j <= i__1; ++j) {
79 if (fabs(ctemp-1.0)>GMX_FLOAT_EPS || fabs(stemp)>GMX_FLOAT_MIN) {
81 for (i__ = 1; i__ <= i__2; ++i__) {
82 temp = a[j + 1 + i__ * a_dim1];
83 a[j + 1 + i__ * a_dim1] = ctemp * temp - stemp *
85 a[j + i__ * a_dim1] = stemp * temp + ctemp * a[j
90 } else if (*direct=='B' || *direct=='b') {
91 for (j = *m - 1; j >= 1; --j) {
94 if (fabs(ctemp-1.0)>GMX_FLOAT_EPS || fabs(stemp)>GMX_FLOAT_MIN) {
96 for (i__ = 1; i__ <= i__1; ++i__) {
97 temp = a[j + 1 + i__ * a_dim1];
98 a[j + 1 + i__ * a_dim1] = ctemp * temp - stemp *
100 a[j + i__ * a_dim1] = stemp * temp + ctemp * a[j
106 } else if (*pivot=='T' || *pivot=='t') {
107 if (*direct=='F' || *direct=='f') {
109 for (j = 2; j <= i__1; ++j) {
112 if (fabs(ctemp-1.0)>GMX_FLOAT_EPS || fabs(stemp)>GMX_FLOAT_MIN) {
114 for (i__ = 1; i__ <= i__2; ++i__) {
115 temp = a[j + i__ * a_dim1];
116 a[j + i__ * a_dim1] = ctemp * temp - stemp * a[
118 a[i__ * a_dim1 + 1] = stemp * temp + ctemp * a[
123 } else if (*direct=='B' || *direct=='b') {
124 for (j = *m; j >= 2; --j) {
127 if (fabs(ctemp-1.0)>GMX_FLOAT_EPS || fabs(stemp)>GMX_FLOAT_MIN) {
129 for (i__ = 1; i__ <= i__1; ++i__) {
130 temp = a[j + i__ * a_dim1];
131 a[j + i__ * a_dim1] = ctemp * temp - stemp * a[
133 a[i__ * a_dim1 + 1] = stemp * temp + ctemp * a[
139 } else if (*pivot=='B' || *pivot=='b') {
140 if (*direct=='F' || *direct=='f') {
142 for (j = 1; j <= i__1; ++j) {
145 if (fabs(ctemp-1.0)>GMX_FLOAT_EPS || fabs(stemp)>GMX_FLOAT_MIN) {
147 for (i__ = 1; i__ <= i__2; ++i__) {
148 temp = a[j + i__ * a_dim1];
149 a[j + i__ * a_dim1] = stemp * a[*m + i__ * a_dim1]
151 a[*m + i__ * a_dim1] = ctemp * a[*m + i__ *
152 a_dim1] - stemp * temp;
156 } else if (*direct=='B' || *direct=='b') {
157 for (j = *m - 1; j >= 1; --j) {
160 if (fabs(ctemp-1.0)>GMX_FLOAT_EPS || fabs(stemp)>GMX_FLOAT_MIN) {
162 for (i__ = 1; i__ <= i__1; ++i__) {
163 temp = a[j + i__ * a_dim1];
164 a[j + i__ * a_dim1] = stemp * a[*m + i__ * a_dim1]
166 a[*m + i__ * a_dim1] = ctemp * a[*m + i__ *
167 a_dim1] - stemp * temp;
173 } else if (*side=='R' || *side=='r') {
175 if (*pivot=='V' || *pivot=='v') {
176 if (*direct=='F' || *direct=='f') {
178 for (j = 1; j <= i__1; ++j) {
181 if (fabs(ctemp-1.0)>GMX_FLOAT_EPS || fabs(stemp)>GMX_FLOAT_MIN) {
183 for (i__ = 1; i__ <= i__2; ++i__) {
184 temp = a[i__ + (j + 1) * a_dim1];
185 a[i__ + (j + 1) * a_dim1] = ctemp * temp - stemp *
187 a[i__ + j * a_dim1] = stemp * temp + ctemp * a[
192 } else if (*direct=='B' || *direct=='b') {
193 for (j = *n - 1; j >= 1; --j) {
196 if (fabs(ctemp-1.0)>GMX_FLOAT_EPS || fabs(stemp)>GMX_FLOAT_MIN) {
198 for (i__ = 1; i__ <= i__1; ++i__) {
199 temp = a[i__ + (j + 1) * a_dim1];
200 a[i__ + (j + 1) * a_dim1] = ctemp * temp - stemp *
202 a[i__ + j * a_dim1] = stemp * temp + ctemp * a[
208 } else if (*pivot=='T' || *pivot=='t') {
209 if (*direct=='F' || *direct=='f') {
211 for (j = 2; j <= i__1; ++j) {
214 if (fabs(ctemp-1.0)>GMX_FLOAT_EPS || fabs(stemp)>GMX_FLOAT_MIN) {
216 for (i__ = 1; i__ <= i__2; ++i__) {
217 temp = a[i__ + j * a_dim1];
218 a[i__ + j * a_dim1] = ctemp * temp - stemp * a[
220 a[i__ + a_dim1] = stemp * temp + ctemp * a[i__ +
225 } else if (*direct=='B' || *direct=='b') {
226 for (j = *n; j >= 2; --j) {
229 if (fabs(ctemp-1.0)>GMX_FLOAT_EPS || fabs(stemp)>GMX_FLOAT_MIN) {
231 for (i__ = 1; i__ <= i__1; ++i__) {
232 temp = a[i__ + j * a_dim1];
233 a[i__ + j * a_dim1] = ctemp * temp - stemp * a[
235 a[i__ + a_dim1] = stemp * temp + ctemp * a[i__ +
241 } else if (*pivot=='B' || *pivot=='b') {
242 if (*direct=='F' || *direct=='f') {
244 for (j = 1; j <= i__1; ++j) {
247 if (fabs(ctemp-1.0)>GMX_FLOAT_EPS || fabs(stemp)>GMX_FLOAT_MIN) {
249 for (i__ = 1; i__ <= i__2; ++i__) {
250 temp = a[i__ + j * a_dim1];
251 a[i__ + j * a_dim1] = stemp * a[i__ + *n * a_dim1]
253 a[i__ + *n * a_dim1] = ctemp * a[i__ + *n *
254 a_dim1] - stemp * temp;
258 } else if (*direct=='B' || *direct=='b') {
259 for (j = *n - 1; j >= 1; --j) {
262 if (fabs(ctemp-1.0)>GMX_FLOAT_EPS || fabs(stemp)>GMX_FLOAT_MIN) {
264 for (i__ = 1; i__ <= i__1; ++i__) {
265 temp = a[i__ + j * a_dim1];
266 a[i__ + j * a_dim1] = stemp * a[i__ + *n * a_dim1]
268 a[i__ + *n * a_dim1] = ctemp * a[i__ + *n *
269 a_dim1] - stemp * temp;