Well, the keyword option is nicer in the sense that the programmer can't
make a mistake when choosing which dimension to squeeze on... There's no
need to type 'd' twice. I would even go as far as to say that a separate
function would be useful. I often want to "remove" a dimension by mean,
sum, std, var, cumsum, cumprod, etc along said dimension... Just a thought.
I realize though that this is a little too close to matlab-thinking and not
so julia-ish


Yakir Gagnon
The Queensland Brain Institute (Building #79)
The University of Queensland
Brisbane QLD 4072
Australia

cell +61 (0)424 393 332
work +61 (0)733 654 089


On Mon, Apr 28, 2014 at 8:53 PM, Tim Holy <[email protected]> wrote:

> You can always combine them into a single line:
>
>    mu1 = squeeze(mean(a, d), d)
>
> I'm not sure I have any ideas for how to make it more convenient. Are you
> thinking in terms of a keyword argument? Note that
>
>    mu1 = mean(a, d, squeeze=true)
>
> is not any shorter.
>
> --Tim
>
>
> On Monday, April 28, 2014 12:05:37 AM Yakir Gagnon wrote:
> > I guess I can understand why the dimension of the mean of a say
> 3-dimension
> > array along the (say) third dimension is still a 3-dimensional array
> with a
> > singleton (say) last dimension. But is there any better way to remove
> that
> > dimension than:
> >
> > d = 3
> > a = rand(3,5,10)
> > mu1 = mean(a,d)
> > mu = squeeze(mu1,d)
>

Reply via email to