Skip to content
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

with_logabsdet_jacobian(::InverseFunctions.FunctionWithInverse, x) #11

Open
cscherrer opened this issue Oct 15, 2022 · 3 comments
Open

Comments

@cscherrer
Copy link

with_logabsdet_jacobian(f, x) currently breaks if f::InverseFunctions.FunctionWithInverse. Today @oschulz and I discussed the need for such a method. Could this be added? It will require a dependency on InverseFunctions.jl, but that's very light.

@devmotion
Copy link
Member

Sure that could be done.

But I think it does not scale and points to the design issues I raised in JuliaMath/InverseFunctions.jl#25. By wrapping a function in a FunctionWithInverse you break all downstream dispatches for the unwrapped function but it seems undesirable and unfeasible to add support for FunctionWithInverse to every single package. So I think the two general solutions are to (a) remove FunctionWithInverse and setinverse or (b) to unwrap it every time you call into another package that might dispatch on the function (with an unwrap function as suggested in JuliaMath/InverseFunctions.jl#25 (comment)). Since I assume (a) might not be an option for you, probably (b) is the best alternative.

@oschulz
Copy link
Collaborator

oschulz commented Oct 16, 2022

@cscherrer, we could dispatch on PushforwardMeasure{<:InverseFunction}, right? We just need it for the density method(s) after all.

@cscherrer
Copy link
Author

I kind of like the unwrap idea - then we don't need much in the way of special cases, and it's very little additional code. Ok to close this unless either of you think there's more to discuss. Thanks!

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

No branches or pull requests

3 participants