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

Compatibility with ForwardDiff.Dual #764

Open
hstrey opened this issue Jan 21, 2022 · 6 comments
Open

Compatibility with ForwardDiff.Dual #764

hstrey opened this issue Jan 21, 2022 · 6 comments

Comments

@hstrey
Copy link

hstrey commented Jan 21, 2022

I would like to use Approxfun for creating custom distributions in Turing.jl but it seems that Approxfun is not compatible with ForwardDiff.Dual

using ForwardDiff, ApproxFun
f = Fun(x->exp(ForwardDiff.Dual(x,1)))

throws: ERROR: LoadError: type ForwardDiff.Dual{Nothing, Float64, 1} not supported

Since Approxfun.jl is compatible with DualNumbers.jl, I assumed that it would be compatible with ForwardDiff.Dual. Any thoughts?

@dlfivefifty
Copy link
Member

@hstrey
Copy link
Author

hstrey commented Jan 21, 2022

are you saying that it is working, or that you are in the process of implementing it? I am happy to help if it is in my set of skills.

@dlfivefifty
Copy link
Member

That’s a link to what I needed to add DualNumbers.jl support. Probably you can copy it for ForwardDiff.jl

@hstrey
Copy link
Author

hstrey commented Jan 21, 2022

thanks. I will give it a try. Can't we just fake compatibility by returning the derivatives from the FUNs.
f(x::Dual) = Dual(f(x.value),f(x.partials)*f'(x.value)) - I am paraphrasing

@dlfivefifty
Copy link
Member

Seems different than what you first asked

@longemen3000
Copy link

this package uses DualNumbers.Dual. ForwardDiff uses ForwardDiff.Dual

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