Preallocating an Array with a given size in Julia 1.0

Hi there,
I’m trying to preallocate an array of hundred elements of Float64 just as one would declare in C or something else.

It seems that before the code was Vector{Float64,1}(1000) but now I get an error when trying this

2 Likes

Vector{Float64}(undef,1000) or Array{Float64,1}(undef, 1000).

It was Vector{Float64}(1000) or Array{Float64,1}(1000) before. If you use 0.7 then you get depreciation warnings that tell you what to do, compared to 0.6.

3 Likes

thanks!

x-ref: PSA: use Julia 0.7 if you are upgrading

1 Like

I think the 1 here is not needed because it is deduced from the dimensions, so just Array{Float64}(undef, 1000).