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

[Breaking] Allow value and partials to have distinct types #463

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

[Breaking] Allow value and partials to have distinct types #463

wants to merge 2 commits into from

Conversation

timholy
Copy link
Contributor

@timholy timholy commented Jul 27, 2020

This is one of those love/hate changes...in brief, it allows one to set up alternate rules for how the "epsilon" component of dual numbers behaves by changing the type of Dual from

struct Dual{T,V,N} <: Real
    value::V
    partials::Partials{N,V}
end

to

struct Dual{T,V,N,P} <: Real
    value::V
    partials::Partials{N,P}
end

Happy to discuss motivations for this change at my poster at JuliaCon (we should leave this open at least until then).

It also throws in a commit to change from one to oneunit in places where IMO the latter is technically the correct choice.

IMO, someone with permissions should tag this "breaking change" (note the version bump to 0.11). From the very minor modifications to the tests, it's reasonable to hope that this is non-breaking in "ordinary" usage, but any package that explicitly constructs a Dual{Tag,V,N} directly (by type) will be effectively broken. I guess it's a little bit ambiguous whether that counts as breaking, since Dual isn't an exported type.

@ChrisRackauckas
Copy link
Member

I don't think it's actually breaking because the view has been pretty clear that direct usage of Dual numbers is not part of the public facing API. I'd be willing to accept this.

I'd say we should probably start thinking about what a ForwardDiff 1.0 means. I think the library is quite mature, and would like to get "last things in" and just lock this library down.

@ChrisRackauckas ChrisRackauckas mentioned this pull request Aug 27, 2020
@andreasnoack andreasnoack changed the title Allow value and partials to have distinct types [Breaking] Allow value and partials to have distinct types Nov 29, 2020
@Keno
Copy link
Contributor

Keno commented Sep 9, 2021

Leaving a reference to #546 here, I'd like Partials also not be type-uniform, i.e. allowing each partial to be of a different type.

@ChrisRackauckas
Copy link
Member

Thinking about this some more, the Pumas type signatures are going to explode 100x in size because the use Duals of Duals of Duals, so now each of the partials is going to be printing out the dual of dual tag. We might need to fix Julia's type printing to not be so verbose by default if we're going down this route because this probably isn't the only case that would end up with a mess.

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.

None yet

4 participants