On Monday, December 15, 2014 5:36:54 PM UTC-5, yu...@altern.org wrote:
>
> Both Nx1 and 1xN arrays are matrices (ndims=2), but N-vectors 
> (ndims=1) are almost functionally equivalent to Nx1 matrices, i.e. you can 
> use them in matrix multiplication and such.
>

Ah. Interesting:

~~~
julia> [1 2 3]  # "row vector"
1x3 Array{Int64,2}:
 1  2  3

julia> [1, 2, 3]  # "column vector", aka "vector" (a Vector)
3-element Array{Int64,1}:
 1
 2
 3

julia> ndims([1 2 3; 4 5 6])
2

julia> ndims([1 2 3])
2

julia> ndims([1, 2, 3])
1

julia> size([1 2 3])
(1,3)

julia> size([1, 2, 3])
(3,)
~~~
 

> This is a bit weird at first but it doesn't cause much problems in 
> practice, even though it can be a bit funny sometimes:
>
> julia> x == x''
> false
>
>
Ok:

~~~
julia> [1, 2, 3]  # ndims == 1
3-element Array{Int64,1}:
 1
 2
 3

julia> [1 2 3]'  # but here, ndims == 2
3x1 Array{Int64,2}:
 1
 2
 3
~~~

Thanks!

Reply via email to