/************************************************************************************* Grid physics library, www.github.com/paboyle/Grid Source file: ./lib/tensors/Tensor_reality.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_REALITY_H #define GRID_MATH_REALITY_H NAMESPACE_BEGIN(Grid); /////////////////////////////////////////////// // multiply by I; make recursive. /////////////////////////////////////////////// template accelerator_inline iScalar timesI(const iScalar&r) { iScalar ret; timesI(ret._internal,r._internal); return ret; } template accelerator_inline iVector timesI(const iVector&r) { iVector ret; for(int i=0;i accelerator_inline iMatrix timesI(const iMatrix&r) { iMatrix ret; for(int i=0;i accelerator_inline void timesI(iScalar &ret,const iScalar&r) { timesI(ret._internal,r._internal); } template accelerator_inline void timesI(iVector &ret,const iVector&r) { for(int i=0;i accelerator_inline void timesI(iMatrix &ret,const iMatrix&r) { for(int i=0;i accelerator_inline iScalar timesMinusI(const iScalar&r) { iScalar ret; timesMinusI(ret._internal,r._internal); return ret; } template accelerator_inline iVector timesMinusI(const iVector&r) { iVector ret; for(int i=0;i accelerator_inline iMatrix timesMinusI(const iMatrix&r) { iMatrix ret; for(int i=0;i accelerator_inline void timesMinusI(iScalar &ret,const iScalar&r) { timesMinusI(ret._internal,r._internal); } template accelerator_inline void timesMinusI(iVector &ret,const iVector&r) { for(int i=0;i accelerator_inline void timesMinusI(iMatrix &ret,const iMatrix&r) { for(int i=0;i accelerator_inline iScalar conjugate(const iScalar&r) { iScalar ret; ret._internal = conjugate(r._internal); return ret; } template accelerator_inline iVector conjugate(const iVector&r) { iVector ret; for(int i=0;i accelerator_inline iMatrix conjugate(const iMatrix&r) { iMatrix ret; for(int i=0;i accelerator_inline iScalar adj(const iScalar&r) { iScalar ret; ret._internal = adj(r._internal); return ret; } template accelerator_inline iVector adj(const iVector&r) { iVector ret; for(int i=0;i accelerator_inline iMatrix adj(const iMatrix &arg) { iMatrix ret; for(int c1=0;c1 accelerator_inline auto real(const iScalar &z) -> iScalar { iScalar ret; ret._internal = real(z._internal); return ret; } template accelerator_inline auto real(const iMatrix &z) -> iMatrix { iMatrix ret; for(int c1=0;c1 accelerator_inline auto real(const iVector &z) -> iVector { iVector ret; for(int c1=0;c1 accelerator_inline auto imag(const iScalar &z) -> iScalar { iScalar ret; ret._internal = imag(z._internal); return ret; } template accelerator_inline auto imag(const iMatrix &z) -> iMatrix { iMatrix ret; for(int c1=0;c1 accelerator_inline auto imag(const iVector &z) -> iVector { iVector ret; for(int c1=0;c1