SciML / SciML/ComponentArrays.jl
getting "Only homogeneous arrays are allowed" error for Vector{SVector}
Open
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 375
- Forks
- 42
- Avg merge
- 7h 25m
- Merged PRs (30d)
- 17
Description
I am new to this package and it may be possible that I am misusing it, but
using ComponentArrays, StaticArrays
a = [zeros(3) for _ in 1:5]
ComponentVector((; a)) # works fine
b = zeros(SVector{3}, 5)
ComponentArray((; b)) # errors
stacktrace:
ERROR: Only homogeneous arrays are allowed.
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:35
[2] make_idx(data::Vector{Float64}, x::Vector{SVector{3}}, last_val::Int64)
@ ComponentArrays ~/.julia/packages/ComponentArrays/NoToB/src/componentarray.jl:207
[3] make_idx(data::Vector{Float64}, nt::@NamedTuple{b::Vector{SVector{3}}}, last_val::Int64)
@ ComponentArrays ~/.julia/packages/ComponentArrays/NoToB/src/componentarray.jl:161
[4] make_carray_args(A::Type{Vector}, nt::@NamedTuple{b::Vector{SVector{3}}})
@ ComponentArrays ~/.julia/packages/ComponentArrays/NoToB/src/componentarray.jl:151
[5] make_carray_args(nt::@NamedTuple{b::Vector{SVector{3}}})
@ ComponentArrays ~/.julia/packages/ComponentArrays/NoToB/src/componentarray.jl:144
[6] ComponentArray(nt::@NamedTuple{b::Vector{SVector{3}}})
@ ComponentArrays ~/.julia/packages/ComponentArrays/NoToB/src/componentarray.jl:64
[7] top-level scope
@ REPL[34]:1
versions:
julia> VERSION
v"1.10.0"
(jl_BH2t1B) pkg> st
Status `/tmp/jl_BH2t1B/Project.toml`
[b0b7db55] ComponentArrays v0.15.7
[90137ffa] StaticArrays v1.9.0
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
Reproduce the example with Julia 1.10, ComponentArrays 0.15.7, and StaticArrays 1.9.0, then inspect make_idx and make_carray_args in src/componentarray.jl around the stack-trace locations. The fix is done when ComponentArray((; b)) accepts the Vector{SVector{3}} example without the homogeneous-arrays error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- data
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100