#ifndef GRID_LATTICE_WHERE_H #define GRID_LATTICE_WHERE_H namespace Grid { // Must implement the predicate gating the // Must be able to reduce the predicate down to a single vInteger per site. // Must be able to require the type be iScalar x iScalar x .... // give a GetVtype method in iScalar // and blow away the tensor structures. // template inline void whereWolf(Lattice &ret,const Lattice &predicate,Lattice &iftrue,Lattice &iffalse) { conformable(iftrue,iffalse); conformable(iftrue,predicate); conformable(iftrue,ret); GridBase *grid=iftrue._grid; typedef typename vobj::scalar_object scalar_object; typedef typename vobj::scalar_type scalar_type; typedef typename vobj::vector_type vector_type; typedef typename iobj::vector_type mask_type; const int Nsimd = grid->Nsimd(); std::vector mask(Nsimd); std::vector truevals (Nsimd); std::vector falsevals(Nsimd); PARALLEL_FOR_LOOP for(int ss=0;ssoSites(); ss++){ extract(iftrue._odata[ss] ,truevals); extract(iffalse._odata[ss] ,falsevals); extract(TensorRemove(predicate._odata[ss]),mask); for(int s=0;s inline Lattice whereWolf(const Lattice &predicate,Lattice &iftrue,Lattice &iffalse) { conformable(iftrue,iffalse); conformable(iftrue,predicate); Lattice ret(iftrue._grid); where(ret,predicate,iftrue,iffalse); return ret; } } #endif