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

Compatibility with ComponentArrays? #1117

Open
JTaets opened this issue Jan 9, 2023 · 0 comments
Open

Compatibility with ComponentArrays? #1117

JTaets opened this issue Jan 9, 2023 · 0 comments

Comments

@JTaets
Copy link

JTaets commented Jan 9, 2023

I could really use something like a namedtuple that can do vector operations (immutable, indexable by name and no allocations when doing operations). My idea was to try out ComponentArrays with StaticArrays. But it didn't work

using ComponentArrays
using StaticArrays

comp = ComponentArray((a=5.,b=(c=7.,d=8.)))
scomp = ComponentArray(SVector(getdata(comp)...),getaxes(comp))
getdata(scomp)*2 #works
scomp*2 # Error

The error is:

ERROR: Dimension is not static. Please file a bug.
Stacktrace:
 [1] error(s::String)
   @ Base .\error.jl:35
 [2] copy
   @ C:\Users\x\.julia\packages\StaticArrays\jA1zK\src\broadcast.jl:61 [inlined]
 [3] materialize
   @ .\broadcast.jl:860 [inlined]
 [4] broadcast_preserving_zero_d
   @ .\broadcast.jl:849 [inlined]
 [5] *(A::ComponentVector{Float64, SVector{3, Float64}, Tuple{Axis{(a = 1, b = ViewAxis(2:3, Axis(c = 1, d = 2)))}}}, B::Int64)
   @ Base .\arraymath.jl:24
 [6] top-level scope
   @ c:\Users\x\Documents\julia3\test.jl:71 

(Link to the similar issue in ComponentArrays)

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