-
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
We need a universal method of constructing Complex type from Real. #16
Comments
@ckormanyos I suspect that the details of the solution should be defined inside Boost.Multiprecision folder. In a way I see it as Boost.Multiprecision does not provide enough type traits for the Complex types available in there. The user would include for example Does it mean that we need to fork multiprecision here for the purposes of adapting it to satisfy FFT needs? Is there some other solution maybe? We already discussed this a bit here. |
Is this crazy, but since we strive to use so many composite types in FFT, what if FFT were a part of Boost.Multiprecision? Turn it the other way around. Initially I do not like the feeling of that. I could also imagine writing, yet another, subset of something like |
It is not crazy. I was wondering myself if it should be a part of Multiprecision. |
Math - by name - should be mathematical functions as I see it. Difficulties begin when you try to have higher and higher precision and mathematical functions. So far it worked, thanks to ADL, inside Boost.Math. Am I correct? So if FFT is not in Boost.Multiprecision, but is in Boost.Math then heavy use of ADL and template specializations is a must. What Boost users would say if FFT was in Multiprecision. I guess a surprise. We can rationalize this solution. So which one is better. I seriously don't know. |
If they had said and done nothing, they would have gotten it anyway. Sometime within the next 2 years or so I would have put some real-to-half-complex FFTs and their convolutions in a utilitarian part of Multiprecision on the road to millions of digits. In that particular case there would have been essentially no announcement from our side and all of a sudden it would be there in Boost.Multiprecision. It is hard to think of another multiple-precision library that does not ship with its own home-brewed FFT. @Lagrang3 does this make any problems go away? We7you could see how it might be possible to adapt the namespaces and arch for FFT to be within |
I have managed to
|
Forgot to mention that I compile with:
|
We can actually get away without the complex selector. First of all the complex dft interface is a template on the complex type.
|
I guess that, eventually, boost::multiprecision will have to choose between using boost::math::fft or duplicating it. |
Indeed, which has, in fact, lead us to this issue. |
And also issue #20, if Boost.Math and Boost.Multiprecision cannot depend on each other then to solve both this issue and #20 simultaneously maybe the solution is to create a separate library: Boost.FFT, then both Boost.Math and Boost.Multiprecision could depend on Boost.FFT in a clear manner.
Indeed this would remove all dependencies altogether. A purely templated solution in Boost.FFT. I must admit that I like both of these. @ckormanyos what would you say? Also about the 2nd approach: the complex type could be deduced from the type stored inside the target container. |
Yes that would have the advantage of clarity. I would be somewhat hesitant to tackle the overhead of creating/establishing/defending-the-need-for an entirely new library for the sole purpose of FFT transformations. My strategy for Multiprecision is to make it also standalone. In that case, we could pull Multiprecision's FFT into Math and retain the standalone character. If we put FFT in Multiprecision, a lot of clients might say, cool you finally have FFTs, but what does Multiprecision have to do with my engineering domain? That makes it kind of silly to have FFT in Multiprecision. That would bring us back to Math. All this gets kind of circular, and you do ultimately end up at separate library thoughts. But I do still resist that. My favorite at the state of our tech would be to get Multiprecision's dependencies low or standalone and include the tiny parts of Multiprecision in Math's interface/implementation for FFT, meaning FFT in math+make Multiprecision's dependencie(s) lean. |
I understand these reservations and fully support them.
Yes, I think this is possible. Only small change needed in Boost.Multiprecision : integrate multiprecision_complex.hpp file. If I didn't miss anything, that should be totally enough. The only thing to decide is the name for boost::multiprecision::complex<…> template typename. Unless by "tiny parts" you meant that this file should stay in Boost.Math, which is also fine for me. Templatizing FFT solely on the Complex type is an alternative solution, which might make this file unnecessary. But somehow I still do like the notion of integrating all complex types available within Boost.Multiprecision into a single, easy to use, type. |
I just noticed that maybe Boost.Math in general suffers this problem: "What complex type to use"? |
To me there is no such big step in moving from a real to complex. The complex is just two reals with more methods added. |
Containers do not ask many questions about the parameter T. |
Often times we have encountered this problem. At this point, I actually think we should consult some of the other Boost.Math developers. Where do you get complex for built-ins and UDTs? Regarding the standard, I would perceive generic-complex as a potential improvement for the language. I kind of lost touch with the SGs and what's going on. I could ask around if anyone is working on this issue. I think SG6 (numerics) is the place to ask or elsewhere via proposal. I'm not sure at the moment if anyone is or not... But maybe if not, a proposal would be the right place to start moving forward on the standard. |
@jzmaddock warned me that using |
Link to other post where @ckormanyos mentions a bit controversial approach to this problem with cstdfloat_complex_std.hpp, which works with |
yes, definitely a standardized answer would do wonders here. |
Yes. I did mention that, and also mentioned its potential controversy and limitations. What I failed to mention is that the particular complex headers are not intended to be used directly. The intent is to simply There are many drawbacks to this solution. And it does not handle higher multiprecision types such as those we need also like The code below exhibits the abilities of
|
I will query at SG6 and in the papers and try to find out if such a proposal is/was undertaken. This does not resolve the issue at hand "where do you get your complex", because standardization is typically a long-term process. |
I just found a
I discovered it accidentally in a call to This |
Within Multiprecision, yes please, it would be best to stick to all the same traits class for this. |
Also we have a similar problem about recognizing whether a type |
@ckormanyos mentioned that math does not depend on multiprecision. So we cannot simply
#include <boost/multiprecision/complex_adaptor.hpp>
and go ahead. Also there is a multitude of real types available within Boost. See for example this short program:Also this code snippet should be nice to test the solution to the problem which we seek here.
Not mentioning the types in the works such as double_float and quad_float (I believe complex_adaptor is for them).
Now we need something which, in a universal way, constructs a Complex type for each of them. We have a hackish tool for that here already used in the code in several places.
@Lagrang3 already noted in the comments that it is needed.
The text was updated successfully, but these errors were encountered: