---
milena/ChangeLog | 5 +++++
milena/mln/accu/stat/median_h_interval.hh | 13 +++++++++++++
2 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index fe731b3..704143a 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,10 @@
2012-10-23 Guillaume Lazzara <z(a)lrde.epita.fr>
+ * mln/accu/stat/median_h_interval.hh: Make it inherit from
+ accumulator base.
+
+2012-10-23 Guillaume Lazzara <z(a)lrde.epita.fr>
+
Add new median accumulators.
* mln/accu/stat/median_few.hh,
diff --git a/milena/mln/accu/stat/median_h_interval.hh
b/milena/mln/accu/stat/median_h_interval.hh
index 86c72a7..ebe6b8d 100644
--- a/milena/mln/accu/stat/median_h_interval.hh
+++ b/milena/mln/accu/stat/median_h_interval.hh
@@ -32,6 +32,7 @@
/// working on a specific interval.
# include <vector>
+# include <mln/accu/internal/base.hh>
# include <mln/value/interval.hh>
# include <mln/trait/routine/mean.hh>
@@ -51,6 +52,7 @@ namespace mln
template <typename T,
typename R = mln_trait_routine_mean(2,T) >
struct median_h_interval
+ : public mln::accu::internal::base< R, median_h_interval<T,R> >
{
typedef T argument;
typedef R result;
@@ -61,6 +63,7 @@ namespace mln
void init();
void take(const argument& v);
+ void take(const median_h_interval<T,R>& v);
// nota bene: no untake with this accumulator
@@ -111,6 +114,16 @@ namespace mln
}
template <typename T, typename R>
+ void
+ median_h_interval<T,R>::take(const median_h_interval<T,R>& other)
+ {
+ mln_precondition(other.inter_ == inter_);
+ for (unsigned i = 0; i < other.h_.size(); ++i)
+ h_[i] += other.h_[i];
+ nitems_ += other.nitems_;
+ }
+
+ template <typename T, typename R>
typename median_h_interval<T,R>::result
median_h_interval<T,R>::to_result() const
{
--
1.7.2.5
Show replies by date