On Wednesday, September 03, 2014 10:57:16 AM David Smith wrote:
> Also, why don't we have a squeeze(A::AbstractArray{T,N}) method that
> eliminates all singleton dimensions?  If we had that, indexing returning
> singleton dimensions wouldn't be as bad.  Currently, having to write
> squeeze(a[k,:,:],1) is terrible.  That is something where Matlab wins.

It wins, until the day that the a that gets returned by some other algorithm 
happens, on one iteration out of 10^4, to have size (K, M, N) with M =1. At 
that point, Matlab's squeeze delivers you an Nx1 array rather than the 1xN 
array you wished you had.

I can't tell you how many times I got bit by that, until I stopped using 
squeeze altogether and just used reshape(). Which is more tedious yet than 
Julia's squeeze().

--Tim

Reply via email to