Closed GiggleLiu closed 3 years ago
zero
_zero
julia> using NiLang julia> struct A{T} x::T y end julia> _zero(A(2.0, 3.0)) A{Float64}(0.0, 0.0) julia> struct B{T} z::Vector{T} a::A{T} end julia> _zero(B(randn(4), A(2.0, 3.0))) B{Float64}([0.0, 0.0, 0.0, 0.0], A{Float64}(0.0, 0.0)) julia> _zero(ComplexF32) 0.0f0 + 0.0f0im julia> NiLang.AD.GVar(_zero(B(randn(4), A(2.0, 3.0)))) B{NiLang.AD.GVar{Float64, Float64}}(NiLang.AD.GVar{Float64, Float64}[GVar(0.0, 0.0), GVar(0.0, 0.0), GVar(0.0, 0.0), GVar(0.0, 0.0)], A{NiLang.AD.GVar{Float64, Float64}}(GVar(0.0, 0.0), GVar(0.0, 0.0)))
zero
in Base._zero
for zero composite types.