diff --git a/include/boost/math/differentiation/lanczos_smoothing.hpp b/include/boost/math/differentiation/lanczos_smoothing.hpp index 05eaf21ec..198b8fc97 100644 --- a/include/boost/math/differentiation/lanczos_smoothing.hpp +++ b/include/boost/math/differentiation/lanczos_smoothing.hpp @@ -157,7 +157,7 @@ class discrete_legendre { }; template -std::vector interior_filter(size_t n, size_t p) { +std::vector interior_velocity_filter(size_t n, size_t p) { // We could make the filter length n, as f[0] = 0, // but that'd make the indexing awkward when applying the filter. std::vector f(n + 1, 0); @@ -187,7 +187,7 @@ std::vector interior_filter(size_t n, size_t p) { } template -std::vector boundary_filter(size_t n, size_t p, int64_t s) +std::vector boundary_velocity_filter(size_t n, size_t p, int64_t s) { std::vector f(2 * n + 1, 0); auto dlp = discrete_legendre(n); @@ -223,7 +223,7 @@ std::vector boundary_filter(size_t n, size_t p, int64_t s) } template -std::vector acceleration_boundary_filter(size_t n, size_t p, int64_t s) +std::vector acceleration_filter(size_t n, size_t p, int64_t s) { BOOST_ASSERT_MSG(p <= 2*n, "Approximation order must be <= 2*n"); BOOST_ASSERT_MSG(p > 2, "Approximation order must be > 2"); @@ -278,7 +278,7 @@ public: if constexpr (std::is_same_v || std::is_same_v) { - auto interior = detail::interior_filter(n, approximation_order); + auto interior = detail::interior_velocity_filter(n, approximation_order); m_f.resize(interior.size()); for (size_t j = 0; j < interior.size(); ++j) { @@ -287,7 +287,7 @@ public: } else { - m_f = detail::interior_filter(n, approximation_order); + m_f = detail::interior_velocity_filter(n, approximation_order); } m_boundary_filters.resize(n); @@ -298,7 +298,7 @@ public: if constexpr (std::is_same_v || std::is_same_v) { int64_t s = static_cast(i) - static_cast(n); - auto bf = detail::boundary_filter(n, approximation_order, s); + auto bf = detail::boundary_velocity_filter(n, approximation_order, s); m_boundary_filters[i].resize(bf.size()); for (size_t j = 0; j < bf.size(); ++j) { @@ -308,7 +308,7 @@ public: else { int64_t s = static_cast(i) - static_cast(n); - m_boundary_filters[i] = detail::boundary_filter(n, approximation_order, s); + m_boundary_filters[i] = detail::boundary_velocity_filter(n, approximation_order, s); } } } @@ -321,7 +321,7 @@ public: // since the resulting cost is a factor of 2, and the cost of the filters not working is hours of debugging. if constexpr (std::is_same_v || std::is_same_v) { - auto f = detail::acceleration_boundary_filter(n, approximation_order, 0); + auto f = detail::acceleration_filter(n, approximation_order, 0); m_f.resize(n+1); for (size_t i = 0; i < m_f.size(); ++i) { @@ -331,7 +331,7 @@ public: for (size_t i = 0; i < n; ++i) { int64_t s = static_cast(i) - static_cast(n); - auto bf = detail::acceleration_boundary_filter(n, approximation_order, s); + auto bf = detail::acceleration_filter(n, approximation_order, s); m_boundary_filters[i].resize(bf.size()); for (size_t j = 0; j < bf.size(); ++j) { @@ -343,7 +343,7 @@ public: { // Given that the purpose is denoising, for higher precision calculations, // the default precision should be fine. - auto f = detail::acceleration_boundary_filter(n, approximation_order, 0); + auto f = detail::acceleration_filter(n, approximation_order, 0); m_f.resize(n+1); for (size_t i = 0; i < m_f.size(); ++i) { @@ -353,7 +353,7 @@ public: for (size_t i = 0; i < n; ++i) { int64_t s = static_cast(i) - static_cast(n); - m_boundary_filters[i] = detail::acceleration_boundary_filter(n, approximation_order, s); + m_boundary_filters[i] = detail::acceleration_filter(n, approximation_order, s); } } } diff --git a/test/lanczos_smoothing_test.cpp b/test/lanczos_smoothing_test.cpp index cf41c8016..1303933fd 100644 --- a/test/lanczos_smoothing_test.cpp +++ b/test/lanczos_smoothing_test.cpp @@ -8,7 +8,6 @@ #include #include -#include #include #include #include @@ -24,8 +23,8 @@ using boost::multiprecision::cpp_bin_float_50; using boost::multiprecision::cpp_bin_float_100; using boost::math::differentiation::discrete_lanczos_derivative; using boost::math::differentiation::detail::discrete_legendre; -using boost::math::differentiation::detail::interior_filter; -using boost::math::differentiation::detail::boundary_filter; +using boost::math::differentiation::detail::interior_velocity_filter; +using boost::math::differentiation::detail::boundary_velocity_filter; template void test_dlp_norms() @@ -161,7 +160,7 @@ void test_dlp_second_derivative() template -void test_interior_filter() +void test_interior_velocity_filter() { std::cout << "Testing interior filter on type " << typeid(Real).name() << "\n"; Real tol = std::numeric_limits::epsilon(); @@ -169,7 +168,7 @@ void test_interior_filter() { for (int p = 1; p < n; p += 2) { - auto f = interior_filter(n,p); + auto f = interior_velocity_filter(n,p); // Since we only store half the filter coefficients, // we need to reindex the moment sums: Real sum = 0; @@ -312,7 +311,7 @@ void test_interior_lanczos() } template -void test_boundary_filters() +void test_boundary_velocity_filters() { std::cout << "Testing boundary filters on type " << typeid(Real).name() << "\n"; Real tol = std::numeric_limits::epsilon(); @@ -322,7 +321,7 @@ void test_boundary_filters() { for (int s = -n; s <= n; ++s) { - auto f = boundary_filter(n, p, s); + auto f = boundary_velocity_filter(n, p, s); // Sum is zero: Real sum = 0; Real c = 0; @@ -484,7 +483,7 @@ void test_acceleration_filters() { for(int64_t s = -int64_t(n); s <= 0; ++s) { - auto g = boost::math::differentiation::detail::acceleration_boundary_filter(n,p,s); + auto g = boost::math::differentiation::detail::acceleration_filter(n,p,s); std::vector f(g.size()); for (size_t i = 0; i < g.size(); ++i) @@ -600,16 +599,16 @@ BOOST_AUTO_TEST_CASE(lanczos_smoothing_test) test_dlp_derivatives(); test_dlp_next(); test_dlp_norms(); - test_boundary_filters(); - test_boundary_filters(); - test_boundary_filters(); + test_boundary_velocity_filters(); + test_boundary_velocity_filters(); + test_boundary_velocity_filters(); test_boundary_lanczos(); test_boundary_lanczos(); // Takes too long! //test_boundary_lanczos(); - test_interior_filter(); - test_interior_filter(); + test_interior_velocity_filter(); + test_interior_velocity_filter(); test_interior_lanczos(); test_acceleration_filters();