Skip to content

Commit

Permalink
added version of derivative that takes a scalar argument and returns …
Browse files Browse the repository at this point in the history
…a scalar output.
  • Loading branch information
brianguenter committed Nov 30, 2023
1 parent ce661db commit 5642c1a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Jacobian.jl
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,12 @@ function derivative(A::AbstractArray{<:Node}, variables::T...) where {T<:Node}
end
export derivative

"""Convenience `derivative` for scalar functions. Takes a scalar input and returns a scalar output"""
function derivative(A::Node, variables::T...) where {T<:Node}
derivative([A], variables...)[1]
end


"""
_derivative(A::AbstractArray{<:Node}, variable::Node)
Expand Down

0 comments on commit 5642c1a

Please sign in to comment.