On Wed, 2014-07-23 at 14:43 -0700, Sam L wrote:
>
> It seems odd that [1; 2] != [1 2]'; typeof shows the former
> is
> 1-dimensional and the latter 2-dimensional (if I'm
> interpreting
> correctly), but that seems kind of inconsistent.
>
> A similar issue with indexing surprised me recently. If A is a 2-d
> array, A[:, 1] is a 1-d array but A[1, :] is a 2-d array. The
> behavior you pointed out can sort of be deduced from concatenation
> section of the multi-dimensional arrays part of the manual, and the
> indexing behavior is in the indexing section. ("Trailing dimensions
> indexed with scalars are dropped.")
>
> Maybe those points should be emphasized in the manual.
The only reason I was aware of the problem was that the
http://bogumilkaminski.pl/files/julia_express.pdf document highlights
it, along with the gotcha you ran into.
>
> By the way, [1; 2] does happen to equal [1 2]' because [1 2]' reshapes
> [1 2] to a 2x1 array. However, [1; 2]' != [1 2].
Huh?
julia> [1; 2] == [1 2]'
false
julia> isequal([1; 2], [1 2]')
false
Ross
>