Skip to content

Loosen the HCubature element type bound for SVectors to allow Dual numbers #28

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

Merged
merged 3 commits into from
Jul 2, 2020

Conversation

ChrisRackauckas
Copy link
Member

Interestingly, all of the other definitions were <:Real, so the current behavior doesn't error right away but instead it falls into a StackOverflow trying to keep changing types until it can finally call this dispatch, which it's never able to do because it has a tighter signature. Loosening this should fix this SO and allow for Dual numbers to be used with SVector inputs.

Xref SciML/SciMLExpectations.jl#17

ChrisRackauckas and others added 2 commits June 30, 2020 09:36
…mbers

Interestingly, all of the other definitions were `<:Real`, so the current behavior doesn't error right away but instead it falls into a StackOverflow trying to keep changing types until it can finally call this dispatch, which it's never able to do because it has a tighter signature. Loosening this should fix this SO and allow for Dual numbers to be used with SVector inputs.
@stevengj stevengj merged commit 66074a8 into master Jul 2, 2020
@stevengj stevengj deleted the CR/dual_svector branch July 2, 2020 02:19
@stevengj
Copy link
Member

stevengj commented Jul 2, 2020

Note that passing through dual numbers is a pretty inefficient way to compute the derivative with respect to an endpoint — it should really just do a lower-dimensional integral over a surface of the hypercube.

@ChrisRackauckas
Copy link
Member Author

Yeah, we're not using it for the endpoint derivatives. This just came up when trying to verify derivative calculations in https://github.com/SciML/Quadrature.jl and it was low hanging fruit so I thought it might as well work. We're more interested in the derivative w.r.t. parameters of the integrand which works nicely with the dual numbers, and this just showed up when testing.

@ChrisRackauckas
Copy link
Member Author

Actually, I guess it did show up because one of the parameters is related to the support of the distribution we're integrating. Good point that it's just another integral.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants