Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions include/boost/accumulators/statistics/extended_p_square.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@

#include <vector>
#include <functional>
#include <sstream>
#include <boost/foreach.hpp>
#include <boost/throw_exception.hpp>
#include <boost/range/begin.hpp>
#include <boost/range/end.hpp>
#include <boost/range/iterator_range.hpp>
Expand Down Expand Up @@ -92,6 +95,16 @@ namespace impl
, desired_positions(heights.size())
, positions_increments(heights.size())
{
BOOST_FOREACH(float_type p, this->probabilities)
{
if (p < 0 || p > 1)
{
std::ostringstream msg;
msg << "extended_p_square_probabilities = " << p << " is not valid range [0, 1]";
boost::throw_exception(std::logic_error(msg.str()));
}
}

std::size_t num_quantiles = this->probabilities.size();
std::size_t num_markers = this->heights.size();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

#include <vector>
#include <functional>
#include <sstream>
#include <boost/foreach.hpp>
#include <boost/throw_exception.hpp>
#include <boost/range/begin.hpp>
#include <boost/range/end.hpp>
Expand Down Expand Up @@ -77,6 +79,15 @@ namespace impl
, boost::end(args[extended_p_square_probabilities])
)
{
BOOST_FOREACH(float_type p, this->probabilities)
{
if (p < 0 || p > 1)
{
std::ostringstream msg;
msg << "extended_p_square_probabilities = " << p << " is not valid range [0, 1]";
boost::throw_exception(std::logic_error(msg.str()));
}
}
}

template<typename Args>
Expand Down
9 changes: 9 additions & 0 deletions include/boost/accumulators/statistics/p_square_quantile.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

