Skip to content

Commit

Permalink
Bump FD compat
Browse files Browse the repository at this point in the history
  • Loading branch information
lassepe committed Aug 28, 2023
1 parent 1c704ff commit 52f1149
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ ChainRulesCore = "1"
ForwardDiff = "0.10"
PATHSolver = "1.4"
Symbolics = "4,5"
FastDifferentiation = "0.2.9"
FastDifferentiation = "0.3"
julia = "1.8"
8 changes: 3 additions & 5 deletions src/parametric_problem.jl
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,7 @@ function ParametricMCP(
f! = let
# The multi-arg version of `make_function` is broken so we concatenate to a single arg here
_f! = FD.make_function(f_node, [z_node; θ_node]; in_place = true)
# FastDifferentation has a reverse convention of where the result is so we have to
# streamline it here...
(result, z, θ) -> _f!([z; θ], result)
(result, z, θ) -> _f!(result, [z; θ])
end

# same as above but for the Jacobian in z
Expand All @@ -128,7 +126,7 @@ function ParametricMCP(
# TODO: constant entry detection
constant_entries = Int[]
SparseFunction(rows, cols, size(jacobian_z_node), constant_entries) do result, z, θ
_jacobian_z!([z; θ], result)
_jacobian_z!(result, [z; θ])
end
end

Expand All @@ -139,7 +137,7 @@ function ParametricMCP(
# TODO: constant entry detection
constant_entries = Int[]
SparseFunction(rows, cols, size(jacobian_θ_node), constant_entries) do result, z, θ
_jacobian_θ!([z; θ], result)
_jacobian_θ!(result, [z; θ])
end
end
else
Expand Down

0 comments on commit 52f1149

Please sign in to comment.