as far as i understand, the type of one(T) is not necessarily T (JuliaPhysics/Measurements.jl#134 for example). but construct_seeds uses this:
|
@generated function single_seed(::Type{Partials{N,V}}, ::Val{i}) where {N,V,i} |
|
ex = Expr(:tuple, [ifelse(i === j, :(one(V)), :(zero(V))) for j in 1:N]...) |
|
return :(Partials($(ex))) |
|
end |
Maybe using
oneunit there is more correct?
as far as i understand, the type of
one(T)is not necessarilyT(JuliaPhysics/Measurements.jl#134 for example). butconstruct_seedsuses this:ForwardDiff.jl/src/partials.jl
Lines 9 to 12 in 50ec9a1
Maybe using
oneunitthere is more correct?