Skip to content

Compatibility with StaticArrays? #183

@JTaets

Description

@JTaets

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 

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