From 3b21036e36fae4535c344aab2bbecfd5b20b4393 Mon Sep 17 00:00:00 2001
From: Joseph Mirabel <jmirabel@laas.fr>
Date: Wed, 3 Dec 2014 10:40:44 +0100
Subject: [PATCH] Add method DiscreteDistribution::totalWeight

---
 include/hpp/statistics/distribution.hh | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/include/hpp/statistics/distribution.hh b/include/hpp/statistics/distribution.hh
index 5e1029c..92bd3b2 100644
--- a/include/hpp/statistics/distribution.hh
+++ b/include/hpp/statistics/distribution.hh
@@ -107,6 +107,12 @@ namespace hpp {
             return proba;
           }
 
+          /// Return the total weight.
+          Weight_t totalWeight () const {
+            if (cumulative_weights_.empty ()) return 0;
+            return cumulative_weights_.back ();
+          }
+
           /// \name Iterators
           /// Iterate on the values.
           /// \{
-- 
GitLab