-
Notifications
You must be signed in to change notification settings - Fork 152
map should work on dimension mismatch cases #1140
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
Comments
I did not know that julia> using StaticArrays
julia> map(+,SVector(1,2,3),1:4) # The output can be SVector(2,4,6)
ERROR: DimensionMismatch: Sizes (Size(3,), (4,)) of input arrays do not match
Stacktrace:
[1] _throw_size_mismatch(::SVector{3, Int64}, ::Vararg{Any})
@ StaticArrays ~/.julia/dev/StaticArrays/src/traits.jl:113
[2] same_size
@ ~/.julia/dev/StaticArrays/src/traits.jl:107 [inlined]
[3] macro expansion
@ ~/.julia/dev/StaticArrays/src/mapreduce.jl:74 [inlined]
[4] _map(::typeof(+), ::SVector{3, Int64}, ::UnitRange{Int64})
@ StaticArrays ~/.julia/dev/StaticArrays/src/mapreduce.jl:40
[5] map(f::Function, a1::SVector{3, Int64}, as::UnitRange{Int64})
@ StaticArrays ~/.julia/dev/StaticArrays/src/mapreduce.jl:31
[6] top-level scope
@ REPL[2]:1
julia> map(+,SVector(1,2,3),1:2) # The output cannot be SVector(2,4) or [2,4] for type-stability
ERROR: DimensionMismatch: Sizes (Size(3,), (2,)) of input arrays do not match
Stacktrace:
[1] _throw_size_mismatch(::SVector{3, Int64}, ::Vararg{Any})
@ StaticArrays ~/.julia/dev/StaticArrays/src/traits.jl:113
[2] same_size
@ ~/.julia/dev/StaticArrays/src/traits.jl:107 [inlined]
[3] macro expansion
@ ~/.julia/dev/StaticArrays/src/mapreduce.jl:74 [inlined]
[4] _map(::typeof(+), ::SVector{3, Int64}, ::UnitRange{Int64})
@ StaticArrays ~/.julia/dev/StaticArrays/src/mapreduce.jl:40
[5] map(f::Function, a1::SVector{3, Int64}, as::UnitRange{Int64})
@ StaticArrays ~/.julia/dev/StaticArrays/src/mapreduce.jl:31
[6] top-level scope
@ REPL[3]:1 |
This was added at some point, I think Julia 1.5, perhaps by accident. It also doesn't work for
Good point. |
|
In case anybody is interested: The types
|
The text was updated successfully, but these errors were encountered: