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_LAPACK_LACPY_HEADER 00038 #define TEMPLATE_LAPACK_LACPY_HEADER 00039 00040 00041 template<class Treal> 00042 int template_lapack_lacpy(const char *uplo, const integer *m, const integer *n, const Treal * 00043 a, const integer *lda, Treal *b, const integer *ldb) 00044 { 00045 /* -- LAPACK auxiliary routine (version 3.0) -- 00046 Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd., 00047 Courant Institute, Argonne National Lab, and Rice University 00048 February 29, 1992 00049 00050 00051 Purpose 00052 ======= 00053 00054 DLACPY copies all or part of a two-dimensional matrix A to another 00055 matrix B. 00056 00057 Arguments 00058 ========= 00059 00060 UPLO (input) CHARACTER*1 00061 Specifies the part of the matrix A to be copied to B. 00062 = 'U': Upper triangular part 00063 = 'L': Lower triangular part 00064 Otherwise: All of the matrix A 00065 00066 M (input) INTEGER 00067 The number of rows of the matrix A. M >= 0. 00068 00069 N (input) INTEGER 00070 The number of columns of the matrix A. N >= 0. 00071 00072 A (input) DOUBLE PRECISION array, dimension (LDA,N) 00073 The m by n matrix A. If UPLO = 'U', only the upper triangle 00074 or trapezoid is accessed; if UPLO = 'L', only the lower 00075 triangle or trapezoid is accessed. 00076 00077 LDA (input) INTEGER 00078 The leading dimension of the array A. LDA >= max(1,M). 00079 00080 B (output) DOUBLE PRECISION array, dimension (LDB,N) 00081 On exit, B = A in the locations specified by UPLO. 00082 00083 LDB (input) INTEGER 00084 The leading dimension of the array B. LDB >= max(1,M). 00085 00086 ===================================================================== 00087 00088 00089 Parameter adjustments */ 00090 /* System generated locals */ 00091 integer a_dim1, a_offset, b_dim1, b_offset, i__1, i__2; 00092 /* Local variables */ 00093 integer i__, j; 00094 #define a_ref(a_1,a_2) a[(a_2)*a_dim1 + a_1] 00095 #define b_ref(a_1,a_2) b[(a_2)*b_dim1 + a_1] 00096 00097 a_dim1 = *lda; 00098 a_offset = 1 + a_dim1 * 1; 00099 a -= a_offset; 00100 b_dim1 = *ldb; 00101 b_offset = 1 + b_dim1 * 1; 00102 b -= b_offset; 00103 00104 /* Function Body */ 00105 if (template_blas_lsame(uplo, "U")) { 00106 i__1 = *n; 00107 for (j = 1; j <= i__1; ++j) { 00108 i__2 = minMACRO(j,*m); 00109 for (i__ = 1; i__ <= i__2; ++i__) { 00110 b_ref(i__, j) = a_ref(i__, j); 00111 /* L10: */ 00112 } 00113 /* L20: */ 00114 } 00115 } else if (template_blas_lsame(uplo, "L")) { 00116 i__1 = *n; 00117 for (j = 1; j <= i__1; ++j) { 00118 i__2 = *m; 00119 for (i__ = j; i__ <= i__2; ++i__) { 00120 b_ref(i__, j) = a_ref(i__, j); 00121 /* L30: */ 00122 } 00123 /* L40: */ 00124 } 00125 } else { 00126 i__1 = *n; 00127 for (j = 1; j <= i__1; ++j) { 00128 i__2 = *m; 00129 for (i__ = 1; i__ <= i__2; ++i__) { 00130 b_ref(i__, j) = a_ref(i__, j); 00131 /* L50: */ 00132 } 00133 /* L60: */ 00134 } 00135 } 00136 return 0; 00137 00138 /* End of DLACPY */ 00139 00140 } /* dlacpy_ */ 00141 00142 #undef b_ref 00143 #undef a_ref 00144 00145 00146 #endif