I think there's less agreement on whether the difference between A[:,3] and
A[3,:] is good. Julia at least makes it easy to work with dropped trailing
dimensions by supporting operations like size and indexing with more
dimensions than the array possesses: with b = A[:,3], you can still say
size(b,2) and b[4,1].
You also might like "slice", which drops all singleton dimensions, trailing or
not. My best guess is that julia will eventually make A[i,j] syntax for
slice(A, i, j), at which point the difference between the two will disappear.
But my crystal ball is still a bit murky on that point.
--Tim
On Wednesday, May 27, 2015 12:45:08 AM Andrea Cimatoribus wrote:
> I see your point, and actually think it's a very good idea. I am more
> unhappy with the difference between A[:,3] and A[3,:], but I have seen
> there are reasons for this too, even if I am not very convinced (but no
> expert to judge either). Is there agreement also on this? There're a ton of
> github discussions, but cannot understand what is the prevailing view, in
> particular for 0.4
>
> Il giorno martedì 26 maggio 2015 18:55:19 UTC+2, Tim Holy ha scritto:
> > The types of the arguments determine the return type. In that sense, A[:,
> > 3]
> > and A[:, 3:3] are completely different constructs, and the second is much
> > more
> > like A[:, 3:4] than it is like A[:, 3]. This is no different from the rest
> > of
> > julia---types matter.
> >
> > The flip side is Matlab's behavior, where an algorithm that happens to
> > return
> > 3:3 instead of 3:4 can suddenly change the behavior of some later
> > operation
> > like squeeze, and then reorder your dimensions on you. This is something
> > that
> > julia developers are trying to avoid.
> >
> > Best,
> > --Tim
> >
> > On Tuesday, May 26, 2015 08:58:47 AM Andrea Cimatoribus wrote:
> > > I have seen a lot of discussions on this issue, in particular in
> >
> > relation
> >
> > > to the coming 0.4 release. Since I must admit I got completely lost in
> >
> > the
> >
> > > debate: is there an agreement on this? Since it is such a fundamental
> > > element, which can break more or less any piece of code (and is also
> >
> > very
> >
> > > much connected to the switch to array views, as far as I understood), is
> >
> > it
> >
> > > possibly wiser to wait for 0.4 for a first test drive of Julia?
> > > Thanks.
> > >
> > > Il giorno giovedì 19 giugno 2014 11:18:10 UTC+2, Carlos Baptista ha
> >
> > scritto:
> > > > If I do this:
> > > >
> > > > A = rand(10, 10)
> > > > x = A[:, 3]
> > > >
> > > > then typeof(x) is Array{Float64, 1}. However if I do this:
> > > >
> > > > A = rand(10, 10)
> > > > x = A[:, 3:3]
> > > >
> > > > then typeof(x) is Array{Float64, 2}.
> > > >
> > > > Is this a bug, or is this behaviour the intention of the developers?
> >
> > In
> >
> > > > case of the latter: why?