#include <cmath>
#include <functional>
#include <sstream>
#include <boost/throw_exception.hpp>
#include <boost/array.hpp>
#include <boost/mpl/placeholders.hpp>
#include <boost/type_traits/is_same.hpp>
Expand Down Expand Up @@ -67,6 +69,13 @@ namespace impl
, desired_positions()
, positions_increments()
{
if (this->p < 0 || this->p > 1)
{
std::ostringstream msg;
msg << "quantile_probability = " << this->p << " is not in valid range [0, 1]";
boost::throw_exception(std::logic_error(msg.str()));
}

for(std::size_t i = 0; i < 5; ++i)
{
this->actual_positions[i] = i + 1.;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,12 @@ namespace impl
, fit_parameters_(boost::make_tuple(0., 0., 0.))
, is_dirty_(true)
{
if (this->threshold_probability_ < 0 || this->threshold_probability_ > 1)
{
std::ostringstream msg;
msg << "pot_threshold_probability = " << this->threshold_probability_ << " is not in valid range [0, 1]";
boost::throw_exception(std::logic_error(msg.str()));
}
}

void operator ()(dont_care)
Expand Down
9 changes: 9 additions & 0 deletions include/boost/accumulators/statistics/pot_quantile.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
#include <limits>
#include <numeric>
#include <functional>
#include <sstream>
#include <boost/throw_exception.hpp>
#include <boost/parameter/keyword.hpp>
#include <boost/tuple/tuple.hpp>
#include <boost/mpl/if.hpp>
Expand Down Expand Up @@ -61,6 +63,13 @@ namespace impl
template<typename Args>
result_type result(Args const &args) const
{
if (args[quantile_probability] < 0 || args[quantile_probability] > 1)
{
std::ostringstream msg;
msg << "quantile_probability = " << args[quantile_probability] << " is not in valid range [0, 1]";
boost::throw_exception(std::logic_error(msg.str()));
}

typedef
typename mpl::if_<
is_same<Impl, weighted>
Expand Down
9 changes: 9 additions & 0 deletions include/boost/accumulators/statistics/pot_tail_mean.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
#include <limits>
#include <numeric>
#include <functional>
#include <sstream>
#include <boost/throw_exception.hpp>
#include <boost/range.hpp>
#include <boost/parameter/keyword.hpp>
#include <boost/tuple/tuple.hpp>
Expand Down Expand Up @@ -64,6 +66,13 @@ namespace impl
template<typename Args>
result_type result(Args const &args) const
{
if (args[quantile_probability] < 0 || args[quantile_probability] > 1)
{
std::ostringstream msg;
msg << "quantile_probability = " << args[quantile_probability] << " is not in valid range [0, 1]";
boost::throw_exception(std::logic_error(msg.str()));
}

typedef
typename mpl::if_<
is_same<Impl, weighted>
Expand Down
7 changes: 7 additions & 0 deletions include/boost/accumulators/statistics/tail_mean.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,13 @@ namespace impl
template<typename Args>
result_type result(Args const &args) const
{
if (args[quantile_probability] < 0 || args[quantile_probability] > 1)
{
std::ostringstream msg;
msg << "quantile_probability = " << args[quantile_probability] << " is not in valid range [0, 1]";
boost::throw_exception(std::logic_error(msg.str()));
}

std::size_t cnt = count(args);

std::size_t n = static_cast<std::size_t>(
Expand Down
7 changes: 7 additions & 0 deletions include/boost/accumulators/statistics/tail_quantile.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,13 @@ namespace impl
template<typename Args>
result_type result(Args const &args) const
{
if (args[quantile_probability] < 0 || args[quantile_probability] > 1)
{
std::ostringstream msg;
msg << "quantile_probability = " << args[quantile_probability] << " is not in valid range [0, 1]";
boost::throw_exception(std::logic_error(msg.str()));
}

std::size_t cnt = count(args);

std::size_t n = static_cast<std::size_t>(
Expand Down
7 changes: 7 additions & 0 deletions include/boost/accumulators/statistics/tail_variate_means.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,13 @@ namespace impl
template<typename Args>
result_type result(Args const &args) const
{
if (args[quantile_probability] < 0 || args[quantile_probability] > 1)
{
std::ostringstream msg;
msg << "quantile_probability = " << args[quantile_probability] << " is not in valid range [0, 1]";
boost::throw_exception(std::logic_error(msg.str()));
}

std::size_t cnt = count(args);

std::size_t n = static_cast<std::size_t>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

#include <vector>
#include <functional>
#include <sstream>
#include <boost/throw_exception.hpp>
#include <boost/range/begin.hpp>
#include <boost/range/end.hpp>
#include <boost/range/iterator_range.hpp>
Expand Down Expand Up @@ -89,6 +91,15 @@ namespace impl
, actual_positions(heights.size())
, desired_positions(heights.size())
{
BOOST_FOREACH(float_type p, this->probabilities)
{
if (p < 0 || p > 1)
{
std::ostringstream msg;
msg << "extended_p_square_probabilities = " << p << " is not valid range [0, 1]";
boost::throw_exception(std::logic_error(msg.str()));
}
}
}

template<typename Args>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
#include <cmath>
#include <functional>
#include <boost/array.hpp>
#include <sstream>
#include <boost/throw_exception.hpp>
#include <boost/parameter/keyword.hpp>
#include <boost/mpl/placeholders.hpp>
#include <boost/type_traits/is_same.hpp>
Expand Down Expand Up @@ -67,6 +69,12 @@ namespace impl {
, actual_positions()
, desired_positions()
{
if (this->p < 0 || this->p > 1)
{
std::ostringstream msg;
msg << "quantile_probability = " << this->p << " is not in valid range [0, 1]";
boost::throw_exception(std::logic_error(msg.str()));
}
}

template<typename Args>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,12 @@ namespace impl
, fit_parameters_(boost::make_tuple(0., 0., 0.))
, is_dirty_(true)
{
if (this->threshold_probability_ < 0 || this->threshold_probability_ > 1)
{
std::ostringstream msg;
msg << "pot_threshold_probability = " << this->threshold_probability_ << " is not in valid range [0, 1]";
boost::throw_exception(std::logic_error(msg.str()));
}
}

void operator ()(dont_care)
Expand Down
7 changes: 7 additions & 0 deletions include/boost/accumulators/statistics/weighted_tail_mean.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,13 @@ namespace impl
template<typename Args>
result_type result(Args const &args) const
{
if (args[quantile_probability] < 0 || args[quantile_probability] > 1)
{
std::ostringstream msg;
msg << "quantile_probability = " << args[quantile_probability] << " is not in valid range [0, 1]";
boost::throw_exception(std::logic_error(msg.str()));
}

float_type threshold = sum_of_weights(args)
* ( ( is_same<LeftRight, left>::value ) ? args[quantile_probability] : 1. - args[quantile_probability] );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,13 @@ namespace impl
template<typename Args>
result_type result(Args const &args) const
{
if (args[quantile_probability] < 0 || args[quantile_probability] > 1)
{
std::ostringstream msg;
msg << "quantile_probability = " << args[quantile_probability] << " is not in valid range [0, 1]";
boost::throw_exception(std::logic_error(msg.str()));
}

float_type threshold = sum_of_weights(args)
* ( ( is_same<LeftRight, left>::value ) ? args[quantile_probability] : 1. - args[quantile_probability] );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,13 @@ namespace impl
template<typename Args>
result_type result(Args const &args) const
{
if (args[quantile_probability] < 0 || args[quantile_probability] > 1)
{
std::ostringstream msg;
msg << "quantile_probability = " << args[quantile_probability] << " is not in valid range [0, 1]";
boost::throw_exception(std::logic_error(msg.str()));
}

float_type threshold = sum_of_weights(args)
* ( ( is_same<LeftRight, left>::value ) ? args[quantile_probability] : 1. - args[quantile_probability] );

Expand Down