JuliaArrays / BlockArrays.jl

BlockArrays for Julia
http://juliaarrays.github.io/BlockArrays.jl/
Other
195 stars 29 forks source link

DimensionMismatch in broadcast #295

Open krcools opened 1 year ago

krcools commented 1 year ago

The following simple code crashes:

julia> a = PseudoBlockVector(rand(243), [81,81,81]);
julia> b = PseudoBlockVector(rand(243), [81,81,81]);
julia> a .+= 0.123 .* b;

with

ERROR: DimensionMismatch: arrays could not be broadcast to a common size; got a dimension with lengths 81 and 243
Stacktrace:
  [1] _bcs1(a::Base.OneTo{Int64}, b::BlockedUnitRange{Vector{Int64}})
    @ Base.Broadcast .\broadcast.jl:516
  [2] _bcs
    @ .\broadcast.jl:510 [inlined]
  [3] broadcast_shape
    @ .\broadcast.jl:504 [inlined]
  [4] combine_axes
    @ .\broadcast.jl:499 [inlined]
  [5] _axes
    @ .\broadcast.jl:224 [inlined]
  [6] axes
    @ .\broadcast.jl:222 [inlined]
  [7] materialize!
    @ C:\Users\krcools\.julia\packages\BlockArrays\EqqKB\src\blockbroadcast.jl:145 [inlined]
  [8] broadcast!(::typeof(+), ::SubArray{Float64, 1, Vector{Float64}, Tuple{UnitRange{Int64}}, true}, ::SubArray{Float64, 1, Vector{Float64}, Tuple{UnitRange{Int64}}, true}, ::Base.Broadcast.Broadcasted{BlockArrays.PseudoBlockStyle{1}, Nothing, typeof(*), Tuple{Float64, PseudoBlockVector{Float64, Vector{Float64}, Tuple{BlockedUnitRange{Vector{Int64}}}}}})
    @ Base.Broadcast .\broadcast.jl:837
  [9] macro expansion
    @ C:\Users\krcools\.julia\packages\BlockArrays\EqqKB\src\blockbroadcast.jl:172 [inlined]
 [10] _generic_blockbroadcast_copyto!(dest::PseudoBlockVector{Float64, Vector{Float64}, Tuple{BlockedUnitRange{Vector{Int64}}}}, bc::Base.Broadcast.Broadcasted{BlockArrays.PseudoBlockStyle{1}, Tuple{BlockedUnitRange{Vector{Int64}}}, typeof(+), Tuple{PseudoBlockVector{Float64, Vector{Float64}, Tuple{BlockedUnitRange{Vector{Int64}}}}, Base.Broadcast.Broadcasted{BlockArrays.PseudoBlockStyle{1}, Nothing, typeof(*), Tuple{Float64, PseudoBlockVector{Float64, Vector{Float64}, Tuple{BlockedUnitRange{Vector{Int64}}}}}}}})
    @ BlockArrays C:\Users\krcools\.julia\packages\BlockArrays\EqqKB\src\blockbroadcast.jl:148
 [11] copyto!(dest::PseudoBlockVector{Float64, Vector{Float64}, Tuple{BlockedUnitRange{Vector{Int64}}}}, bc::Base.Broadcast.Broadcasted{BlockArrays.PseudoBlockStyle{1}, Tuple{BlockedUnitRange{Vector{Int64}}}, typeof(+), Tuple{PseudoBlockVector{Float64, Vector{Float64}, Tuple{BlockedUnitRange{Vector{Int64}}}}, Base.Broadcast.Broadcasted{BlockArrays.PseudoBlockStyle{1}, Nothing, typeof(*), Tuple{Float64, PseudoBlockVector{Float64, Vector{Float64}, Tuple{BlockedUnitRange{Vector{Int64}}}}}}}})
    @ BlockArrays C:\Users\krcools\.julia\packages\BlockArrays\EqqKB\src\blockbroadcast.jl:216
 [12] materialize!(dest::PseudoBlockVector{Float64, Vector{Float64}, Tuple{BlockedUnitRange{Vector{Int64}}}}, bc::Base.Broadcast.Broadcasted{BlockArrays.PseudoBlockStyle{1}, Nothing, typeof(+), Tuple{PseudoBlockVector{Float64, Vector{Float64}, Tuple{BlockedUnitRange{Vector{Int64}}}}, Base.Broadcast.Broadcasted{BlockArrays.PseudoBlockStyle{1}, Nothing, typeof(*), Tuple{Float64, PseudoBlockVector{Float64, Vector{Float64}, Tuple{BlockedUnitRange{Vector{Int64}}}}}}}})
    @ BlockArrays C:\Users\krcools\.julia\packages\BlockArrays\EqqKB\src\blockbroadcast.jl:145
 [13] top-level scope
    @ REPL[6]:1
cenarius1985 commented 6 months ago

encontraste la solucion?, tengo el mismo problema