2
0
mirror of https://github.com/boostorg/math.git synced 2026-01-19 04:22:09 +00:00

Remove dyadic_grid from detail namespace. [CI SKIP]

This commit is contained in:
Nick Thompson
2020-03-07 12:30:35 -05:00
parent 40405e38f6
commit e0e3872de7
3 changed files with 23 additions and 25 deletions

View File

@@ -27,7 +27,7 @@ void DyadicGrid(benchmark::State & state)
size_t s = 0;
for (auto _ : state)
{
auto v = boost::math::detail::dyadic_grid<Real, 4, 0>(j);
auto v = boost::math::dyadic_grid<Real, 4, 0>(j);
benchmark::DoNotOptimize(v[0]);
s = v.size();
}
@@ -486,4 +486,4 @@ void CardinalSepticHermiteAOS(benchmark::State & state)
BENCHMARK_TEMPLATE(CardinalSepticHermiteAOS, double)->RangeMultiplier(2)->Range(1<<8, 1<<20)->Complexity();
BENCHMARK_MAIN();
BENCHMARK_MAIN();

View File

@@ -11,9 +11,8 @@ int main()
std::cout << std::right;
auto daub = boost::math::daubechies_scaling<float, i+2>();
std::cout << "The Daubechies " << std::setw(2) << i + 2 << " scaling function occupies "
<< std::setw(12) << daub.bytes() << " bytes in relative accuracy mode in "
<< std::setw(12) << daub.bytes()/1000.0 << " kilobytes in relative accuracy mode in "
<< boost::core::demangle(typeid(float).name()) << " precision\n";
//std::cout << "Size of class = " << sizeof(daub) << "\n";
});
std::cout << std::endl;
@@ -25,9 +24,8 @@ int main()
std::cout << std::right;
auto daub = boost::math::daubechies_scaling<float, i+2>(-2);
std::cout << "The Daubechies " << std::setw(2) << i + 2 << " scaling function occupies "
<< std::setw(12) << daub.bytes() << " bytes in absolute accuracy mode in "
<< std::setw(12) << daub.bytes()/1000.0 << " kilobytes in absolute accuracy mode in "
<< boost::core::demangle(typeid(float).name()) << " precision\n";
//std::cout << "Size of class = " << sizeof(daub) << "\n";
});
std::cout << std::endl;
@@ -40,7 +38,7 @@ int main()
std::cout << std::right;
auto daub = boost::math::daubechies_scaling<double, i+2>();
std::cout << "The Daubechies " << std::setw(2) << i + 2 << " scaling function occupies "
<< std::setw(12) << daub.bytes() << " bytes in relative accuracy mode in "
<< std::setw(12) << daub.bytes()/1000.0 << " kilobytes in relative accuracy mode in "
<< boost::core::demangle(typeid(double).name()) << " precision\n";
});
@@ -53,9 +51,9 @@ int main()
std::cout << std::right;
auto daub = boost::math::daubechies_scaling<double, i+2>(-2);
std::cout << "The Daubechies " << std::setw(2) << i + 2 << " scaling function occupies "
<< std::setw(12) << daub.bytes() << " bytes in absolute accuracy mode in "
<< std::setw(12) << daub.bytes()/1000.0 << " kilobytes in absolute accuracy mode in "
<< boost::core::demangle(typeid(double).name()) << " precision\n";
});
}
}

View File

