Consider creating the following array of arrays:

julia> A = [rand(3) for i = 1:5]
5-element Array{Array{Float64,1},1}:
 [0.007268793547957397,0.7369278377195478,0.4022138494548331]
 [0.1465723997916304,0.31109494689689,0.8423556604313642]    
 [0.957599931474344,0.8119654625538855,0.106156261532669]    
 [0.8665750816190314,0.9983215743175364,0.48201520665129394] 
 [0.628125653002658,0.5852891135272846,0.6240444941706744]

The type of A is *Array{Array{Float64, 1}, 1}* as expected. However, let's 
say I first create a 2D array and afterwards try to convert this to an 
array of arrays:

julia> B = rand(3, 5)
3x5 Array{Float64,2}:
 0.0941064  0.180285  0.916548  0.906796  0.309762 
 0.41113    0.674431  0.990499  0.577311  0.472922 
 0.54994    0.913673  0.898939  0.671417  0.0544504

julia> A = [B[:, i] for i = 1:5]
5-element Array{Any,1}:
 [0.09410638348155964,0.4111301767644082,0.5499402666491009] 
 [0.1802847689705238,0.6744306262302906,0.9136732600406858]  
 [0.9165475568238766,0.9904993550419545,0.8989390399884916]  
 [0.9067959697140404,0.5773106590674384,0.6714168349642873]  
 [0.30976235751041514,0.4729224442912474,0.05445040118462896]

This time around the type of A is *Array{Any, 1}*. Is this to be expected?

Reply via email to