#ifndef GRID_LATTICE_UNARY_H #define GRID_LATTICE_UNARY_H namespace Grid { ////////////////////////////////////////////////////////////////////////////////////////////////////// // avoid copy back routines for mult, mac, sub, add ////////////////////////////////////////////////////////////////////////////////////////////////////// template Lattice sqrt(const Lattice &rhs){ Lattice ret(rhs._grid); ret.checkerboard = rhs.checkerboard; conformable(ret,rhs); PARALLEL_FOR_LOOP for(int ss=0;ssoSites();ss++){ ret._odata[ss]=sqrt(rhs._odata[ss]); } return ret; } template Lattice rsqrt(const Lattice &rhs){ Lattice ret(rhs._grid); ret.checkerboard = rhs.checkerboard; conformable(ret,rhs); PARALLEL_FOR_LOOP for(int ss=0;ssoSites();ss++){ ret._odata[ss]=rsqrt(rhs._odata[ss]); } return ret; } template Lattice sin(const Lattice &rhs){ Lattice ret(rhs._grid); ret.checkerboard = rhs.checkerboard; conformable(ret,rhs); PARALLEL_FOR_LOOP for(int ss=0;ssoSites();ss++){ ret._odata[ss]=sin(rhs._odata[ss]); } return ret; } template Lattice cos(const Lattice &rhs){ Lattice ret(rhs._grid); ret.checkerboard = rhs.checkerboard; conformable(ret,rhs); PARALLEL_FOR_LOOP for(int ss=0;ssoSites();ss++){ ret._odata[ss]=cos(rhs._odata[ss]); } return ret; } template Lattice pow(const Lattice &rhs,RealD y){ Lattice ret(rhs._grid); ret.checkerboard = rhs.checkerboard; conformable(ret,rhs); PARALLEL_FOR_LOOP for(int ss=0;ssoSites();ss++){ ret._odata[ss]=pow(rhs._odata[ss],y); } return ret; } template Lattice mod(const Lattice &rhs,Integer y){ Lattice ret(rhs._grid); ret.checkerboard = rhs.checkerboard; conformable(ret,rhs); PARALLEL_FOR_LOOP for(int ss=0;ssoSites();ss++){ ret._odata[ss]=mod(rhs._odata[ss],y); } return ret; } } #endif