I have a struct that has quite a few different fields. Initially, I can use parametric typing for all of the fields. For example:
struct MyStruct{TF, TI, TB}
a::TF
b::TF
c::Array{TF, 2}
d::TI
e::TI
f::TB
end
Now I'm using algorithmic differentiation with my code (I'm currently using the package ForwardDiff.jl). That means some fields will become the type Dual, and from what I understand that requires that either all of my fields become type Dual, or I have to make a unique parametric type for each field that might have a Dual come through.
Am I missing something? I feel like there is a better way to do this. Do I need to write a constructor that promotes all of my fields to the same type? Do I just use a different parametric type for every field (sometimes my structs have like 20+ fields)? Wouldn't that compromise any performance boost I might get? Should I leave the fields without type, and just rely on Any? What is going to be the most performant?