diff --git a/include/armadillo_bits/op_dot_meat.hpp b/include/armadillo_bits/op_dot_meat.hpp index 99b903b6..84356732 100644 --- a/include/armadillo_bits/op_dot_meat.hpp +++ b/include/armadillo_bits/op_dot_meat.hpp @@ -367,7 +367,10 @@ op_dot::apply_proxy_linear(const Proxy& PA, const Proxy& PB) { arma_debug_sigprint(); - typedef typename T1::elem_type eT; + typedef typename T1::elem_type eT; + + typedef typename promote_type::result acc_eT; + typedef typename Proxy::ea_type ea_type1; typedef typename Proxy::ea_type ea_type2; @@ -376,23 +379,23 @@ op_dot::apply_proxy_linear(const Proxy& PA, const Proxy& PB) ea_type1 A = PA.get_ea(); ea_type2 B = PB.get_ea(); - eT val1 = eT(0); - eT val2 = eT(0); + acc_eT val1 = acc_eT(0); + acc_eT val2 = acc_eT(0); uword i,j; for(i=0, j=1; j& PA, const Proxy& PB) typedef typename T1::elem_type eT; typedef typename get_pod_type::result T; + typedef typename promote_type::result acc_T; + typedef typename Proxy::ea_type ea_type1; typedef typename Proxy::ea_type ea_type2; @@ -415,8 +420,8 @@ op_dot::apply_proxy_linear(const Proxy& PA, const Proxy& PB) ea_type1 A = PA.get_ea(); ea_type2 B = PB.get_ea(); - T val_real = T(0); - T val_imag = T(0); + acc_T val_real = acc_T(0); + acc_T val_imag = acc_T(0); for(uword i=0; i& PA, const Proxy& PB) const T c = yy.real(); const T d = yy.imag(); - val_real += (a*c) - (b*d); - val_imag += (a*d) + (b*c); + val_real += acc_T( (a*c) - (b*d) ); + val_imag += acc_T( (a*d) + (b*c) ); } - return std::complex(val_real, val_imag); + return std::complex( T(val_real), T(val_imag) ); }