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
I think this is expected, because the empty vector is effectively 0x1 (or if more dimensions matter, it is 0x1x1x1 etc.)
julia>size([], 1)
0
julia>size([], 2)
1
Concatenating an empty vector with a non-empty one arguably relies on it not being 0x0:
julia>vcat(Float64[], ones(2))
2-element Vector{Float64}:1.01.0
julia>vcat(Float64[], ones(2,1))
2×1 Matrix{Float64}:1.01.0
julia>vcat(zeros(0,0), ones(2))
ERROR: DimensionMismatch: number of columns of each array must match (got (0, 1))
Frankly: Why should have an empty array column dimension 1? In Matlab size([ ]) = (0,0).
I realize that in Julia this is a very basic issue, but
size([],2) = 0
would still be the right choice. All concatenations could accept an empty array, without any effect (similarly as in Matlab).
My final comment: Knowing the current behaviour, it is easy to programmatically overcome possible ambiguous situations.
So, this issue can be closed from my point of view.
The following is unexpected to me:
which is the same as
which is correct. Also
is as expected.
To obtain the expected result I needed to use
Is this behaviour the right one, or is a bug?
The text was updated successfully, but these errors were encountered: