/************************************************************************************* Grid physics library, www.github.com/paboyle/Grid Source file: ./lib/tensors/Tensor_Ta.h Copyright (C) 2015 Author: Peter Boyle Author: neo This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. See the full license in the file "LICENSE" in the top level distribution directory *************************************************************************************/ /* END LEGAL */ #ifndef GRID_MATH_TA_H #define GRID_MATH_TA_H NAMESPACE_BEGIN(Grid); /////////////////////////////////////////////// // Ta function for scalar, vector, matrix /////////////////////////////////////////////// /* accelerator_inline ComplexF Ta( const ComplexF &arg){ return arg;} accelerator_inline ComplexD Ta( const ComplexD &arg){ return arg;} accelerator_inline RealF Ta( const RealF &arg){ return arg;} accelerator_inline RealD Ta( const RealD &arg){ return arg;} */ template accelerator_inline iScalar Ta(const iScalar&r) { iScalar ret; ret._internal = Ta(r._internal); return ret; } template accelerator_inline iVector Ta(const iVector&r) { iVector ret; for(int i=0;i accelerator_inline iMatrix Ta(const iMatrix &arg) { iMatrix ret; double factor = (1.0/(double)N); ret= (arg - adj(arg))*0.5; ret=ret - (trace(ret)*factor); return ret; } /////////////////////////////////////////////// // ProjectOnGroup function for scalar, vector, matrix // Projects on orthogonal, unitary group /////////////////////////////////////////////// template accelerator_inline iScalar ProjectOnGroup(const iScalar&r) { iScalar ret; ret._internal = ProjectOnGroup(r._internal); return ret; } template accelerator_inline iVector ProjectOnGroup(const iVector&r) { iVector ret; for(int i=0;i::TensorLevel == 0 >::type * =nullptr> accelerator_inline iMatrix ProjectOnGroup(const iMatrix &arg) { // need a check for the group type? iMatrix ret(arg); vtype nrm; vtype inner; for(int c1=0;c1