00001 /* Ergo, version 3.7, a program for linear scaling electronic structure 00002 * calculations. 00003 * Copyright (C) 2018 Elias Rudberg, Emanuel H. Rubensson, Pawel Salek, 00004 * and Anastasia Kruchinina. 00005 * 00006 * This program is free software: you can redistribute it and/or modify 00007 * it under the terms of the GNU General Public License as published by 00008 * the Free Software Foundation, either version 3 of the License, or 00009 * (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00018 * 00019 * Primary academic reference: 00020 * Ergo: An open-source program for linear-scaling electronic structure 00021 * calculations, 00022 * Elias Rudberg, Emanuel H. Rubensson, Pawel Salek, and Anastasia 00023 * Kruchinina, 00024 * SoftwareX 7, 107 (2018), 00025 * <http://dx.doi.org/10.1016/j.softx.2018.03.005> 00026 * 00027 * For further information about Ergo, see <http://www.ergoscf.org>. 00028 */ 00029 00030 /* This file belongs to the template_lapack part of the Ergo source 00031 * code. The source files in the template_lapack directory are modified 00032 * versions of files originally distributed as CLAPACK, see the 00033 * Copyright/license notice in the file template_lapack/COPYING. 00034 */ 00035 00036 00037 #ifndef TEMPLATE_BLAS_ROT_HEADER 00038 #define TEMPLATE_BLAS_ROT_HEADER 00039 00040 00041 template<class Treal> 00042 int template_blas_rot(const integer *n, Treal *dx, const integer *incx, 00043 Treal *dy, const integer *incy, const Treal *c__, const Treal *s) 00044 { 00045 /* System generated locals */ 00046 integer i__1; 00047 /* Local variables */ 00048 integer i__; 00049 Treal dtemp; 00050 integer ix, iy; 00051 /* applies a plane rotation. 00052 jack dongarra, linpack, 3/11/78. 00053 modified 12/3/93, array(1) declarations changed to array(*) 00054 Parameter adjustments */ 00055 --dy; 00056 --dx; 00057 /* Function Body */ 00058 if (*n <= 0) { 00059 return 0; 00060 } 00061 if (*incx == 1 && *incy == 1) { 00062 goto L20; 00063 } 00064 /* code for unequal increments or equal increments not equal 00065 to 1 */ 00066 ix = 1; 00067 iy = 1; 00068 if (*incx < 0) { 00069 ix = (-(*n) + 1) * *incx + 1; 00070 } 00071 if (*incy < 0) { 00072 iy = (-(*n) + 1) * *incy + 1; 00073 } 00074 i__1 = *n; 00075 for (i__ = 1; i__ <= i__1; ++i__) { 00076 dtemp = *c__ * dx[ix] + *s * dy[iy]; 00077 dy[iy] = *c__ * dy[iy] - *s * dx[ix]; 00078 dx[ix] = dtemp; 00079 ix += *incx; 00080 iy += *incy; 00081 /* L10: */ 00082 } 00083 return 0; 00084 /* code for both increments equal to 1 */ 00085 L20: 00086 i__1 = *n; 00087 for (i__ = 1; i__ <= i__1; ++i__) { 00088 dtemp = *c__ * dx[i__] + *s * dy[i__]; 00089 dy[i__] = *c__ * dy[i__] - *s * dx[i__]; 00090 dx[i__] = dtemp; 00091 /* L30: */ 00092 } 00093 return 0; 00094 } /* drot_ */ 00095 00096 #endif