Skip to content

StaticArray failure with broadcast: Dimension is not stable, please file a bug #271

@Deduction42

Description

@Deduction42

So I tried using StaticArrays inside a ComponentArray. It constructed, but then I got problems with broadcasting.

Everything works with a regular vector

julia>ax = Axis(a=1,b=2,c=3)
Axis(a = 1, b = 2, c = 3)

julia> ca = ComponentVector(randn(3), ax)
ComponentVector{Float64}(a = -0.026510360005660757, b = 1.6198025264096019, c = 0.5024437339679514)

julia> ca.*0
ComponentVector{Float64}(a = -0.0, b = 0.0, c = 0.0)

Static Vector constructs but produces an error saying that the dimension is not static.

julia> cas = ComponentVector(SVector{3}(collect(ca)), ax)
ComponentVector{Float64, SVector{3, Float64}, Tuple{Axis{(a = 1, b = 2, c = 3)}}}(a = -0.026510360005660757, b = 1.6198025264096019, c = 0.5024437339679514)

julia> cas.*0
ERROR: Dimension is not static. Please file a bug.
Stacktrace:
 [1] error(s::String)
   @ Base .\error.jl:35
 [2] copy
   @ C:\Users\me\.julia\packages\StaticArrays\MSJcA\src\broadcast.jl:59 [inlined]
 [3] materialize(bc::Base.Broadcast.Broadcasted{StaticArraysCore.StaticArrayStyle{…}, Nothing, typeof(*), Tuple{…}})
   @ Base.Broadcast .\broadcast.jl:867
 [4] top-level scope
   @ REPL[5]:1
Some type information was truncated. Use `show(err)` to see complete types.

I'm guessing that ComponentVector implicitly assumes a regular vector somewhere so when instantiating, the length is unintentionally dropped?

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