diff --git a/Grid/tensors/Tensor_inner.h b/Grid/tensors/Tensor_inner.h index c052adcf..fd651cae 100644 --- a/Grid/tensors/Tensor_inner.h +++ b/Grid/tensors/Tensor_inner.h @@ -200,6 +200,7 @@ auto innerProductD (const iScalar& lhs,const iScalar& rhs) -> iScalar struct isGridTensor> : public std::true_type { static constexpr bool notvalue = false; }; template struct isGridTensor> : public std::true_type { static constexpr bool notvalue = false; }; - // To store double-precision data in single-precision grids for precision promoted localInnerProductD + // Traits to identify scalars + template struct isGridScalar : public std::false_type { static constexpr bool notvalue = true; }; + template struct isGridScalar> : public std::true_type { static constexpr bool notvalue = false; }; + + // Store double-precision data in single-precision grids for precision promoted localInnerProductD + typedef iVector ComplexD2; typedef iVector vComplexD2; + typedef iVector RealD2; typedef iVector vRealD2; + // Traits to identify fundamental data types + template struct isGridFundamental : public std::false_type { static constexpr bool notvalue = true; }; + template<> struct isGridFundamental : public std::true_type { static constexpr bool notvalue = false; }; + template<> struct isGridFundamental : public std::true_type { static constexpr bool notvalue = false; }; + template<> struct isGridFundamental : public std::true_type { static constexpr bool notvalue = false; }; + template<> struct isGridFundamental : public std::true_type { static constexpr bool notvalue = false; }; + template<> struct isGridFundamental : public std::true_type { static constexpr bool notvalue = false; }; + template<> struct isGridFundamental : public std::true_type { static constexpr bool notvalue = false; }; + template<> struct isGridFundamental : public std::true_type { static constexpr bool notvalue = false; }; + template<> struct isGridFundamental : public std::true_type { static constexpr bool notvalue = false; }; + + ////////////////////////////////////////////////////////////////////////////////// // Want to recurse: GridTypeMapper >::scalar_type == ComplexD. // Use of a helper class like this allows us to template specialise and "dress" @@ -86,7 +104,7 @@ NAMESPACE_BEGIN(Grid); typedef ComplexF Complexified; typedef RealF Realified; typedef RealD DoublePrecision; - typedef RealD DoublePrecision2; + typedef RealD2 DoublePrecision2; }; template<> struct GridTypeMapper : public GridTypeMapper_Base { typedef RealD scalar_type; @@ -112,7 +130,7 @@ NAMESPACE_BEGIN(Grid); typedef ComplexF Complexified; typedef RealF Realified; typedef ComplexD DoublePrecision; - typedef ComplexD DoublePrecision2; + typedef ComplexD2 DoublePrecision2; }; template<> struct GridTypeMapper : public GridTypeMapper_Base { typedef ComplexD scalar_type; diff --git a/tests/Test_innerproduct_norm.cc b/tests/Test_innerproduct_norm.cc index 85c98521..a8718c6b 100644 --- a/tests/Test_innerproduct_norm.cc +++ b/tests/Test_innerproduct_norm.cc @@ -72,7 +72,7 @@ int main(int argc, char** argv) { sw_res.Reset(); sw_res.Start(); - for(int i = 0; i < nIter; ++i) { innerProduct_norm(ip_d_res, norm2_d_res, x_d, y_d); } + for(int i = 0; i < nIter; ++i) { innerProductNorm(ip_d_res, norm2_d_res, x_d, y_d); } sw_res.Stop(); diff_ip_d = ip_d_ref - ip_d_res; @@ -104,7 +104,7 @@ int main(int argc, char** argv) { sw_res.Reset(); sw_res.Start(); - for(int i = 0; i < nIter; ++i) { innerProduct_norm(ip_f_res, norm2_f_res, x_f, y_f); } + for(int i = 0; i < nIter; ++i) { innerProductNorm(ip_f_res, norm2_f_res, x_f, y_f); } sw_res.Stop(); diff_ip_f = ip_f_ref - ip_f_res;