See 
http://stackoverflow.com/questions/21152051/difference-between-nx1-array-and-n-element-array-in-julia/

In your example, sometimes returning a matrix and sometimes returning a 
vector from rand(5, x) would be similarly type-unstable.  More than that, 
though: the logical conclusion of this line of thinking leads to 1x1 
matrices behaving like scalars.  You'd get wildly different behaviors if a 
dimension happens to become 1: you can add two mismatched matrices if one 
of them happens to be 1x1.  This can be manageable, but you lose the 
advantage of Julia's type system and dispatch to separate matrix addition 
from scalar addition.

On Wednesday, June 8, 2016 at 12:32:58 AM UTC-5, SrAceves wrote:
>
>
>
> What's the use of Arrays{T,N} of size = (n, 1, 1, 1, ...)? In such cases, 
> would it make sense to default to a simple Array{T,1}?
>
> For example, rand(5, 1, 1, 1) would turn into rand(5)  (à la vec(rand(5, 
> 1, 1, 1))
>

Reply via email to