diff --git a/include/armadillo_bits/Base_bones.hpp b/include/armadillo_bits/Base_bones.hpp index 8ef250fa..eb64cfa6 100644 --- a/include/armadillo_bits/Base_bones.hpp +++ b/include/armadillo_bits/Base_bones.hpp @@ -119,6 +119,8 @@ struct Base arma_cold inline void raw_print( const std::string extra_text = "") const; arma_cold inline void raw_print(std::ostream& user_stream, const std::string extra_text = "") const; + inline arma_warn_unused elem_type sum() const; + inline arma_warn_unused elem_type min() const; inline arma_warn_unused elem_type max() const; diff --git a/include/armadillo_bits/Base_meat.hpp b/include/armadillo_bits/Base_meat.hpp index 0e319159..885ede9b 100644 --- a/include/armadillo_bits/Base_meat.hpp +++ b/include/armadillo_bits/Base_meat.hpp @@ -81,6 +81,17 @@ Base::raw_print(std::ostream& user_stream, const std::string +template +inline +arma_warn_unused +elem_type +Base::sum() const + { + return accu( (*this).get_ref() ); + } + + + template inline arma_warn_unused