SciML / SciML/ComponentArrays.jl
Compatibility with StaticArrays?
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 375
- Forks
- 42
- Avg merge
- 7h 25m
- Merged PRs (30d)
- 17
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the Julia reproduction in the issue and inspect the interaction between ComponentArrays and StaticArrays, especially StaticArrays/src/broadcast.jl and Base arraymath.jl from the stack trace. Determine why scomp*2 reports a non-static dimension, then verify that the operation succeeds while preserving the named, indexable component behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- data
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100