Skip to content
Merged
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
2 changes: 1 addition & 1 deletion include/boost/random/detail/generator_bits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace detail {
// compatibility.
template<class URNG>
struct generator_bits {
static std::size_t value() {
static int value() {
return std::numeric_limits<typename URNG::result_type>::digits;
}
};
Expand Down
4 changes: 2 additions & 2 deletions include/boost/random/discrete_distribution.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ class discrete_distribution {
{
sum += *iter;
if(sum > val) {
return result;
return static_cast<IntType>(result);
}
}
// This shouldn't be reachable, but round-off error
Expand Down Expand Up @@ -501,7 +501,7 @@ class discrete_distribution {
{
WeightType val = iter->first;
result[i] += val;
result[static_cast<std::size_t>(iter->second)] += _impl.get_weight(i) - val;
result[static_cast<std::size_t>(iter->second)] += _impl.get_weight(static_cast<IntType>(i)) - val;
}
impl_type::normalize(result);
return(result);
Expand Down
2 changes: 1 addition & 1 deletion include/boost/random/mixmax.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ class mixmax_engine{
sum=me.MOD_MERSENNE(sum+v);
}
if (sum == savedsum && counter>0 && counter<Ndim){
me.S.V=vec; me.S.counter = counter; me.S.sumtot=savedsum;
me.S.V=vec; me.S.counter = static_cast<int>(counter); me.S.sumtot=savedsum;
}else{
in.setstate(std::ios::failbit);
}
Expand Down
8 changes: 4 additions & 4 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ if(HAVE_BOOST_TEST)
foreach(part IN ITEMS ${parts})
if(part MATCHES "^[./a-zA-Z0-9_]+\.cpp+$")
list(APPEND sources ${part})
elseif(part STREQUAL "/boost/assign//boost_assign")
list(APPEND extra_libs Boost::assign)
elseif(part STREQUAL "/boost/iterator//boost_iterator")
list(APPEND extra_libs Boost::iterator)
elseif(part STREQUAL "/boost/range//boost_range")
list(APPEND extra_libs Boost::range)
elseif(part STREQUAL "/boost/test//boost_unit_test_framework")
list(APPEND extra_libs Boost::unit_test_framework)
elseif(part STREQUAL "math_test")
list(APPEND extra_libs Boost::assign Boost::bind Boost::exception Boost::lexical_cast Boost::math Boost::numeric_conversion)
list(APPEND extra_libs Boost::exception Boost::lexical_cast Boost::math Boost::numeric_conversion Boost::range)
else()
boost_message(SEND_ERROR "Unknown dependency '${part}'")
endif()
Expand All @@ -55,4 +55,4 @@ boost_test(TYPE compile SOURCES multiprecision_float_test.cpp
LINK_LIBRARIES Boost::random Boost::unit_test_framework Boost::multiprecision
COMPILE_FEATURES cxx_std_14)
boost_test(TYPE compile SOURCES statistic_tests.cpp
LINK_LIBRARIES Boost::random Boost::bind Boost::math)
LINK_LIBRARIES Boost::random Boost::math)
11 changes: 5 additions & 6 deletions test/Jamfile.v2
Original file line number Diff line number Diff line change
Expand Up @@ -103,22 +103,21 @@ explicit test_lagged_fibonacci1279 test_lagged_fibonacci2281
test_lagged_fibonacci44497 ;

alias math_test :
/boost/assign//boost_assign
/boost/bind//boost_bind
/boost/exception//boost_exception
/boost/lexical_cast//boost_lexical_cast
/boost/math//boost_math_tr1
/boost/numeric_conversion//boost_numeric_conversion
/boost/range//boost_range
;

run test_seed_seq.cpp /boost/assign//boost_assign /boost/test//boost_unit_test_framework ;
run test_seed_seq.cpp /boost/test//boost_unit_test_framework ;

run test_binomial.cpp math_test ;
run test_binomial_distribution.cpp /boost/test//boost_unit_test_framework ;
run test_poisson.cpp math_test ;
run test_poisson_distribution.cpp /boost/test//boost_unit_test_framework ;
run test_discrete.cpp math_test ;
run test_discrete_distribution.cpp /boost/assign//boost_assign /boost/test//boost_unit_test_framework ;
run test_discrete_distribution.cpp /boost/test//boost_unit_test_framework ;
run test_gamma.cpp math_test ;
run test_gamma_distribution.cpp /boost/test//boost_unit_test_framework ;
run test_weibull.cpp math_test ;
Expand All @@ -136,9 +135,9 @@ run test_student_t_distribution.cpp /boost/test//boost_unit_test_framework ;
run test_normal.cpp math_test ;
run test_normal_distribution.cpp /boost/test//boost_unit_test_framework ;
run test_piecewise_constant.cpp math_test ;
run test_piecewise_constant_distribution.cpp /boost/assign//boost_assign /boost/test//boost_unit_test_framework ;
run test_piecewise_constant_distribution.cpp /boost/test//boost_unit_test_framework ;
run test_piecewise_linear.cpp math_test ;
run test_piecewise_linear_distribution.cpp /boost/assign//boost_assign /boost/test//boost_unit_test_framework ;
run test_piecewise_linear_distribution.cpp /boost/test//boost_unit_test_framework ;
run test_exponential.cpp math_test ;
run test_exponential_distribution.cpp /boost/test//boost_unit_test_framework ;
run test_bernoulli.cpp math_test ;
Expand Down
6 changes: 6 additions & 0 deletions test/concepts.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include <cstdint>
#include <istream>
#include <ostream>
#include <vector>

#ifdef BOOST_MSVC
#pragma warning(push)
Expand Down Expand Up @@ -211,4 +212,9 @@ struct RandomNumberDistribution :
#pragma warning(pop)
#endif

template<typename T, typename... U>
std::vector<T> make_vector(const T t1, U... u){
return std::vector<T>{ t1, static_cast<T>(u)... };
}

#endif
7 changes: 4 additions & 3 deletions test/integrate.hpp
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
/* integrate.hpp header file
*
* Copyright Jens Maurer 2000
* Copyright Alexander Grund 2026
* Distributed under the Boost Software License, Version 1.0. (See
* accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
*
* $Id$
*
* Revision history
* 01 April 2001: Modified to use new <boost/limits.hpp> header. (JMaddock)
*/

#ifndef INTEGRATE_HPP
#define INTEGRATE_HPP

#include <boost/utility/result_of.hpp>

#include <limits>

template<class UnaryFunction>
Expand Down Expand Up @@ -45,7 +46,7 @@ simpson(UnaryFunction f, typename UnaryFunction::argument_type a,
// compute b so that f(b) = y; assume f is monotone increasing
template<class UnaryFunction, class T>
inline T
invert_monotone_inc(UnaryFunction f, typename UnaryFunction::result_type y,
invert_monotone_inc(UnaryFunction f, typename boost::result_of<UnaryFunction(T)>::type y,
T lower = -1,
T upper = 1)
{
Expand Down
8 changes: 4 additions & 4 deletions test/multiprecision_int_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,10 @@ BOOST_AUTO_TEST_CASE_TEMPLATE(distributions, distribution_type, uniform_distribu
distribution_type d(a, b);
boost::random::mt19937 gen;

BOOST_CHECK_EQUAL(d.a(), a);
BOOST_CHECK_EQUAL(d.b(), b);
BOOST_CHECK_EQUAL((d.min)(), a);
BOOST_CHECK_EQUAL((d.max)(), b);
BOOST_TEST(d.a() == a);
BOOST_TEST(d.b() == b);
BOOST_TEST((d.min)() == a);
BOOST_TEST((d.max)() == b);

for(unsigned i = 0; i < 200; ++i)
{
Expand Down
22 changes: 11 additions & 11 deletions test/statistic_tests.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
#ifndef STATISTIC_TESTS_HPP
#define STATISTIC_TESTS_HPP

#include <stdexcept>
#include <iterator>
#include <vector>
#include <limits>
#include <algorithm>
#include <cmath>
#include <functional>
#include <iterator>
#include <limits>
#include <stdexcept>
#include <vector>

#include <boost/config.hpp>
#include <boost/bind/bind.hpp>
#include <boost/random/uniform_01.hpp>
#include <boost/random/variate_generator.hpp>

Expand Down Expand Up @@ -491,8 +491,8 @@ inline double cdf(const kolmogorov_smirnov_probability& dist, double val)

inline double quantile(const kolmogorov_smirnov_probability& dist, double val)
{
using namespace boost::placeholders;
return invert_monotone_inc(boost::bind(&cdf, dist, _1), val, 0.0, 1000.0);
using namespace std::placeholders;
return invert_monotone_inc(std::bind(&cdf, dist, _1), val, 0.0, 1000.0);
}

/*
Expand Down Expand Up @@ -645,8 +645,8 @@ double run_experiment(const Experiment & experiment, Generator & gen, int n)
generic_counter<std::vector<int> > v(experiment.classes());
experiment.run(gen, v, n);
return chi_square_value(v.begin(), v.end(),
boost::bind(&Experiment::probability,
experiment, boost::placeholders::_1));
std::bind(&Experiment::probability,
experiment, std::placeholders::_1));
}

// chi_square test
Expand All @@ -656,8 +656,8 @@ double run_experiment(const Experiment & experiment, const Generator & gen, int
generic_counter<std::vector<int> > v(experiment.classes());
experiment.run(gen, v, n);
return chi_square_value(v.begin(), v.end(),
boost::bind(&Experiment::probability,
experiment, boost::placeholders::_1));
std::bind(&Experiment::probability,
experiment, std::placeholders::_1));
}

// number generator with experiment results (for nesting)
Expand Down
Loading
Loading