-
Notifications
You must be signed in to change notification settings - Fork 1
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
Generic fft interface #8
Changes from all commits
104cce7
2855074
e0e3ee5
710ff43
7c22d19
8c4a5f1
fd1f2b5
6fc3a27
060b710
72aa580
24a56e2
b9489a9
19ba639
d37da90
82faf77
fe927df
ee44888
3fb3beb
570d77d
0bc8a27
5df6c0d
392a2c4
5c2e26b
8f4c355
4a33c19
69539f6
ac4b2dc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,7 @@ | |
#include <boost/multiprecision/complex128.hpp> | ||
#endif | ||
#include <boost/multiprecision/complex_adaptor.hpp> | ||
#include <boost/math/constants/constants.hpp> | ||
|
||
/* | ||
RingType axioms: | ||
|
@@ -50,6 +51,27 @@ | |
*/ | ||
|
||
namespace boost { namespace math { namespace fft { namespace detail { | ||
|
||
#if __cplusplus < 201700L | ||
template<typename ...> using void_t = void; | ||
#else | ||
using std::void_t; | ||
#endif | ||
|
||
|
||
template<class T, typename = void_t<> > | ||
struct is_complex : std::false_type | ||
{}; | ||
|
||
template<class T > | ||
struct is_complex<T, | ||
void_t< | ||
typename T::value_type, | ||
decltype(sin(std::declval<typename T::value_type>())), | ||
decltype(cos(std::declval<typename T::value_type>())) | ||
> > : std::true_type | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's a very nice template. However I am a little bit concerned with it's name. Maybe better to be more explicit that it checks for presence of Following this, I think we should to go through Boost libs and add tests for stuff which happens to have It's also possible to calculate the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So far we have two kinds of template algorithms:
The intention of this template is to tell if the argument represents a complex number, so that we can choose one DFT implementation or the other. Checking for sin/cos is a first approach to deduce the answer for unknown types. We could change the logic if needed to. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK, I see. Then maybe simpler it would be to use the native There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That would be great! But the documentation says: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, we could alias and specialize the template There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
@ckormanyos , this seems like a bug to me, what would you say about this? EDIT: or maybe there is some other Then There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As for the Type Traits library, that's not a bug Multiprecision has its own definition of the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for checking this. We will have time figure this out. Maybe for example check if the type uses There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In enable or test a Boolean value from:
I need to check again if this works for non-built-in (i.e., multiprecision) types. But here is a rather restricting constraint. Very much work was done to make Boost.Math standalone, requiring no other Boost library dependencies other than itself. It might be incongruent with the evolution of Boost.Math to have FFT depend on Boost.Multiprecision. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I definitely agree with that. We will need to do more SFINAE (or #ifdef :) ) tricks to make sure that a simple line that calls FFT on a simple double type does not pull extra dependencies with it. |
||
{}; | ||
|
||
|
||
// Recognizes: | ||
// → fundamental types | ||
|
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.
Hmm.. if I get the intentions correctly it should be checking for presence of
Or did I misunderstood something?
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.
I see, you are computing
sin(…)
andcos(…)
of phase ∈ ℝ. OK. I will need to ponder this for a while.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.
Yes, it is not so important to compute the sin/cos of the complex number. Our implementation needs the sin/cos of the underlying real phase.