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 an operator over a matrix (SMatrix{M,N}) and a column-like (SMatrix{M,1}) or row-like (SMatrix{1,N}) matrix doesn't work and generates a DimensionMismatch error is generated. (Seems to be related to #199.)
julia>VERSIONv"0.6.1-pre.0"
julia> SA =@SMatrix [12; 34]
2×2 StaticArrays.SArray{Tuple{2,2},Int64,2,4}:1234
julia> SC =@SMatrix [2;4]
2×1 StaticArrays.SArray{Tuple{2,1},Int64,2,2}:24
julia> SR =@SMatrix [24]
1×2 StaticArrays.SArray{Tuple{1,2},Int64,2,2}:24
julia>broadcast(+, SA, SC)
ERROR:DimensionMismatch("Tried to broadcast on inputs sized Tuple{Int64,Int64}[(2, 2), (2, 1)]")
Stacktrace:
[1] _broadcast(...) at /Users/wsshin/.julia/v0.6/StaticArrays/src/broadcast.jl:52
[2] broadcast(::Function, ::StaticArrays.SArray{Tuple{2,2},Int64,2,4}, ::StaticArrays.SArray{Tuple{2,1},Int64,2,2}) at /Users/wsshin/.julia/v0.6/StaticArrays/src/broadcast.jl:8
julia>broadcast(+, SA, SR)
ERROR:DimensionMismatch("Tried to broadcast on inputs sized Tuple{Int64,Int64}[(2, 2), (1, 2)]")
Stacktrace:
[1] _broadcast(...) at /Users/wsshin/.julia/v0.6/StaticArrays/src/broadcast.jl:52
[2] broadcast(::Function, ::StaticArrays.SArray{Tuple{2,2},Int64,2,4}, ::StaticArrays.SArray{Tuple{1,2},Int64,2,2}) at /Users/wsshin/.julia/v0.6/StaticArrays/src/broadcast.jl:8
Is this difficult to fix?
If an actual vector is used instead of a column-like matrix, broadcasting works. Therefore, currently I am working around this as follows:
julia>broadcast(+, SA, SC[:,1])
2×2 StaticArrays.SArray{Tuple{2,2},Int64,2,4}:3478
julia>broadcast(+, SA', SR[1,:])'2×2 StaticArrays.SArray{Tuple{2,2},Int64,2,4}:3658
The text was updated successfully, but these errors were encountered:
Broadcasting an operator over a matrix (
SMatrix{M,N}
) and a column-like (SMatrix{M,1}
) or row-like (SMatrix{1,N}
) matrix doesn't work and generates aDimensionMismatch
error is generated. (Seems to be related to #199.)Is this difficult to fix?
If an actual vector is used instead of a column-like matrix, broadcasting works. Therefore, currently I am working around this as follows:
The text was updated successfully, but these errors were encountered: