-
Notifications
You must be signed in to change notification settings - Fork 226
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Numerical evaluation of Fourier transform of Daubechies scaling funct… #921
Conversation
40909f0
to
c4b0791
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
General pedantic things. I'll read the paper this week so I can be more constructive.
include/boost/math/special_functions/fourier_transform_daubechies_scaling.hpp
Outdated
Show resolved
Hide resolved
include/boost/math/special_functions/fourier_transform_daubechies_scaling.hpp
Outdated
Show resolved
Hide resolved
include/boost/math/special_functions/fourier_transform_daubechies_scaling.hpp
Outdated
Show resolved
Hide resolved
include/boost/math/special_functions/fourier_transform_daubechies_scaling.hpp
Outdated
Show resolved
Hide resolved
include/boost/math/special_functions/fourier_transform_daubechies_scaling.hpp
Outdated
Show resolved
Hide resolved
5c65458
to
4adbc27
Compare
@jeremy-murphy : Your polynomial division algorithm is amazing; super fast and it looks like every recovered digit is correct. |
Are you serious? I actually wouldn't have expected it. Credit for the algorithm goes to Knuth, I just implemented it. |
Anyway, if I stop being grumpy for a moment: that's great news! :) |
include/boost/math/special_functions/fourier_transform_daubechies_scaling.hpp
Outdated
Show resolved
Hide resolved
702b407
to
bbea451
Compare
bbea451
to
e0373ac
Compare
@jeremy-murphy , @jzmaddock , @mborland , @ckormanyos : Obviously don't want to burden you guys with a problem you think is uninteresting, but I figured I'd at least try to plea for help. The accuracy here without argument promotion just seems unacceptable-for instance without arg promotion it appears that up to 8 mantissa bits are incorrect in float precision. Arg promotion leads to extreme additional computational expense. Maybe this is a "no solutions, only tradeoffs" situation, but I'd figure I'd at least see if there's anything obvious we can do. |
I'll try and take a look. |
e0373ac
to
d793bbc
Compare
No arg promotion-actually with arg promotion this would be tautologically 0 everywhere. |
d793bbc
to
94845c8
Compare
On the contrary, it sounds very interesting, and I wish I had time to help, but I don't. Maybe only certain operations need the extra accuracy afforded by arg promotion? |
94845c8
to
cbcba28
Compare
I haven't found the literature that defines the ratio for choosing an algorithm for polynomial evaluation, but I did find this reference, which may help you: S. Graillat, P. Langlois, and N. Louvet. Algorithms for accurate, vali- The textbook I got that reference from (Handbook of Floating-Point Arithmetic, 2nd ed.) suggests to take the "Graillat–Langlois–Louvet error-free transformation" and make it a compensated summation using the same principle as Kahan's summation. I can give you more details if you're interested. |
Yes, I'm interested. This particular algorithm has some trouble with compensated summation, because it's actually an infinite product where each term is a small polynomial. I think I might actually need some sort of "compensated product", if that even makes sense in floating point. |
f25ec93
to
6db459e
Compare
6db459e
to
96d761e
Compare
96d761e
to
c6d1c51
Compare
101e952
to
841795b
Compare
@jzmaddock , @mborland : I've finally gotten this working; mind giving it a look? |
841795b
to
6323bed
Compare
6323bed
to
5de1353
Compare
include/boost/math/special_functions/fourier_transform_daubechies_scaling.hpp
Outdated
Show resolved
Hide resolved
// we'd immediately just have to divide through by 1/sqrt(2). | ||
// These numbers agree with Table 6.2, but are generated via example/calculate_fourier_transform_daubechies_constants.cpp | ||
template <typename Real, unsigned N> constexpr const std::array<Real, N> ft_daubechies_scaling_polynomial_coefficients() { | ||
static_assert(N >= 1 && N <= 10, "Scaling function only implemented for 1-10 vanishing moments."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way to compute the constants outside of this range on an as-needed basis like calculate_constants
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really, especially since I want it in a constexpr std::array
. . .
The calculation is rather involved.. .
include/boost/math/special_functions/fourier_transform_daubechies_scaling.hpp
Outdated
Show resolved
Hide resolved
reporting/performance/fourier_transform_daubechies_scaling_performance.cpp
Outdated
Show resolved
Hide resolved
Co-authored-by: Matt Borland <[email protected]>
Co-authored-by: Matt Borland <[email protected]>
…ies_scaling.hpp Co-authored-by: Matt Borland <[email protected]>
…ies_scaling.hpp Co-authored-by: Matt Borland <[email protected]>
Co-authored-by: Matt Borland <[email protected]>
…ions.