Skip to content

StaticArrays seems to apply promotion well for Base number types but not dual numbers #497

@jrevels

Description

@jrevels
julia> using ForwardDiff, StaticArrays

julia> x = ForwardDiff.Dual(1.0)
Dual{Nothing}(1.0)

julia> SMatrix{2,2}(x, 2, 3.0, 4.0)
2×2 SArray{Tuple{2,2},Real,2,4}:
 Dual{Nothing}(1.0)  3.0
               2     4.0

julia> promote(x, 2, 3.0, 4.0)
(Dual{Nothing}(1.0), Dual{Nothing}(2.0), Dual{Nothing}(3.0), Dual{Nothing}(4.0))

julia> SMatrix{2,2}(Int32(1), 2, 3.0, 4.0)
2×2 SArray{Tuple{2,2},Float64,2,4}:
 1.0  3.0
 2.0  4.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions