From 7e3b298d3d712b5c8309454939cbf1cee2e82a33 Mon Sep 17 00:00:00 2001 From: Alessandro Lupo Date: Mon, 11 Oct 2021 16:28:15 +0100 Subject: [PATCH] project on sp2n --- Grid/lattice/Lattice_ET.h | 2 + Grid/tensors/Tensor_Ta.h | 108 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 110 insertions(+) diff --git a/Grid/lattice/Lattice_ET.h b/Grid/lattice/Lattice_ET.h index 4a8a7423..9042eb8f 100644 --- a/Grid/lattice/Lattice_ET.h +++ b/Grid/lattice/Lattice_ET.h @@ -346,6 +346,7 @@ GridUnopClass(UnaryTrace, trace(a)); GridUnopClass(UnaryTranspose, transpose(a)); GridUnopClass(UnaryTa, Ta(a)); GridUnopClass(UnaryProjectOnGroup, ProjectOnGroup(a)); +GridUnopClass(UnaryProjectOnSpGroup, ProjectOnSpGroup(a)); GridUnopClass(UnaryTimesI, timesI(a)); GridUnopClass(UnaryTimesMinusI, timesMinusI(a)); GridUnopClass(UnaryAbs, abs(a)); @@ -457,6 +458,7 @@ GRID_DEF_UNOP(trace, UnaryTrace); GRID_DEF_UNOP(transpose, UnaryTranspose); GRID_DEF_UNOP(Ta, UnaryTa); GRID_DEF_UNOP(ProjectOnGroup, UnaryProjectOnGroup); +GRID_DEF_UNOP(ProjectOnSpGroup, UnaryProjectOnSpGroup); GRID_DEF_UNOP(timesI, UnaryTimesI); GRID_DEF_UNOP(timesMinusI, UnaryTimesMinusI); GRID_DEF_UNOP(abs, UnaryAbs); // abs overloaded in cmath C++98; DON'T do the diff --git a/Grid/tensors/Tensor_Ta.h b/Grid/tensors/Tensor_Ta.h index 90e57b2b..f53296bc 100644 --- a/Grid/tensors/Tensor_Ta.h +++ b/Grid/tensors/Tensor_Ta.h @@ -135,6 +135,114 @@ accelerator_inline iMatrix ProjectOnGroup(const iMatrix &arg) return ret; } +// re-do for sp2n + +template accelerator_inline iScalar ProjectOnSpGroup(const iScalar&r) +{ + iScalar ret; + ret._internal = ProjectOnSpGroup(r._internal); + return ret; +} +template accelerator_inline iVector ProjectOnSpGroup(const iVector&r) +{ + iVector ret; + for(int i=0;i::TensorLevel == 0 >::type * =nullptr> +accelerator_inline iMatrix ProjectOnSpGroup(const iMatrix &arg) +{ + // need a check for the group type? + iMatrix ret(arg); + vtype nrm; + vtype inner; + for(int c1=0;c1