You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Broadcasting fails for VectorOfArray(Array{<:SVector{1}}). This is specific to parent arrays with element type <:SVector{1}; it works fine if <:SVector{N} where N > 1.
Minimal Reproducible Example 👇
using RecursiveArrayTools
using StaticArrays
# works for SVector{N} where N > 1
u = [SVector(0, 1) for _ in1:2]
u_voa =VectorOfArray(u)
v_voa =copy(u_voa)
@. v_voa = u_voa
# doesn't work for SVector{1}
u = [SVector(0) for _ in1:2]
u_voa =VectorOfArray(u)
v_voa =copy(u_voa)
@. v_voa = u_voa
Error & Stacktrace ⚠️
ERROR: MethodError: Cannot `convert` an object of type SVector{1, Int64} to an object of type Int64
Closest candidates are:convert(::Type{T}, ::T) where T<:Number
@ Base number.jl:6convert(::Type{T}, ::T) where T
@ Base Base.jl:84convert(::Type{T}, ::AbstractChar) where T<:Number
@ Base char.jl:185...
Stacktrace:
[1] macro expansion
@ ~/.julia/packages/StaticArraysCore/P6PH7/src/StaticArraysCore.jl:88 [inlined]
[2] convert_ntuple
@ ~/.julia/packages/StaticArraysCore/P6PH7/src/StaticArraysCore.jl:84 [inlined]
[3] SVector{1, Int64}(x::Tuple{SVector{1, Int64}})
@ StaticArraysCore ~/.julia/packages/StaticArraysCore/P6PH7/src/StaticArraysCore.jl:120
[4] macro expansion
@ StaticArrays ~/.julia/packages/StaticArrays/YN0oL/src/arraymath.jl:52 [inlined]
[5] _fill
@ StaticArrays ~/.julia/packages/StaticArrays/YN0oL/src/arraymath.jl:40 [inlined]
[6] fill
@ StaticArrays ~/.julia/packages/StaticArrays/YN0oL/src/arraymath.jl:39 [inlined]
[7] copyto!
@ RecursiveArrayTools ~/.julia/dev/RecursiveArrayTools/src/vector_of_array.jl:895 [inlined]
[8] materialize!
@ Base.Broadcast ./broadcast.jl:914 [inlined]
[9] materialize!(dest::VectorOfArray{…}, bc::Base.Broadcast.Broadcasted{…})
@ Base.Broadcast ./broadcast.jl:911
[10] top-level scope
@ Untitled-1:14
Some type information was truncated. Use `show(err)` to see complete types.
Environment (please complete the following information):
Describe the bug 🐞
Expected behavior
Broadcasting fails for
VectorOfArray(Array{<:SVector{1}})
. This is specific to parent arrays with element type<:SVector{1}
; it works fine if<:SVector{N}
whereN > 1
.Minimal Reproducible Example 👇
Error & Stacktrace⚠️
Environment (please complete the following information):
using Pkg; Pkg.status()
using Pkg; Pkg.status(; mode = PKGMODE_MANIFEST)
versioninfo()
Additional context
This comes up when trying to use
VectorOfArray
in an explicit OrdinaryDiffEq.jl solver.The text was updated successfully, but these errors were encountered: