From 86c1ad39d6d5bad0ec11b7cbfee64833ed176288 Mon Sep 17 00:00:00 2001 From: Joseph Mirabel <jmirabel@laas.fr> Date: Wed, 25 May 2016 20:29:50 +0200 Subject: [PATCH] Add DiscreteDistribution::values() --- include/hpp/statistics/distribution.hh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/hpp/statistics/distribution.hh b/include/hpp/statistics/distribution.hh index 4cb2480..d0ea4d7 100644 --- a/include/hpp/statistics/distribution.hh +++ b/include/hpp/statistics/distribution.hh @@ -107,6 +107,15 @@ namespace hpp { return proba; } + /// Return the values. + std::vector < Value_t > values () const { + if (values_.empty ()) return std::vector < Value_t > (0); + std::vector < Value_t > v (values_.size()); + for (size_t i = 0; i < values_.size (); i++) + v[i] = values_[i].second; + return v; + } + /// Return the total weight. Weight_t totalWeight () const { if (cumulative_weights_.empty ()) return 0; -- GitLab