ThreadsX.jl icon indicating copy to clipboard operation
ThreadsX.jl copied to clipboard

`reduce(hcat, ...)` errors

Open stillyslalom opened this issue 4 years ago • 2 comments

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

stillyslalom avatar Aug 03 '21 00:08 stillyslalom

This probably needs a direct implementation, as Base does.

tkf avatar Aug 03 '21 02:08 tkf

Perhaps unsurprisingly, this is also a problem with ThreadsX.mapreduce that I ran into as well.

kescobo avatar Aug 04 '22 14:08 kescobo