From 2a1387e992781258ffaf636142bb0bb13b168997 Mon Sep 17 00:00:00 2001 From: Christoph Lehner Date: Sun, 3 May 2020 17:27:11 -0400 Subject: [PATCH] rankInnerProduct --- Grid/lattice/Lattice_reduction.h | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Grid/lattice/Lattice_reduction.h b/Grid/lattice/Lattice_reduction.h index e2690cfe..8acbde66 100644 --- a/Grid/lattice/Lattice_reduction.h +++ b/Grid/lattice/Lattice_reduction.h @@ -5,6 +5,7 @@ Author: Azusa Yamaguchi Author: Peter Boyle Author: paboyle +Author: Christoph Lehner This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or @@ -93,7 +94,7 @@ template inline RealD norm2(const Lattice &arg){ // Double inner product template -inline ComplexD innerProduct(const Lattice &left,const Lattice &right) +inline ComplexD rankInnerProduct(const Lattice &left,const Lattice &right) { typedef typename vobj::scalar_type scalar_type; typedef typename vobj::vector_typeD vector_type; @@ -137,11 +138,18 @@ inline ComplexD innerProduct(const Lattice &left,const Lattice &righ }) nrm = TensorRemove(sum(inner_tmp_v,sites)); #endif - grid->GlobalSum(nrm); - return nrm; } +template +inline ComplexD innerProduct(const Lattice &left,const Lattice &right) { + GridBase *grid = left.Grid(); + ComplexD nrm = rankInnerProduct(left,right); + grid->GlobalSum(nrm); + return nrm; +} + + ///////////////////////// // Fast axpby_norm // z = a x + b y