4 ms·
> See for example the problems with Julia where column and row vectors are totally different types: http://2pif.info/op/julia.html http://2pif.info/op/julia.htm
by pygy_ 14y ago
> See for example the problems with Julia where column and row vectors are totally different types: http://2pif.info/op/julia.html http://2pif.info/op/julia.html
That was one year ago. They are still different types, but they behave as you would expect wrt arithmetics.
julia> x = [1,2,3]
3-element Int64 Array:
1
2
3
julia> y = [1 2 3]
1x3 Int64 Array:
1 2 3
julia> y'
3x1 Int64 Array:
1
2
3
julia> x + y'
3x1 Int64 Array:
2
4
6
Their size and dimensions are still different, though, but it is mostly a concern for library writers.
julia> ndims(x)
1
julia> ndims(y)
2
julia> ndims(y')
2
julia> size(x)
(3,)
julia> size(y)
(1,3)
See https://groups.google.com/forum/?fromgroups=#!msg/julia-dev/W2C9-HbXH3o/P8A8jo7FHSoJ https://groups.google.com/forum/?fromgroups=#!msg/julia-dev/... for the discussion that resulted from that post.
Edit: I should add that there's now a mailing list dedicated to statistics with Julia: https://groups.google.com/forum/#!forum/julia-stats https://groups.google.com/forum/#!forum/julia-stats
- Gravityloss 14y agoThanks, I actually went and tried myself as well and saw the same. So quite good though not yet fully "symmetric". >> z=size(a) (3,) >> z[2] BoundsError()
- alok-g 14y agoThis is pretty much the only thing that I do not like about Julia. Matlab also uses this concept, and I have had my Matlab code broken several times because of this issue.
- foobarqux 14y agoTrailing singleton dimensions in N-D arrays was a far worse problem that I believe Julia fixed.