Commit 6c66d22b authored by Davis King's avatar Davis King

Made find_upper_quantile() more general

parent 5fe0a5f6
...@@ -222,11 +222,15 @@ namespace dlib ...@@ -222,11 +222,15 @@ namespace dlib
typename T typename T
> >
double find_upper_quantile ( double find_upper_quantile (
T container, const T& container_,
double quantile double quantile
) )
{ {
DLIB_CASSERT(0 <= quantile && quantile <= 1.0); DLIB_CASSERT(0 <= quantile && quantile <= 1.0);
// copy container into a std::vector
std::vector<double> container(container_.begin(), container_.end());
DLIB_CASSERT(container.size() > 0); DLIB_CASSERT(container.size() > 0);
size_t idx_upper = std::round((container.size()-1)*(1-quantile)); size_t idx_upper = std::round((container.size()-1)*(1-quantile));
......
...@@ -251,7 +251,7 @@ namespace dlib ...@@ -251,7 +251,7 @@ namespace dlib
typename T typename T
> >
double find_upper_quantile ( double find_upper_quantile (
T container, const T& container,
double quantile double quantile
); );
/*! /*!
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment