diff --git a/Grid/simd/Grid_vector_types.h b/Grid/simd/Grid_vector_types.h index 4f952bb2..fd71a84a 100644 --- a/Grid/simd/Grid_vector_types.h +++ b/Grid/simd/Grid_vector_types.h @@ -1055,7 +1055,7 @@ accelerator_inline typename toComplexMapper::Complexified toComplex(const } -accelerator_inline void precisionChange(vRealF *out,vRealD *in,int nvec) +accelerator_inline void precisionChange(vRealF *out,const vRealD *in,int nvec) { assert((nvec&0x1)==0); for(int m=0;m*2 @@ -112,6 +111,9 @@ template struct ImagFunctor { accelerator scalar operator()(const scalar &a) const { return imag(a); } }; +///////////// +// Unary operations +///////////// template accelerator_inline Grid_simd real(const Grid_simd &r) { return SimdApply(RealFunctor(), r); @@ -168,6 +170,65 @@ template accelerator_inline Grid_simd div(const Grid_simd &r, Integer y) { return SimdApply(DivIntFunctor(y), r); } +/// Double 2 cases +template +accelerator_inline Grid_simd2 real(const Grid_simd2 &r) { + return SimdApply(RealFunctor(), r); +} +template +accelerator_inline Grid_simd2 imag(const Grid_simd2 &r) { + return SimdApply(ImagFunctor(), r); +} +template +accelerator_inline Grid_simd2 sqrt(const Grid_simd2 &r) { + return SimdApply(SqrtRealFunctor(), r); +} +template +accelerator_inline Grid_simd2 cos(const Grid_simd2 &r) { + return SimdApply(CosRealFunctor(), r); +} +template +accelerator_inline Grid_simd2 sin(const Grid_simd2 &r) { + return SimdApply(SinRealFunctor(), r); +} +template +accelerator_inline Grid_simd2 acos(const Grid_simd2 &r) { + return SimdApply(AcosRealFunctor(), r); +} +template +accelerator_inline Grid_simd2 asin(const Grid_simd2 &r) { + return SimdApply(AsinRealFunctor(), r); +} +template +accelerator_inline Grid_simd2 log(const Grid_simd2 &r) { + return SimdApply(LogRealFunctor(), r); +} +template +accelerator_inline Grid_simd2 abs(const Grid_simd2 &r) { + return SimdApply(AbsRealFunctor(), r); +} +template +accelerator_inline Grid_simd2 exp(const Grid_simd2 &r) { + return SimdApply(ExpFunctor(), r); +} +template +accelerator_inline Grid_simd2 Not(const Grid_simd2 &r) { + return SimdApply(NotFunctor(), r); +} +template +accelerator_inline Grid_simd2 pow(const Grid_simd2 &r, double y) { + return SimdApply(PowRealFunctor(y), r); +} +template +accelerator_inline Grid_simd2 mod(const Grid_simd2 &r, Integer y) { + return SimdApply(ModIntFunctor(y), r); +} +template +accelerator_inline Grid_simd2 div(const Grid_simd2 &r, Integer y) { + return SimdApply(DivIntFunctor(y), r); +} + + //////////////////////////////////////////////////////////////////////////// // Allows us to assign into **conformable** real vectors from complex //////////////////////////////////////////////////////////////////////////// @@ -193,23 +254,22 @@ struct OrOrFunctor { //////////////////////////////// template accelerator_inline Grid_simd operator&(const Grid_simd &x, - const Grid_simd &y) { + const Grid_simd &y) { return SimdApplyBinop(AndFunctor(), x, y); } template accelerator_inline Grid_simd operator&&(const Grid_simd &x, - const Grid_simd &y) { + const Grid_simd &y) { return SimdApplyBinop(AndAndFunctor(), x, y); } template accelerator_inline Grid_simd operator|(const Grid_simd &x, - const Grid_simd &y) { + const Grid_simd &y) { return SimdApplyBinop(OrFunctor(), x, y); } template accelerator_inline Grid_simd operator||(const Grid_simd &x, - const Grid_simd &y) { + const Grid_simd &y) { return SimdApplyBinop(OrOrFunctor(), x, y); } NAMESPACE_END(Grid); -#endif diff --git a/Grid/simd/Simd.h b/Grid/simd/Simd.h index 76ca3bef..ddee6a36 100644 --- a/Grid/simd/Simd.h +++ b/Grid/simd/Simd.h @@ -224,18 +224,14 @@ accelerator_inline void Gpermute(VectorSIMD &y,const VectorSIMD &b,int perm); NAMESPACE_END(Grid); #include +#include #include NAMESPACE_BEGIN(Grid); -// Default precision -#ifdef GRID_DEFAULT_PRECISION_DOUBLE + +// Default precision is wired to double typedef vRealD vReal; typedef vComplexD vComplex; -#else -typedef vRealF vReal; -typedef vComplexF vComplex; -#endif - inline std::ostream& operator<< (std::ostream& stream, const vComplexF &o){ int nn=vComplexF::Nsimd();