/************************************************************************************* 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 Grid { /////////////////////////////////////////////// // multiply by I; make recursive. /////////////////////////////////////////////// template inline iScalar timesI(const iScalar&r) { iScalar ret; timesI(ret._internal,r._internal); return ret; } template inline iVector timesI(const iVector&r) { iVector ret; for(int i=0;i inline iMatrix timesI(const iMatrix&r) { iMatrix ret; for(int i=0;i inline void timesI(iScalar &ret,const iScalar&r) { timesI(ret._internal,r._internal); } template inline void timesI(iVector &ret,const iVector&r) { for(int i=0;i inline void timesI(iMatrix &ret,const iMatrix&r) { for(int i=0;i inline iScalar timesMinusI(const iScalar&r) { iScalar ret; timesMinusI(ret._internal,r._internal); return ret; } template inline iVector timesMinusI(const iVector&r) { iVector ret; for(int i=0;i inline iMatrix timesMinusI(const iMatrix&r) { iMatrix ret; for(int i=0;i inline void timesMinusI(iScalar &ret,const iScalar&r) { timesMinusI(ret._internal,r._internal); } template inline void timesMinusI(iVector &ret,const iVector&r) { for(int i=0;i inline void timesMinusI(iMatrix &ret,const iMatrix&r) { for(int i=0;i inline iScalar conjugate(const iScalar&r) { iScalar ret; ret._internal = conjugate(r._internal); return ret; } template inline iVector conjugate(const iVector&r) { iVector ret; for(int i=0;i inline iMatrix conjugate(const iMatrix&r) { iMatrix ret; for(int i=0;i inline iScalar adj(const iScalar&r) { iScalar ret; ret._internal = adj(r._internal); return ret; } template inline iVector adj(const iVector&r) { iVector ret; for(int i=0;i inline iMatrix adj(const iMatrix &arg) { iMatrix ret; for(int c1=0;c1 inline auto real(const iScalar &z) -> iScalar { iScalar ret; ret._internal = real(z._internal); return ret; } template inline auto real(const iMatrix &z) -> iMatrix { iMatrix ret; for(int c1=0;c1 inline auto real(const iVector &z) -> iVector { iVector ret; for(int c1=0;c1 inline auto imag(const iScalar &z) -> iScalar { iScalar ret; ret._internal = imag(z._internal); return ret; } template inline auto imag(const iMatrix &z) -> iMatrix { iMatrix ret; for(int c1=0;c1 inline auto imag(const iVector &z) -> iVector { iVector ret; for(int c1=0;c1