[DEV] add v1.76.0

This commit is contained in:
2021-10-05 21:37:46 +02:00
parent a97e9ae7d4
commit d0115b733d
45133 changed files with 4744437 additions and 1026325 deletions

View File

@@ -4,12 +4,13 @@
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#ifdef _MSC_VER
#pragma warning(disable:4244)
#pragma warning(disable : 4244)
#endif
#include <cstdlib>
#include <boost/polygon/detail/voronoi_predicates.hpp>
#include <boost/polygon/detail/voronoi_structures.hpp>
#include <boost/polygon/detail/skeleton_predicates.hpp>
#include <boost/polygon/detail/voronoi_ctypes.hpp>
#include <boost/random/mersenne_twister.hpp>
#include <boost/random/uniform_int_distribution.hpp>
#include <vector>
@@ -26,7 +27,7 @@
#include "arithmetic_backend.hpp"
typedef boost::polygon::detail::point_2d<boost::int32_t> i_point;
typedef boost::polygon::detail::point_2d<std::int32_t> i_point;
template <class Clock>
struct stopwatch
@@ -45,117 +46,117 @@ struct stopwatch
m_start = Clock::now();
}
private:
private:
typename Clock::time_point m_start;
};
std::vector<i_point> points;
std::vector<i_point> points;
boost::random::mt19937 gen;
template <class Big>
struct cpp_int_voronoi_traits
{
typedef boost::int32_t int_type;
typedef boost::int64_t int_x2_type;
typedef boost::uint64_t uint_x2_type;
typedef Big big_int_type;
typedef double fpt_type;
typedef boost::polygon::detail::extended_exponent_fpt<fpt_type> efpt_type;
typedef boost::polygon::detail::ulp_comparison<fpt_type> ulp_cmp_type;
struct to_fpt_converter_type
{
template <class B, boost::multiprecision::expression_template_option ET>
double operator ()(const boost::multiprecision::number<B, ET>& val)
{
return val.template convert_to<double>();
}
double operator ()(double val)
{
return val;
}
double operator()(const efpt_type& that) const
{
return that.d();
}
template <class tag, class Arg1, class Arg2, class Arg3, class Arg4>
double operator()(const boost::multiprecision::detail::expression<tag, Arg1, Arg2, Arg3, Arg4>& e)
{
typedef typename boost::multiprecision::detail::expression<tag, Arg1, Arg2, Arg3, Arg4>::result_type r_t;
r_t r(e);
return r.template convert_to<double>();
}
};
struct to_efpt_converter_type
{
template <class B, boost::multiprecision::expression_template_option ET>
efpt_type operator ()(const boost::multiprecision::number<B, ET>& val)
{
return efpt_type(val.template convert_to<double>(), 0);
}
efpt_type operator ()(double val)
{
return efpt_type(val, 0);
}
template <class tag, class Arg1, class Arg2, class Arg3, class Arg4>
double operator()(const boost::multiprecision::detail::expression<tag, Arg1, Arg2, Arg3, Arg4>& e)
{
typedef typename boost::multiprecision::detail::expression<tag, Arg1, Arg2, Arg3, Arg4>::result_type r_t;
r_t r(e);
return efpt_type(r.template convert_to<double>(), 0);
}
};
typedef std::int32_t int_type;
typedef std::int64_t int_x2_type;
typedef std::uint64_t uint_x2_type;
typedef Big big_int_type;
typedef double fpt_type;
typedef boost::polygon::detail::extended_exponent_fpt<fpt_type> efpt_type;
typedef boost::polygon::detail::ulp_comparison<fpt_type> ulp_cmp_type;
struct to_fpt_converter_type
{
template <class B, boost::multiprecision::expression_template_option ET>
double operator()(const boost::multiprecision::number<B, ET>& val)
{
return val.template convert_to<double>();
}
double operator()(double val)
{
return val;
}
double operator()(const efpt_type& that) const
{
return that.d();
}
template <class tag, class Arg1, class Arg2, class Arg3, class Arg4>
double operator()(const boost::multiprecision::detail::expression<tag, Arg1, Arg2, Arg3, Arg4>& e)
{
typedef typename boost::multiprecision::detail::expression<tag, Arg1, Arg2, Arg3, Arg4>::result_type r_t;
r_t r(e);
return r.template convert_to<double>();
}
};
struct to_efpt_converter_type
{
template <class B, boost::multiprecision::expression_template_option ET>
efpt_type operator()(const boost::multiprecision::number<B, ET>& val)
{
return efpt_type(val.template convert_to<double>(), 0);
}
efpt_type operator()(double val)
{
return efpt_type(val, 0);
}
template <class tag, class Arg1, class Arg2, class Arg3, class Arg4>
efpt_type operator()(const boost::multiprecision::detail::expression<tag, Arg1, Arg2, Arg3, Arg4>& e)
{
typedef typename boost::multiprecision::detail::expression<tag, Arg1, Arg2, Arg3, Arg4>::result_type r_t;
r_t r(e);
return efpt_type(r.template convert_to<double>(), 0);
}
};
};
template <class Big>
struct native_int_voronoi_traits
{
typedef boost::int32_t int_type;
typedef boost::int64_t int_x2_type;
typedef boost::uint64_t uint_x2_type;
typedef Big big_int_type;
typedef double fpt_type;
typedef boost::polygon::detail::extended_exponent_fpt<fpt_type> efpt_type;
typedef boost::polygon::detail::ulp_comparison<fpt_type> ulp_cmp_type;
struct to_fpt_converter_type
{
template <class T>
double operator ()(const T& val)const
{
return val;
}
double operator()(const efpt_type& that) const
{
return that.d();
}
};
struct to_efpt_converter_type
{
template <class T>
efpt_type operator ()(const T& val)const
{
return efpt_type(val, 0);
}
};
typedef std::int32_t int_type;
typedef std::int64_t int_x2_type;
typedef std::uint64_t uint_x2_type;
typedef Big big_int_type;
typedef double fpt_type;
typedef boost::polygon::detail::extended_exponent_fpt<fpt_type> efpt_type;
typedef boost::polygon::detail::ulp_comparison<fpt_type> ulp_cmp_type;
struct to_fpt_converter_type
{
template <class T>
double operator()(const T& val) const
{
return val;
}
double operator()(const efpt_type& that) const
{
return that.d();
}
};
struct to_efpt_converter_type
{
template <class T>
efpt_type operator()(const T& val) const
{
return efpt_type(val, 0);
}
};
};
std::map<std::string, double> results;
double min_time = (std::numeric_limits<double>::max)();
double min_time = (std::numeric_limits<double>::max)();
template <class Traits>
double test(const char* name)
{
typedef boost::polygon::detail::voronoi_predicates<Traits> preds;
typedef boost::polygon::detail::circle_event<boost::int32_t> circle_event;
typedef boost::polygon::detail::site_event<boost::int32_t> site_event;
typedef boost::polygon::detail::voronoi_predicates<Traits> preds;
typedef boost::polygon::detail::circle_event<std::int32_t> circle_event;
typedef boost::polygon::detail::site_event<std::int32_t> site_event;
typedef typename preds::template mp_circle_formation_functor<site_event, circle_event> circle_pred;
boost::random::uniform_int_distribution<> dist(0, points.size() - 1);
circle_pred pc;
circle_event event;
circle_pred pc;
circle_event event;
stopwatch<boost::chrono::high_resolution_clock> w;
for(unsigned i = 0; i < 10000; ++i)
for (unsigned i = 0; i < 10000; ++i)
{
site_event s1(points[dist(gen)]);
site_event s2(points[dist(gen)]);
@@ -166,7 +167,7 @@ double test(const char* name)
pc.sss(s1, s2, s3, event);
}
double d = boost::chrono::duration_cast<boost::chrono::duration<double> >(w.elapsed()).count();
if(d < min_time)
if (d < min_time)
min_time = d;
results[name] = d;
std::cout << "Time for " << std::setw(30) << std::left << name << " = " << d << std::endl;
@@ -179,27 +180,26 @@ void generate_quickbook()
std::map<std::string, double>::const_iterator i(results.begin()), j(results.end());
while(i != j)
while (i != j)
{
double rel = i->second / min_time;
std::cout << "[[" << i->first << "][" << rel << "(" << i->second << "s)]]\n";
++i;
}
std::cout << "]\n";
}
int main()
{
boost::random::uniform_int_distribution<> dist((std::numeric_limits<boost::int32_t>::min)() / 2, (std::numeric_limits<boost::int32_t>::max)() / 2);
boost::random::uniform_int_distribution<> dist((std::numeric_limits<std::int32_t>::min)() / 2, (std::numeric_limits<std::int32_t>::max)() / 2);
for(unsigned i = 0; i < 100; ++i)
for (unsigned i = 0; i < 100; ++i)
{
points.push_back(i_point(dist(gen), dist(gen)));
}
test<boost::polygon::detail::voronoi_ctype_traits<boost::int32_t> >("extended_int");
test<boost::polygon::detail::voronoi_ctype_traits<std::int32_t> >("extended_int");
test<cpp_int_voronoi_traits<boost::multiprecision::int256_t> >("int256_t");
test<cpp_int_voronoi_traits<boost::multiprecision::int512_t> >("int512_t");
@@ -220,10 +220,9 @@ int main()
generate_quickbook();
test<native_int_voronoi_traits<boost::int64_t> >("int64_t");
test<cpp_int_voronoi_traits<boost::multiprecision::number<boost::multiprecision::arithmetic_backend<boost::int64_t>, boost::multiprecision::et_off> > >("number<arithmetic_backend<boost::int64_t>, et_off>");
//test<cpp_int_voronoi_traits<boost::multiprecision::number<boost::multiprecision::arithmetic_backend<boost::int64_t>, boost::multiprecision::et_on> > >("number<arithmetic_backend<boost::int64_t>, et_on>");
test<native_int_voronoi_traits<std::int64_t> >("int64_t");
test<cpp_int_voronoi_traits<boost::multiprecision::number<boost::multiprecision::arithmetic_backend<std::int64_t>, boost::multiprecision::et_off> > >("number<arithmetic_backend<std::int64_t>, et_off>");
//test<cpp_int_voronoi_traits<boost::multiprecision::number<boost::multiprecision::arithmetic_backend<std::int64_t>, boost::multiprecision::et_on> > >("number<arithmetic_backend<std::int64_t>, et_on>");
return 0;
}