#ifndef GRID_LATTICE_TRACE_H #define GRID_LATTICE_TRACE_H /////////////////////////////////////////////// // Tracing, transposing, peeking, poking /////////////////////////////////////////////// namespace Grid { //////////////////////////////////////////////////////////////////////////////////////////////////// // Trace //////////////////////////////////////////////////////////////////////////////////////////////////// template inline auto trace(const Lattice &lhs) -> Lattice { Lattice ret(lhs._grid); PARALLEL_FOR_LOOP for(int ss=0;ssoSites();ss++){ ret._odata[ss] = trace(lhs._odata[ss]); } return ret; }; //////////////////////////////////////////////////////////////////////////////////////////////////// // Trace Index level dependent operation //////////////////////////////////////////////////////////////////////////////////////////////////// template inline auto traceIndex(const Lattice &lhs) -> Lattice(lhs._odata[0]))> { Lattice(lhs._odata[0]))> ret(lhs._grid); PARALLEL_FOR_LOOP for(int ss=0;ssoSites();ss++){ ret._odata[ss] = traceIndex(lhs._odata[ss]); } return ret; }; } #endif