ergo
template_blas_rot.h
Go to the documentation of this file.
1 /* Ergo, version 3.3, a program for linear scaling electronic structure
2  * calculations.
3  * Copyright (C) 2013 Elias Rudberg, Emanuel H. Rubensson, and Pawel Salek.
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  *
18  * Primary academic reference:
19  * Kohn−Sham Density Functional Theory Electronic Structure Calculations
20  * with Linearly Scaling Computational Time and Memory Usage,
21  * Elias Rudberg, Emanuel H. Rubensson, and Pawel Salek,
22  * J. Chem. Theory Comput. 7, 340 (2011),
23  * <http://dx.doi.org/10.1021/ct100611z>
24  *
25  * For further information about Ergo, see <http://www.ergoscf.org>.
26  */
27 
28  /* This file belongs to the template_lapack part of the Ergo source
29  * code. The source files in the template_lapack directory are modified
30  * versions of files originally distributed as CLAPACK, see the
31  * Copyright/license notice in the file template_lapack/COPYING.
32  */
33 
34 
35 #ifndef TEMPLATE_BLAS_ROT_HEADER
36 #define TEMPLATE_BLAS_ROT_HEADER
37 
38 
39 template<class Treal>
40 int template_blas_rot(const integer *n, Treal *dx, const integer *incx,
41  Treal *dy, const integer *incy, const Treal *c__, const Treal *s)
42 {
43  /* System generated locals */
44  integer i__1;
45  /* Local variables */
46  integer i__;
47  Treal dtemp;
48  integer ix, iy;
49 /* applies a plane rotation.
50  jack dongarra, linpack, 3/11/78.
51  modified 12/3/93, array(1) declarations changed to array(*)
52  Parameter adjustments */
53  --dy;
54  --dx;
55  /* Function Body */
56  if (*n <= 0) {
57  return 0;
58  }
59  if (*incx == 1 && *incy == 1) {
60  goto L20;
61  }
62 /* code for unequal increments or equal increments not equal
63  to 1 */
64  ix = 1;
65  iy = 1;
66  if (*incx < 0) {
67  ix = (-(*n) + 1) * *incx + 1;
68  }
69  if (*incy < 0) {
70  iy = (-(*n) + 1) * *incy + 1;
71  }
72  i__1 = *n;
73  for (i__ = 1; i__ <= i__1; ++i__) {
74  dtemp = *c__ * dx[ix] + *s * dy[iy];
75  dy[iy] = *c__ * dy[iy] - *s * dx[ix];
76  dx[ix] = dtemp;
77  ix += *incx;
78  iy += *incy;
79 /* L10: */
80  }
81  return 0;
82 /* code for both increments equal to 1 */
83 L20:
84  i__1 = *n;
85  for (i__ = 1; i__ <= i__1; ++i__) {
86  dtemp = *c__ * dx[i__] + *s * dy[i__];
87  dy[i__] = *c__ * dy[i__] - *s * dx[i__];
88  dx[i__] = dtemp;
89 /* L30: */
90  }
91  return 0;
92 } /* drot_ */
93 
94 #endif
int integer
Definition: template_blas_common.h:38
int template_blas_rot(const integer *n, Treal *dx, const integer *incx, Treal *dy, const integer *incy, const Treal *c__, const Treal *s)
Definition: template_blas_rot.h:40