Skip to content

Commit

Permalink
fix tests AD and julia 1.8
Browse files Browse the repository at this point in the history
  • Loading branch information
thorek1 committed Dec 20, 2023
1 parent d336763 commit a74d0f8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/MacroModelling.jl
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ function obc_constraint_optim_fun(res::Vector{S}, X::Vector{S}, jac::Matrix{S},
𝓂 = p[4]

if length(jac) > 0
jac .= 𝒜.jacobian(𝒷, xx -> 𝓂.obc_violation_function(xx, p), X)[1]'
jac .= 𝒜.jacobian(𝒷(), xx -> 𝓂.obc_violation_function(xx, p), X)[1]'
end

res .= 𝓂.obc_violation_function(X, p)
Expand Down
12 changes: 8 additions & 4 deletions src/get_functions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1233,31 +1233,35 @@ function get_steady_state(𝓂::ℳ;
if algorithm == :third_order

dSSS = 𝒜.jacobian(𝒷(), x->begin
SSS = SSS_third_order_parameter_derivatives(x, param_idx, 𝓂, verbose = verbose)[collect(SSS[1])[var_idx]...,collect(SSS[3])[calib_idx]...]
SSS = SSS_third_order_parameter_derivatives(x, param_idx, 𝓂, verbose = verbose)
[collect(SSS[1])[var_idx]...,collect(SSS[3])[calib_idx]...]
end, 𝓂.parameter_values[param_idx])[1]

return KeyedArray(hcat(SS[[var_idx...,calib_idx...]], dSSS); Variables_and_calibrated_parameters = axis1, Steady_state_and_∂steady_state∂parameter = axis2)

elseif algorithm == :pruned_third_order

dSSS = 𝒜.jacobian(𝒷(), x->begin
SSS = SSS_third_order_parameter_derivatives(x, param_idx, 𝓂, verbose = verbose, pruning = true)[collect(SSS[1])[var_idx]...,collect(SSS[3])[calib_idx]...]
SSS = SSS_third_order_parameter_derivatives(x, param_idx, 𝓂, verbose = verbose, pruning = true)
[collect(SSS[1])[var_idx]...,collect(SSS[3])[calib_idx]...]
end, 𝓂.parameter_values[param_idx])[1]

return KeyedArray(hcat(SS[[var_idx...,calib_idx...]], dSSS); Variables_and_calibrated_parameters = axis1, Steady_state_and_∂steady_state∂parameter = axis2)

elseif algorithm == :pruned_second_order

dSSS = 𝒜.jacobian(𝒷(), x->begin
SSS = SSS_second_order_parameter_derivatives(x, param_idx, 𝓂, verbose = verbose, pruning = true)[collect(SSS[1])[var_idx]...,collect(SSS[3])[calib_idx]...]
SSS = SSS_second_order_parameter_derivatives(x, param_idx, 𝓂, verbose = verbose, pruning = true)
[collect(SSS[1])[var_idx]...,collect(SSS[3])[calib_idx]...]
end, 𝓂.parameter_values[param_idx])[1]

return KeyedArray(hcat(SS[[var_idx...,calib_idx...]], dSSS); Variables_and_calibrated_parameters = axis1, Steady_state_and_∂steady_state∂parameter = axis2)

else

dSSS = 𝒜.jacobian(𝒷(), x->begin
SSS = SSS_second_order_parameter_derivatives(x, param_idx, 𝓂, verbose = verbose)[collect(SSS[1])[var_idx]...,collect(SSS[3])[calib_idx]...]
SSS = SSS_second_order_parameter_derivatives(x, param_idx, 𝓂, verbose = verbose)
[collect(SSS[1])[var_idx]...,collect(SSS[3])[calib_idx]...]
end, 𝓂.parameter_values[param_idx])[1]

return KeyedArray(hcat(SS[[var_idx...,calib_idx...]], dSSS); Variables_and_calibrated_parameters = axis1, Steady_state_and_∂steady_state∂parameter = axis2)
Expand Down

0 comments on commit a74d0f8

Please sign in to comment.