Skip to content

Commit

Permalink
Make dual
Browse files Browse the repository at this point in the history
  • Loading branch information
gdalle authored Jul 28, 2024
1 parent 09c4a97 commit 61cc9e4
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,18 @@ function make_dual(::Type{T}, x::Number, dx::Number) where {T}
return Dual{T}(x, dx)
end

function make_dual(::Type{T}, x, dx) where {T}
return Dual{T}.(x, dx)
end

function make_dual(::Type{T}, x::Number, dx::Batch{B,<:Number}) where {T,B}
return Dual{T}(x, dx.elements...)
end

function make_dual(::Type{T}, x, dx::Batch{B}) where {T,B}
return Dual{T}.(x, dx.elements...)
end

function make_dual!(::Type{T}, xdual, x, dx) where {T}
return xdual .= Dual{T}.(x, dx)
end
Expand Down

0 comments on commit 61cc9e4

Please sign in to comment.