Skip to content

Commit

Permalink
Remove some internal dependencies for Daubechies wavelets. (boostorg#356
Browse files Browse the repository at this point in the history
)
  • Loading branch information
NAThompson authored May 20, 2020
1 parent aa4b140 commit 3c3217d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 12 deletions.
3 changes: 0 additions & 3 deletions example/daubechies_wavelets/wavelet_transform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include <cstdint>
#include <cmath>
#include <boost/math/quadrature/wavelet_transforms.hpp>
#include <Eigen/Dense>


int main()
Expand All @@ -23,10 +22,8 @@ int main()

auto Wf = daubechies_wavelet_transform<decltype(f), double, 8>(f);

Eigen::MatrixXd grid(512, 512);
double s = 7;
double t = 0;
grid(0,0) = Wf(s, t);

auto g = [&a](double t)->std::complex<double> {
if (t==0) {
Expand Down
4 changes: 2 additions & 2 deletions include/boost/math/special_functions/daubechies_scaling.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include <thread>
#include <future>
#include <iostream>
#include <boost/math/constants/constants.hpp>
#include <boost/math/special_functions/detail/daubechies_scaling_integer_grid.hpp>
#include <boost/math/filters/daubechies.hpp>
#include <boost/math/interpolators/detail/cubic_hermite_detail.hpp>
Expand All @@ -26,8 +25,9 @@ template<class Real, int p, int order>
std::vector<Real> daubechies_scaling_dyadic_grid(int64_t j_max)
{
using std::isnan;
using std::sqrt;
auto c = boost::math::filters::daubechies_scaling_filter<Real, p>();
Real scale = boost::math::constants::root_two<Real>()*(1 << order);
Real scale = sqrt(static_cast<Real>(2))*(1 << order);
for (auto & x : c)
{
x *= scale;
Expand Down
9 changes: 2 additions & 7 deletions test/daubechies_scaling_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,9 @@
#include <boost/hana/for_each.hpp>
#include <boost/hana/ext/std/integer_sequence.hpp>
#include <boost/math/tools/condition_numbers.hpp>
#include <boost/math/differentiation/finite_difference.hpp>
#include <boost/math/special_functions/daubechies_scaling.hpp>
#include <boost/math/filters/daubechies.hpp>
#include <boost/math/special_functions/detail/daubechies_scaling_integer_grid.hpp>
#include <boost/math/constants/constants.hpp>
#include <boost/math/quadrature/trapezoidal.hpp>
#include <boost/math/special_functions/next.hpp>

Expand All @@ -28,10 +26,7 @@
using boost::multiprecision::float128;
#endif


using boost::math::constants::pi;
using boost::math::constants::root_two;

using std::sqrt;
// Mallat, Theorem 7.4, characterization number 3:
// A conjugate mirror filter has p vanishing moments iff h^{(n)}(pi) = 0 for 0 <= n < p.
template<class Real, unsigned p>
Expand All @@ -55,7 +50,7 @@ void test_daubechies_filters()
{
H0 += h[j];
}
CHECK_MOLLIFIED_CLOSE(root_two<Real>(), H0, tol);
CHECK_MOLLIFIED_CLOSE(sqrt(static_cast<Real>(2)), H0, tol);

// This is implied if we choose the scaling function to be an orthonormal basis of V0.
Real scaling = 0;
Expand Down

0 comments on commit 3c3217d

Please sign in to comment.