-
Notifications
You must be signed in to change notification settings - Fork 146
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
Define ForwardDiffNumber <: Real #66
Comments
I'm not opposed. Worst case we reverse the decision later if it turns out that this is a bad idea, but so far I don't know of any examples where this would be dangerous or harmful. |
I am in strong favor of this change! I (unfortunately) haven't followed closely the development of ForwardDiff, but I think that to be consistent with this change, we need the definition like |
Just FYI, I'm working on this here and man...the number of ambiguity warnings this causes is bonkers. Unsurprising, but bonkers. It might take a while before this is ready for a proper PR. |
Hi @jrevels, I reply here as you suggested. I can see the merits of defining dual numbers as a special case of real, and it makes sense in many ways indeed. I just want to be sure we don't move towards this direction lightheartedly and make sure we have weighted the pros and cons... for example, nested types should be ok, I agree. How about the I am not against the overall change, just to be clear. |
|
To clarify, the comment that @Scidom is referring to I made in the context of a discussion that I thought was about @jrevels, do you agree that if EDIT: I guess this will actually already be true because of https://github.com/JuliaLang/julia/blob/f8a4340548e7d6be31fede13cdc4e0f5f434f33f/base/complex.jl#L40, as long as we don't define a more specialized version of it. |
Ok, |
Oups, @goretkin, we posted simultaneously. Your suggestion for About duals I agree... if we make forward diff numbers subtypes of real then same should be done for duals :) |
If
I don't agree with this, if you're talking about making Just to avoid confusion - especially for any lurkers who might be concerned about this issue - here is a summary of my key points (some of which were posted in the other thread).
|
I am not sure how you have created this impression about DualNumbers.jl :) The sole reason of existence of DualNumbers.jl has been to support forward AD in the simple case of hyper-duals with a single epsilon component. In fact, the only usage case of DualNumbers.jl you will find online is that of AD, and none computer algebra-oriented. If we decide to invoke algebraic arguments as more important than programming ones, then there is absolutely no reason to apply this only on DualNumbers.jl given the way the package is utilised. All in all, we are talking about the exact same concept, hyper-duals (and duals are a subset of this), so it makes no sense to say that one package should use duals as a subset of real and another shouldn't; at the very least, there should be a level of consistency between DualNumbers.jl and ForwardDiff.jl. Indeed the only line of counter-argument is that of use case, but there it is clear from their use in the wider community that both packages serve the very same purpose, that of AD. I am ok to go for (hyper)duals turning to subsets of reals after having heard some convincing arguments in favour for it, but clearly can accept this change as long as it happens as a whole to any (hyper)dual numbers used for AD in Julia, including DualNumbers.jl. |
I also am not convinced that @jrevels made a comment about nested ForwardDiffNumbers working. As far as I understand, it's not possible to make the I think that's further evidence that |
My points were more of a proposal for the future rather than an interpretation of the current packages |
Exactly (also you might be interested in https://github.com/dpsanders/ValidatedNumerics.jl). I think this point favors the separation of implementation of ForwardDiff.jl and DualNumbers.jl. There is no formal dependency between DualNumbers.jl and ForwardDiff.jl, just an overlap of the functionality they provide. Thus, my belief is that the |
(re-add deleted comment since it's quoted. I had deleted it because I panicked about not finding a reference to Dual numbers as intervals and forgetting exactly how they work.) I hope this comment doesn't distract from the main discussion, but I want to mention that you can also make Dual numbers to work as interval arithmetic (where instead of maintaining upper and lower bounds, the non-epsilon part is the center of the interval, and the epsilon part is the radius). I think it is nifty that the same algebraic properties gives you both an "Interval Number" and a "Forward Diff" number of order 1. I don't know if a hyperdual number behaves in any other interesting ways, but I just wanted to point out that Dual numbers do more than strictly AD in the space of practical numerics outside the realm. What that's an argument for, I'm not totally sure. But this same discussion probably would happen again regarding Interval arithmetic. Except that AD/differentiation is used a ton ton more than interval arithmetic. |
Thanks for pointing this out about interval arithmetic @goretkin, wasn't aware of such use of dual numbers. @jrevels, ok, wasn't aware that you were mostly projecting to the future. I wouldn't have any serious objections to not make duals a subtype of reals, if you could convince me that there is a useful future direction. Apart from the internals of implementation, what are the benefits of not turning duals to be a subtype of reals? If I understand well, the one example mentioned so far is that of interval arithmetic, correct? |
Could we limit the discussion here to |
But these two are (at the very least mathematically and thus conceptually) highly overlapping, so a high level discussion about their overall direction in association with their similarities and differences is needed in my opinion... |
But is anyone opposed to |
Ok, @mlubin, let's keep the momentum and our focus on getting I think we should have a discussion about the future of DualNumbers in relation to AD and interval arithmetic; if anything else, it will clarify matters and possibly future development (it may even inform package naming for DualNumbers). To avoid distractions, we can discuss this in DualNumbers.jl, I can open a separate issue there. |
See discussion here.
Does anybody have any practical arguments for why we shouldn't do this?
The text was updated successfully, but these errors were encountered: