LabelledArrays.jl icon indicating copy to clipboard operation
LabelledArrays.jl copied to clipboard

Labelled Array Constructors do not promote to dual numbers

Open ChrisRackauckas opened this issue 6 years ago • 2 comments

julia> using ForwardDiff, LabelledArrays

julia> SLVector(a=2.0,b=ForwardDiff.Dual(1,2))
2-element SLArray{Tuple{2},Real,1,2,(:a, :b)}:
                  2.0
 Dual{Nothing}(1,2)

ChrisRackauckas avatar Oct 13 '19 00:10 ChrisRackauckas

These should be using promote_type instead of just convert(T:

https://github.com/JuliaDiffEq/LabelledArrays.jl/blob/master/src/slarray.jl#L1-L19

ChrisRackauckas avatar Oct 13 '19 00:10 ChrisRackauckas

So this is actually an issue in StaticArrays, see https://github.com/JuliaArrays/StaticArrays.jl/pull/670, caused by generated functions.

andreasnoack avatar Oct 14 '19 10:10 andreasnoack