expand Base with sum()

This commit is contained in:
conrad
2020-11-13 16:55:04 +10:00
parent a8a4fa1f6b
commit e3cd540e36
2 changed files with 13 additions and 0 deletions
+2
View File
@@ -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;
+11
View File
@@ -81,6 +81,17 @@ Base<elem_type,derived>::raw_print(std::ostream& user_stream, const std::string
template<typename elem_type, typename derived>
inline
arma_warn_unused
elem_type
Base<elem_type,derived>::sum() const
{
return accu( (*this).get_ref() );
}
template<typename elem_type, typename derived>
inline
arma_warn_unused