Julia: 关于1.0的Array的变化

在1.0之前的版本,比如0.2-0.6,

data =Array{Float64,2}();

但现在1.0,这个会报错。

这个用法已经有重大的变化!

Array{T}(missing, dims)
Array{T,N}(missing, dims)
julia> a=Array{Float64}(undef, 2,3)
2×3 Array{Float64,2}:
 4.3066e-316  4.30661e-316  4.30661e-316
 4.3066e-316  4.30661e-316  0.0

julia> b=Array{Float64,2}(undef, 2,3)
2×3 Array{Float64,2}:
 1.061e-313  3.60739e-313  4.24399e-314
 2.122e-313  3.18299e-313  4.24399e-314

julia> a==b
false

julia> typeof(a)==typeof(b)
true

比如:

data = Array{Float64,2}(undef, 2, 3)

这个也算是重大的变化!

julia> data = Array{Float64,2}(undef, 2, 3)
2×3 Array{Float64,2}:
 1.07077e-313  1.07065e-313  6.80287e-316
 1.071e-313    6.94986e-316  0.0

julia> data = Array{Float64,2}()
ERROR: MethodError: no method matching Array{Float64,2}()
Closest candidates are:
  Array{Float64,2}(::UndefInitializer, ::Int64, ::Int64) where T at boot.jl:404
  Array{Float64,2}(::UndefInitializer, ::Int64...) where {T, N} at boot.jl:408
  Array{Float64,2}(::UndefInitializer, ::Tuple{Int64,Int64}) where T at boot.jl:412
  ...
Stacktrace:
 [1] top-level scope at none:0
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值