Skip to content

Commit

Permalink
improve simple_jacobian
Browse files Browse the repository at this point in the history
  • Loading branch information
yash-rs committed Jul 16, 2023
1 parent 929552d commit f6920f7
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/jacobian.jl
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,12 @@ function jacobian_autodiff(f, x::AbstractArray, nonlinfun, alg)
num_of_chunks)
end

function simple_jacobian(f, x::Number)
ForwardDiff.derivative(f, x)
function simple_jacobian(f, x::Number, p)
g = Base.Fix2(f, p)
ForwardDiff.derivative(g, x)

Check warning on line 155 in src/jacobian.jl

View check run for this annotation

Codecov / codecov/patch

src/jacobian.jl#L153-L155

Added lines #L153 - L155 were not covered by tests
end

function simple_jacobian(f, x::AbstractArray{<:Number})
ForwardDiff.jacobian(f, x)
function simple_jacobian(f, x::AbstractArray{<:Number}, p)
g = Base.Fix2(f, p)
ForwardDiff.jacobian(g, x)

Check warning on line 160 in src/jacobian.jl

View check run for this annotation

Codecov / codecov/patch

src/jacobian.jl#L158-L160

Added lines #L158 - L160 were not covered by tests
end

0 comments on commit f6920f7

Please sign in to comment.