|
45 | 45 | @inline Dual{T}(value::Real, partials::Tuple{}) where {T} = Dual{T}(value, Partials{0,typeof(value)}(partials))
|
46 | 46 | @inline Dual{T}(value::Real, partials::Real...) where {T} = Dual{T}(value, partials)
|
47 | 47 | @inline Dual{T}(value::V, ::Chunk{N}, p::Val{i}) where {T,V<:Real,N,i} = Dual{T}(value, single_seed(Partials{N,V}, p))
|
48 |
| - |
49 | 48 | @inline Dual(args...) = Dual{Nothing}(args...)
|
50 | 49 |
|
| 50 | +function Dual{T,V,N}(x::Real) where {T,V,N} |
| 51 | + Base.depwarn("Dual{$T,$V,$N}(x::Real) is deprecated, use `convert(Dual{$T,$V,$N}, x)` instead.", :Dual) |
| 52 | + return convert(Dual{T,V,N}, x) |
| 53 | +end |
| 54 | + |
| 55 | +function Dual{T,V}(x::Real) where {T,V} |
| 56 | + Base.depwarn("Dual{$T,$V}(x::Real) is deprecated, use `convert(Dual{$T,$V}, x)` instead.", :Dual) |
| 57 | + return convert(Dual{T,V}, x) |
| 58 | +end |
| 59 | + |
51 | 60 | ##############################
|
52 | 61 | # Utility/Accessor Functions #
|
53 | 62 | ##############################
|
|
315 | 324 | Base.convert(::Type{Dual{T,V,N}}, d::Dual{T}) where {T,V<:Real,N} = Dual{T}(convert(V, value(d)), convert(Partials{N,V}, partials(d)))
|
316 | 325 | Base.convert(::Type{Dual{T,V,N}}, x::Real) where {T,V<:Real,N} = Dual{T}(convert(V, x), zero(Partials{N,V}))
|
317 | 326 | Base.convert(::Type{D}, d::D) where {D<:Dual} = d
|
318 |
| -(::Type{D})(x::Real) where {D<:Dual} = convert(D, x) |
319 | 327 |
|
320 | 328 | Base.float(d::Dual{T,V,N}) where {T,V,N} = convert(Dual{T,promote_type(V, Float16),N}, d)
|
321 | 329 | Base.AbstractFloat(d::Dual{T,V,N}) where {T,V,N} = convert(Dual{T,promote_type(V, Float16),N}, d)
|
|
0 commit comments