ThreadsX.jl
ThreadsX.jl copied to clipboard
`reduce(hcat, ...)` errors
julia> ThreadsX.reduce(hcat, [rand(3), rand(3)])
ERROR: DimensionMismatch("mismatch in dimension 1 (expected 1 got 3)")
This is a common idiom for concatenating arrays of arrays. reduce(vcat, ...) runs, but produces incorrect results that point to the source of the error for hcat:
julia> ThreadsX.reduce(vcat, [rand(3), rand(3)])
8-element Vector{Union{InitialValues.InitialValueOf{typeof(vcat)}, Float64}}:
InitialValue(vcat)
0.7140306092023179
0.8995936786278651
0.5841323215816541
InitialValue(vcat)
0.45848307169563784
0.685422666949578
0.763444779970013
This probably needs a direct implementation, as Base does.
Perhaps unsurprisingly, this is also a problem with ThreadsX.mapreduce that I ran into as well.