@@ -22,8 +22,6 @@
namespace boost::math {
namespace detail {
template<class Real, int p, int order>
std::vector<Real> dyadic_grid(int64_t j_max)
{
@@ -35,7 +33,7 @@ std::vector<Real> dyadic_grid(int64_t j_max)
x *= scale;
}
auto phik = daubechies_scaling_integer_grid<Real, p, order>();
auto phik = detail::daubechies_scaling_integer_grid<Real, p, order>();
// Maximum sensible j for 32 bit floats is j_max = 22:
std::vector<Real> v(2*p + (2*p-1)*((1<<j_max) -1), std::numeric_limits<Real>::quiet_NaN());
@@ -52,7 +50,7 @@ std::vector<Real> dyadic_grid(int64_t j_max)
{
// Where this value will go:
int64_t delivery_idx = k*(1 << (j_max-j));
// This is a nice check, but we've tested this exhaustively, and it's expensive:
// This is a nice check, but we've tested this exhaustively, and it's an expensive check:
//if (delivery_idx >= (int64_t) v.size()) {
// std::cerr << "Delivery index out of range!\n";
// continue;
@@ -81,6 +79,8 @@ std::vector<Real> dyadic_grid(int64_t j_max)
return v;
}
namespace detail {
template<class RandomAccessContainer>
class matched_holder {
public:
@@ -298,7 +298,7 @@ public:
std::future<std::vector<Real>> t0 = std::async(std::launch::async, [&grid_refinements]() {
// Computing in higher precision and downcasting is essential for 1ULP evaluation in float precision:
if constexpr (std::is_same_v<Real, float>) {
auto v = detail::dyadic_grid<double, p, 0>(grid_refinements);
auto v = dyadic_grid<double, p, 0>(grid_refinements);
std::vector<float> w(v.size());
for (size_t i = 0; i < v.size(); ++i) {
w[i] = v[i];
@@ -306,7 +306,7 @@ public:
return w;
}
else if constexpr (std::is_same_v<Real, double>) {
auto v = detail::dyadic_grid<long double, p, 0>(grid_refinements);
auto v = dyadic_grid<long double, p, 0>(grid_refinements);
std::vector<double> w(v.size());
for (size_t i = 0; i < v.size(); ++i) {
w[i] = v[i];
@@ -314,12 +314,12 @@ public:
return w;
}
return detail::dyadic_grid<Real, p, 0>(grid_refinements);
return dyadic_grid<Real, p, 0>(grid_refinements);
});
// Compute the derivative of the refined grid:
std::future<std::vector<Real>> t1 = std::async(std::launch::async, [&grid_refinements]() {
if constexpr (std::is_same_v<Real, float>) {
auto v = detail::dyadic_grid<double, p, 1>(grid_refinements);
auto v = dyadic_grid<double, p, 1>(grid_refinements);
std::vector<float> w(v.size());
for (size_t i = 0; i < v.size(); ++i) {
w[i] = v[i];
@@ -327,7 +327,7 @@ public:
return w;
}
else if constexpr (std::is_same_v<Real, double>) {
auto v = detail::dyadic_grid<long double, p, 1>(grid_refinements);
auto v = dyadic_grid<long double, p, 1>(grid_refinements);
std::vector<double> w(v.size());
for (size_t i = 0; i < v.size(); ++i) {
w[i] = v[i];
@@ -335,7 +335,7 @@ public:
return w;
}
return detail::dyadic_grid<Real, p, 1>(grid_refinements);
return dyadic_grid<Real, p, 1>(grid_refinements);
});
// if necessary, compute the second and third derivative:
@@ -345,7 +345,7 @@ public:
std::future<std::vector<Real>> t3 = std::async(std::launch::async, [&grid_refinements]() {
if constexpr (std::is_same_v<Real, float>)
{
auto v = detail::dyadic_grid<double, p, 2>(grid_refinements);
auto v = dyadic_grid<double, p, 2>(grid_refinements);
std::vector<float> w(v.size());
for (size_t i = 0; i < v.size(); ++i)
{
@@ -355,7 +355,7 @@ public:
}
else if constexpr (std::is_same_v<Real, double>)
{
auto v = detail::dyadic_grid<long double, p, 2>(grid_refinements);
auto v = dyadic_grid<long double, p, 2>(grid_refinements);
std::vector<double> w(v.size());
for (size_t i = 0; i < v.size(); ++i)
{
@@ -364,14 +364,14 @@ public:
return w;
}
return detail::dyadic_grid<Real, p, 2>(grid_refinements);
return dyadic_grid<Real, p, 2>(grid_refinements);
});
if constexpr (p >= 10) {
std::future<std::vector<Real>> t4 = std::async(std::launch::async, [&grid_refinements]() {
if constexpr (std::is_same_v<Real, float>)
{
auto v = detail::dyadic_grid<double, p, 3>(grid_refinements);
auto v = dyadic_grid<double, p, 3>(grid_refinements);
std::vector<float> w(v.size());
for (size_t i = 0; i < v.size(); ++i)
{
@@ -380,7 +380,7 @@ public:
return w;
}
else if constexpr (std::is_same_v<Real, double>) {
auto v = detail::dyadic_grid<long double, p, 3>(grid_refinements);
auto v = dyadic_grid<long double, p, 3>(grid_refinements);
std::vector<double> w(v.size());
for (size_t i = 0; i < v.size(); ++i)
{
@@ -389,7 +389,7 @@ public:
return w;
}
return detail::dyadic_grid<Real, p, 3>(grid_refinements); });
return dyadic_grid<Real, p, 3>(grid_refinements); });
d3ydx3 = t4.get();
}
d2ydx2 = t3.get();