From 283f14b7c1151538a5558bfb45fa3b18b52fef5b Mon Sep 17 00:00:00 2001 From: Alessandro Lupo Date: Tue, 12 Oct 2021 12:12:16 +0100 Subject: [PATCH] fix sp2n projection --- Grid/tensors/Tensor_Ta.h | 133 ++++++++++++++----------------- tests/sp2n/Test_project_on_Sp.cc | 122 +++++++++++++++++++++++++++- 2 files changed, 181 insertions(+), 74 deletions(-) diff --git a/Grid/tensors/Tensor_Ta.h b/Grid/tensors/Tensor_Ta.h index f53296bc..7b4bccca 100644 --- a/Grid/tensors/Tensor_Ta.h +++ b/Grid/tensors/Tensor_Ta.h @@ -161,88 +161,75 @@ accelerator_inline iMatrix ProjectOnSpGroup(const iMatrix &arg iMatrix ret(arg); vtype nrm; vtype inner; - for(int c1=0;c1gSites(); std::vector pseeds({1,2,3,4,5}); std::vector sseeds({6,7,8,9,10}); @@ -24,10 +32,122 @@ int main (int argc, char **argv) GridSerialRNG sRNG; sRNG.SeedFixedIntegers(sseeds); SU::HotConfiguration(pRNG,Umu); - U = PeekIndex(Umu,0); + U = PeekIndex(Umu,2); + // it is unitary + aux = U*adj(U) - identity; + std::cout <(U,c1,c2); + auto Wstar = PeekIndex(U,c1+nsp,c2+nsp); + auto Ww = conjugate( Wstar ); + auto amizero = sum(W - Ww); + auto amizeroo = TensorRemove(amizero); + std::cout << GridLogMessage << "diff(real,im) = " << amizeroo << std::endl; + assert( amizeroo.real() < 10e-6 ); + amizeroo *= i; + assert( amizeroo.real() < 10e-6 ); + std::cout << GridLogMessage << "ok " << std::endl; + } + + } + std::cout <(U,c1,c2+nsp); + auto minusXstar = PeekIndex(U,c1+nsp,c2); + auto minusXx = conjugate(minusXstar); + auto amizero = sum (X + minusXx); + auto amizeroo = TensorRemove(amizero); + std::cout << GridLogMessage << "diff(real,im) = " << amizeroo << std::endl; + assert( amizeroo.real() < 10e-6 ); + amizeroo *= i; + assert( amizeroo.real() < 10e-6 ); + std::cout << GridLogMessage << "ok " << std::endl; + } + } + + + // an explicit check for sp2 + if (Nc == 2) + { + assert(Nc==2); + ColourMatrix A; + A = Zero(); + + Complex a(25041994., 12.); + Complex b(39., 0.22); + Complex d(10000., -2222.3333); + + A()()(0,0) = a; + A()()(0,1) = b; + A()()(1,0) = i; + A()()(1,1) = d; + std::cout <