Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Deduction42 opened this issue Oct 8, 2024 · 1 comment

Comments

@Deduction42
Copy link

Deduction42 commented Oct 8, 2024

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?

@Deduction42
Copy link
Author

This is a duplicate of #183

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant