From 08f2a4564f0fb1fc04d8193b1d89b090765403cc Mon Sep 17 00:00:00 2001 From: paboyle Date: Sun, 14 Jan 2018 23:56:33 +0000 Subject: [PATCH] Namespace, formatting --- lib/lattice/Lattice_reduction.h | 123 ++++++++++++++++---------------- 1 file changed, 62 insertions(+), 61 deletions(-) diff --git a/lib/lattice/Lattice_reduction.h b/lib/lattice/Lattice_reduction.h index 8a3fbece..3e0a36fd 100644 --- a/lib/lattice/Lattice_reduction.h +++ b/lib/lattice/Lattice_reduction.h @@ -17,21 +17,22 @@ Author: paboyle with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. See the full license in the file "LICENSE" in the top level distribution directory - *************************************************************************************/ - /* END LEGAL */ +*************************************************************************************/ +/* END LEGAL */ #ifndef GRID_LATTICE_REDUCTION_H #define GRID_LATTICE_REDUCTION_H #include -namespace Grid { #ifdef GRID_WARN_SUBOPTIMAL #warning "Optimisation alert all these reduction loops are NOT threaded " #endif - //////////////////////////////////////////////////////////////////////////////////////////////////// - // Deterministic Reduction operations - //////////////////////////////////////////////////////////////////////////////////////////////////// +NAMESPACE_BEGIN(Grid); + +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Deterministic Reduction operations +//////////////////////////////////////////////////////////////////////////////////////////////////// template inline RealD norm2(const Lattice &arg){ ComplexD nrm = innerProduct(arg,arg); return std::real(nrm); @@ -78,7 +79,7 @@ inline auto sum(const LatticeUnaryExpression & expr) template inline auto sum(const LatticeBinaryExpression & expr) - ->typename decltype(expr.first.func(eval(0,std::get<0>(expr.second)),eval(0,std::get<1>(expr.second))))::scalar_object + ->typename decltype(expr.first.func(eval(0,std::get<0>(expr.second)),eval(0,std::get<1>(expr.second))))::scalar_object { return sum(closure(expr)); } @@ -370,8 +371,8 @@ static void sliceMaddVector(Lattice &R,std::vector &a,const Lattice }; /* -inline GridBase *makeSubSliceGrid(const GridBase *BlockSolverGrid,int Orthog) -{ + inline GridBase *makeSubSliceGrid(const GridBase *BlockSolverGrid,int Orthog) + { int NN = BlockSolverGrid->_ndimension; int nsimd = BlockSolverGrid->Nsimd(); @@ -380,14 +381,14 @@ inline GridBase *makeSubSliceGrid(const GridBase *BlockSolverGrid,int Or std::vector mpi_phys(0); for(int d=0;d_fdimensions[d]); - simd_phys.push_back(BlockSolverGrid->_simd_layout[d]); - mpi_phys.push_back(BlockSolverGrid->_processors[d]); - } + if( d!=Orthog ) { + latt_phys.push_back(BlockSolverGrid->_fdimensions[d]); + simd_phys.push_back(BlockSolverGrid->_simd_layout[d]); + mpi_phys.push_back(BlockSolverGrid->_processors[d]); + } } return (GridBase *)new GridCartesian(latt_phys,simd_phys,mpi_phys); -} + } */ template @@ -422,22 +423,22 @@ static void sliceMaddMatrix (Lattice &R,Eigen::MatrixXcd &aa,const Lattice #pragma omp for collapse(2) for(int n=0;n &R,Eigen::MatrixXcd &aa,const Lattice< #pragma omp for collapse(2) for(int n=0;n #pragma omp for collapse(2) for(int n=0;n } for(int i=0;iGlobalSum(sum); - mat(i,j)=sum; - }} + for(int j=0;jGlobalSum(sum); + mat(i,j)=sum; + }} return; } -} /*END NAMESPACE GRID*/ +NAMESPACE_END(Grid); #endif