From b728af903c4add9f92ad970b561f86ca3156752a Mon Sep 17 00:00:00 2001 From: Peter Boyle Date: Fri, 11 Oct 2024 03:23:09 +0000 Subject: [PATCH] Fast axpy norm under CFLAG --- Grid/lattice/Lattice_arith.h | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/Grid/lattice/Lattice_arith.h b/Grid/lattice/Lattice_arith.h index 5b37532f..f40d23da 100644 --- a/Grid/lattice/Lattice_arith.h +++ b/Grid/lattice/Lattice_arith.h @@ -257,17 +257,30 @@ void axpby(Lattice &ret,sobj a,sobj b,const Lattice &x,const Lattice }); } +#define FAST_AXPY_NORM template inline RealD axpy_norm(Lattice &ret,sobj a,const Lattice &x,const Lattice &y) { GRID_TRACE("axpy_norm"); - return axpy_norm_fast(ret,a,x,y); +#ifdef FAST_AXPY_NORM + return axpy_norm_fast(ret,a,x,y); +#else + ret = a*x+y; + RealD nn=norm2(ret); + return nn; +#endif } template inline RealD axpby_norm(Lattice &ret,sobj a,sobj b,const Lattice &x,const Lattice &y) { GRID_TRACE("axpby_norm"); - return axpby_norm_fast(ret,a,b,x,y); +#ifdef FAST_AXPY_NORM + return axpby_norm_fast(ret,a,b,x,y); +#else + ret = a*x+b*y; + RealD nn=norm2(ret); + return nn; +#endif } /// Trace product