diff --git a/include/armadillo_bits/fn_accu.hpp b/include/armadillo_bits/fn_accu.hpp index 74de4c99..f8060161 100644 --- a/include/armadillo_bits/fn_accu.hpp +++ b/include/armadillo_bits/fn_accu.hpp @@ -31,7 +31,9 @@ accu(const T1& expr, const typename enable_if< is_arma_type::value >::result arma_ignore(junk); - return op_accu_mat::apply(expr); + typedef typename T1::elem_type eT; + + return (is_fp16::yes || is_cx_fp16::yes) ? op_accu_fp16mat::apply(expr) : op_accu_mat::apply(expr); } diff --git a/include/armadillo_bits/op_accu_bones.hpp b/include/armadillo_bits/op_accu_bones.hpp index 10f77dfb..4c12cefe 100644 --- a/include/armadillo_bits/op_accu_bones.hpp +++ b/include/armadillo_bits/op_accu_bones.hpp @@ -69,6 +69,15 @@ struct op_accu_mat +struct op_accu_fp16mat + : public traits_op_passthru + { + template + static inline typename T1::elem_type apply(const T1& X); + }; + + + struct op_accu_cube : public traits_op_passthru { diff --git a/include/armadillo_bits/op_accu_meat.hpp b/include/armadillo_bits/op_accu_meat.hpp index 173baece..1d1ed013 100644 --- a/include/armadillo_bits/op_accu_meat.hpp +++ b/include/armadillo_bits/op_accu_meat.hpp @@ -654,6 +654,37 @@ op_accu_mat::apply(const subview_col& X) +template +inline +typename T1::elem_type +op_accu_fp16mat::apply(const T1& X) + { + arma_debug_sigprint(); + + // TODO: this is a rudimentary place-holder implementation + + typedef typename T1::elem_type eT; + + typedef typename conditional_promote_type::value, eT, float>::result acc_eT; + + const quasi_unwrap U(X); + + const uword N = U.M.n_elem; + const eT* mem = U.M.memptr(); + + acc_eT acc = acc_eT(0); + + for(uword i=0; i inline typename T1::elem_type